From: JinWang An Date: Wed, 30 Dec 2020 01:17:38 +0000 (+0900) Subject: Imported Upstream version 4.4.3 X-Git-Tag: upstream/4.4.3^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a8a4f33dbf9d8b13e211033debbb5271331aed4;p=platform%2Fupstream%2Fpython-lxml.git Imported Upstream version 4.4.3 --- diff --git a/CHANGES.txt b/CHANGES.txt index 6bbf7dca..4c02c1b5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,15 @@ lxml changelog ============== +4.4.3 (2020-01-28) +================== + +Bugs fixed +---------- + +* LP#1844674: ``itertext()`` was missing tail text of comments and PIs since 4.4.0. + + 4.4.2 (2019-11-25) ================== diff --git a/PKG-INFO b/PKG-INFO index f974f0a9..33c941f4 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: lxml -Version: 4.4.2 +Version: 4.4.3 Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API. Home-page: http://lxml.de/ Author: lxml dev team @@ -38,15 +38,13 @@ Description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libr as soon as a maintenance branch has been established. Note that this requires Cython to be installed at an appropriate version for the build. - 4.4.2 (2019-11-25) + 4.4.3 (2020-01-28) ================== Bugs fixed ---------- - * LP#1835708: ``ElementInclude`` incorrectly rejected repeated non-recursive - includes as recursive. - Patch by Rainer Hausdorf. + * LP#1844674: ``itertext()`` was missing tail text of comments and PIs since 4.4.0. @@ -62,6 +60,7 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: C Classifier: Operating System :: OS Independent Classifier: Topic :: Text Processing :: Markup :: HTML diff --git a/doc/html/FAQ.html b/doc/html/FAQ.html new file mode 100644 index 00000000..6445eaed --- /dev/null +++ b/doc/html/FAQ.html @@ -0,0 +1,1028 @@ + + + + + +lxml FAQ - Frequently Asked Questions + + + + + +
+

lxml FAQ - Frequently Asked Questions

+ +

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

+
+

Contents

+ +
+

The code examples below use the 'lxml.etree` module:

+
>>> from lxml import etree
+
+
+

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 in +two ways, the best being the original ISO Schematron reference +implementation via XSLT. libxml2 also supports loading documents +through HTTP and FTP.

+

For RelaxNG Compact Syntax +support, there is a tool called rnc2rng, +written by David Mertz, which you might be able to use from Python. Failing +that, trang is the 'official' +command line tool (written in Java) to do the conversion.

+
+
+

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 content management. Many people who deploy +Zope, Plone or Django use it together with lxml in the background, +without speaking publicly about it. Therefore, it is hard to get an +idea of who uses it, and the following list of 'users and projects we +know of' is very far from 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
  • +
  • openpyxl, +a library to read/write MS Excel 2007 files
  • +
  • OpenXMLlib, +a library for handling OpenXML document meta data
  • +
  • PsychoPy, +psychology software in Python
  • +
  • Pycoon, +a WSGI web development framework based on XML pipelines
  • +
  • pycsw, +an OGC CSW server implementation written in Python
  • +
  • PyQuery, +a query framework for XML/HTML, similar to jQuery for JavaScript
  • +
  • python-docx, +a package for handling Microsoft's Word OpenXML format
  • +
  • Rambler, +news aggregator on Runet
  • +
  • rdfadict, +an RDFa parser with a simple dictionary-like interface.
  • +
  • xupdate-processor, +an XUpdate implementation for lxml.etree
  • +
  • Diazo, +an XSLT-under-the-hood web site theming engine
  • +
+

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
+
+

Note that this beautiful quick-and-dirty converter expects children +to have unique tag names and will silently overwrite any data that +was contained in preceding siblings with the same name. For any +real-world application of xml-to-dict conversion, you would better +write your own, longer version of this.

+
+
+

Why does lxml sometimes return 'str' values for text in Python 2?

+

In Python 2, lxml's API returns byte strings for plain ASCII text +values, be it for tag names or text in Element content. This is the +same behaviour as known from ElementTree. The reasoning is that ASCII +encoded byte strings are compatible with Unicode strings in Python 2, +but consume less memory (usually by a factor of 2 or 4) and are faster +to create because they do not require decoding. Plain ASCII string +values are very common in XML, so this optimisation is generally worth +it.

+

In Python 3, lxml always returns Unicode strings for text and names, +as does ElementTree. Since Python 3.3, Unicode strings containing +only characters that can be encoded in ASCII or Latin-1 are generally +as efficient as byte strings. In older versions of Python 3, the +above mentioned drawbacks apply.

+
+
+

Why do I get XInclude or DTD lookup failures on some systems but not on others?

+

To avoid network access, external resources are first looked up in +XML catalogues. +Many systems have them installed by default, but some don't. +On Linux systems, the default place to look is the index file +/etc/xml/catalog, which most importantly provides a mapping from +doctype IDs to locally installed DTD files.

+

See the libxml2 catalogue documentation +for further information.

+
+
+

How do namespaces work in lxml?

+

The same as in ElementTree. See the tutorial.

+
+
+
+

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?

+

Thanks to the help by Joar Wandborg, we try to make "manylinux" binary +builds for Linux available shortly after each source release, as they +are very frequently used by continuous integration and/or build servers.

+

Thanks to the help by Maximilian Hils and the Appveyor build service, +we also try to serve the frequent requests for binary builds available +for Microsoft Windows in a timely fashion, since users of that platform +usually fail to build lxml themselves. Two of the major design issues +of this operating system make this non-trivial for its users: the lack +of a pre-installed standard compiler and the missing package management.

+

Besides that, Christoph Gohlke generously provides unofficial lxml binary +builds for Windows +that are usually very up to date. Consider using them if you prefer a +binary build over a signed official source release.

+
+
+

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

+

You are using a Python installation that was configured for a different +internal Unicode representation than the lxml package you are trying to +install. CPython versions before 3.3 allowed to switch between two types +at build time: the 32 bit encoding UCS4 and the 16 bit encoding UCS2. +Sadly, both are not compatible, so eggs and other binary distributions +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.

+
+
+

My C compiler crashes on installation

+

lxml consists of a relatively large amount of (Cython) generated C code +in a single source module. Compiling this module requires a lot of free +memory, usually more than half a GB, which can pose problems especially on +shared/cloud build systems.

+

If your C compiler crashes while building lxml from sources, consider +using one of the binary wheels that we provide. The "manylinux" binaries +should generally work well on most build systems and install substantially +faster than a source build.

+
+
+
+

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 superset of the Python language that translates to 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 written entirely 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. Pull requests +on github 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 heard 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 starting point for +new users, so it is important for us to provide an easy to understand guide +into lxml. As all 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 master branch 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:

+
import sys
+from lxml import etree
+
+print("%-20s: %s" % ('Python',           sys.version_info))
+print("%-20s: %s" % ('lxml.etree',       etree.LXML_VERSION))
+print("%-20s: %s" % ('libxml used',      etree.LIBXML_VERSION))
+print("%-20s: %s" % ('libxml compiled',  etree.LIBXML_COMPILED_VERSION))
+print("%-20s: %s" % ('libxslt used',     etree.LIBXSLT_VERSION))
+print("%-20s: %s" % ('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 bug tracker or 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

    +
    +
  • +
  • in a threaded environment, try to initially import lxml.etree +from the main application thread instead of doing first-time imports +separately in each spawned worker thread. If you cannot control the +thread spawning of your web/application server, an import of +lxml.etree in sitecustomize.py or usercustomize.py may still do +the trick.

    +
  • +
  • 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.

+

Note that the remove_blank_text option also uses a heuristic if it +has no definite knowledge about the document's ignorable whitespace. +It will keep blank text nodes that appear after non-blank text nodes +at the same level. This is to prevent document-style XML from losing +content.

+

The HTMLParser has this structural knowledge built-in, which means that +most whitespace that appears between tags in HTML documents will not +be removed by this option, except in places where it is truly ignorable, +e.g. in the page header, between table structure tags, etc. Therefore, +it is also safe to use this option with the HTMLParser, as it will keep +content like the following intact (i.e. it will not remove the space +that separates the two words):

+
<p><b>some</b> <em>text</em></p>
+
+

If you want to be sure all blank text is removed from an XML document +(or just more blank text than the parser does by itself), you have to +use either a DTD to tell the parser which whitespace it can safely +ignore, or remove the ignorable whitespace manually after parsing, +e.g. by setting all tail text to None:

+
for element in root.iter():
+    element.tail = None
+
+

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

+
+
+

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

+

First of all, XML is explicitly defined as a stream of bytes. It's not +Unicode text. Take a look at the XML specification, it's all about byte +sequences and how to map them to text and structure. That leads to rule +number one: do not decode your XML data yourself. That's a part of the +work of an XML parser, and it does it very well. Just pass it your data as +a plain byte stream, it will always do the right thing, by specification.

+

This also includes not opening XML files in text mode. Make sure you always +use binary mode, or, even better, pass the file path into lxml's parse() +function to let it do the file opening, reading and closing itself. This +is the most simple and most efficient way to do it.

+

That being said, lxml can read Python unicode strings and even tries to +support them if libxml2 does not. This is because there is one valid use +case for parsing XML from text strings: literal XML fragments in source +code.

+

However, if the unicode string declares an XML encoding internally +(<?xml encoding="..."?>), parsing is bound to fail, as this encoding is +almost certainly 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. Therefore, parsing HTML from unicode strings is a much saner thing +to do than parsing XML from unicode strings.

+

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 that carry encoding information are +broken. lxml will not parse them. You must provide parsable data in a +valid encoding.

+
+
+

Can lxml parse from file objects opened in unicode/text mode?

+

Technically, yes. However, you likely do not want to do that, because +it is extremely inefficient. The text encoding that libxml2 uses +internally is UTF-8, so parsing from a Unicode file means that Python +first reads a chunk of data from the file, then decodes it into a new +buffer, and then copies it into a new unicode string object, just to +let libxml2 make yet another copy while encoding it down into UTF-8 +in order to parse it. It's clear that this involves a lot more +recoding and copying than when parsing straight from the bytes that +the file contains.

+

If you really know the encoding better than the parser (e.g. when +parsing HTML that lacks a content declaration), then instead of passing +an encoding parameter into the file object when opening it, create a +new instance of an XMLParser or HTMLParser and pass the encoding into +its constructor. Afterwards, use that parser for parsing, e.g. by +passing it into the etree.parse(file, parser) function. Remember +to open the file in binary mode (mode="rb"), or, if possible, prefer +passing the file path directly into parse() instead of an opened +Python file object.

+
+
+

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.

+
+
+

Is lxml vulnerable to XML bombs?

+

This has nothing to do with lxml itself, only with the parser of +libxml2. Since libxml2 version 2.7, the parser imposes hard security +limits on input documents to prevent DoS attacks with forged input +data. Since lxml 2.2.1, you can disable these limits with the +huge_tree parser option if you need to parse really large, +trusted documents. All lxml versions will leave these restrictions +enabled by default.

+

Note that libxml2 versions of the 2.6 series do not restrict their +parser and are therefore vulnerable to DoS attacks.

+

Note also that these "hard limits" may still be high enough to +allow for excessive resource usage in a given use case. They are +compile time modifiable, so building your own library versions will +allow you to change the limits to your own needs. Also see the next +question.

+
+
+

How do I use lxml safely as a web-service endpoint?

+

XML based web-service endpoints are generally subject to several +types of attacks if they allow some kind of untrusted input. +From the point of view of the underlying XML tool, the most +obvious attacks try to send a relatively small amount of data +that induces a comparatively large resource consumption on the +receiver side.

+

First of all, make sure network access is not enabled for the XML +parser that you use for parsing untrusted content and that it is +not configured to load external DTDs. Otherwise, attackers can +try to trick the parser into an attempt to load external resources +that are overly slow or impossible to retrieve, thus wasting time +and other valuable resources on your server such as socket +connections. Note that you can register your own document loader +in lxml, which allows for fine-grained control over any read access +to resources.

+

Some of the most famous excessive content expansion attacks +use XML entity references. Luckily, entity expansion is mostly +useless for the data commonly sent through web services and +can simply be disabled, which rules out several types of +denial of service attacks at once. This also involves an attack +that reads local files from the server, as XML entities can be +defined to expand into their content. Consequently, version +1.2 of the SOAP standard explicitly disallows entity references +in the XML stream.

+

To disable entity expansion, use an XML parser that is configured +with the option resolve_entities=False. Then, after (or +while) parsing the document, use root.iter(etree.Entity) to +recursively search for entity references. If it contains any, +reject the entire input document with a suitable error response. +In lxml 3.x, you can also use the new DTD introspection API to +apply your own restrictions on input documents.

+

Another attack to consider is compression bombs. If you allow +compressed input into your web service, attackers can try to send +well forged highly repetitive and thus very well compressing input +that unpacks into a very large XML document in your server's main +memory, potentially a thousand times larger than the compressed +input data.

+

As a counter measure, either disable compressed input for your +web server, at least for untrusted sources, or use incremental +parsing with iterparse() instead of parsing the whole input +document into memory in one shot. That allows you to enforce +suitable limits on the input by applying semantic checks that +detect and prevent an illegitimate use of your service. If +possible, you can also use this to reduce the amount of data +that you need to keep in memory while parsing the document, +thus further reducing the possibility of an attacker to trick +your system into excessive resource usage.

+

Finally, please be aware that XPath suffers from the same +vulnerability as SQL when it comes to content injection. The +obvious fix is to not build any XPath expressions via string +formatting or concatenation when the parameters may come from +untrusted sources, and instead use XPath variables, which +safely expose their values to the evaluation engine.

+

The defusedxml package comes with an example setup and a wrapper +API for lxml that applies certain counter measures internally.

+
+
+

How can I sort the attributes?

+

lxml preserves the order in which attributes were originally created. +There is one case in which this is difficult: when attributes are passed +in a dict or as keyword arguments to the Element() factory. Before Python +3.6, dicts had no predictable order. +Since Python 3.6, however, dicts also preserve the creation order of their keys, +and lxml makes use of that since release 4.4. +In earlier versions, lxml tries to assure at least reproducible output by +sorting the attributes from the dict before creating them. All sequential +ways to set attributes keep their order and do not apply sorting. Also, +OrderedDict instances are recognised and not sorted.

+

In cases where you cannot control the order in which attributes are created, +you can still change it before serialisation. To sort them by name, for example, +you can apply the following function:

+
def sort_attributes(root):
+    for el in root.iter():
+        attrib = el.attrib
+        if len(attrib) > 1:
+            attributes = sorted(attrib.items())
+            attrib.clear()
+            attrib.update(attributes)
+
+
+
+
+

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 00000000..b68ce6e9 --- /dev/null +++ b/doc/html/api.html @@ -0,0 +1,540 @@ + + + + + +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 builtin reversed() function.

+

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 one (or more, since lxml 3.0) additional +arguments that filter the generated elements by tag name:

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

Note that the order of the elements is determined by the iteration order, +which is the document order in most cases (except for preceding siblings +and ancestors, where it is the reversed document order). The order of +the tag selection arguments is irrelevant, as you can see in the last +example.

+

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.

+
>>> 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 occurred 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[0])
+<string>:4:8:FATAL:PARSER:ERR_TAG_NAME_MISMATCH: Opening and ending tag mismatch: a line 3 and root
+
+

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 error_log.last_error that returns the +last error or fatal error that occurred, so that it's easy to test if there was +an error at all. Note, however, that there might have been more than one error, +and the first error that occurred might be more relevant in some cases.

+
+
+

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

+
+

C14N

+

lxml.etree has support for C14N 1.0 +and C14N 2.0. When serialising an XML +tree using ElementTree.write() or tostring(), you can pass the option +method="c14n" for 1.0 or method="c14n2" for 2.0.

+

Additionally, there is a function etree.canonicalize() which can be used +to convert serialised XML to its canonical form directly, without creating +a tree in memory. By default, it returns the canonical output, but can be +directed to write it to a file instead.

+
>>> c14n_xml = etree.canonicalize("<root><test z='1' y='2'/></root>")
+>>> print(c14n_xml)
+<root><test y="2" z="1"></test></root>
+
+
+
+

Pretty printing

+

Functions like ElementTree.write() and tostring() also support pretty +printing XML 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.

+
+
+

XML declaration

+

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: ...
+
+

Since version 2.3, the serialisation can override the internal subset +of the document with a user provided DOCTYPE:

+
>>> xml = '<!DOCTYPE root>\n<root/>'
+>>> tree = etree.parse(StringIO(xml))
+
+>>> print(etree.tostring(tree))
+<!DOCTYPE root>
+<root/>
+
+>>> print(etree.tostring(tree,
+...     doctype='<!DOCTYPE root SYSTEM "/tmp/test.dtd">'))
+<!DOCTYPE root SYSTEM "/tmp/test.dtd">
+<root/>
+
+

The content will be encoded, but otherwise copied verbatim into the +output stream. It is therefore left to the user to take care for a +correct doctype format, including the name of the root node.

+
+
+
+

Incremental XML generation

+

Since version 3.1, lxml provides an xmlfile API for incrementally +generating XML using the with statement. It's main purpose is to +freely and safely mix surrounding elements with pre-built in-memory +trees, e.g. to write out large documents that consist mostly of +repetitive subtrees (like database dumps). But it can be useful in +many cases where memory consumption matters or where XML is naturally +generated in sequential steps. Since lxml 3.4.1, there is an equivalent +context manager for HTML serialisation called htmlfile.

+

The API can serialise to real files (given as file path or file +object), as well as file-like objects, e.g. io.BytesIO(). +Here is a simple example:

+
+>>> f = BytesIO()
+>>> with etree.xmlfile(f) as xf:
+...     with xf.element('abc'):
+...         xf.write('text')
+
+>>> print(f.getvalue().decode('utf-8'))
+<abc>text</abc>
+
+

xmlfile() accepts a file path as first argument, or a file(-like) +object, as in the example above. In the first case, it takes care to +open and close the file itself, whereas file(-like) objects are not +closed by default. This is left to the code that opened them. Since +lxml 3.4, however, you can pass the argument close=True to make +lxml call the object's .close() method when exiting the xmlfile +context manager.

+

To insert pre-constructed Elements and subtrees, just pass them +into write():

+
+>>> f = BytesIO()
+>>> with etree.xmlfile(f) as xf:
+...     with xf.element('abc'):
+...         with xf.element('in'):
+...
+...             for value in '123':
+...                 # construct a really complex XML tree
+...                 el = etree.Element('xyz', attr=value)
+...
+...                 xf.write(el)
+...
+...                 # no longer needed, discard it right away!
+...                 el = None
+
+>>> print(f.getvalue().decode('utf-8'))
+<abc><in><xyz attr="1"/><xyz attr="2"/><xyz attr="3"/></in></abc>
+
+

It is a common pattern to have one or more nested element() +blocks, and then build in-memory XML subtrees in a loop (using the +ElementTree API, the builder API, XSLT, or whatever) and write them +out into the XML file one after the other. That way, they can be +removed from memory right after their construction, which can largely +reduce the memory footprint of an application, while keeping the +overall XML generation easy, safe and correct.

+

Together with Python coroutines, this can be used to generate XML +in an asynchronous, non-blocking fashion, e.g. for a stream protocol +like the instant messaging protocol +XMPP:

+
+def writer(out_stream):
+    with xmlfile(out_stream) as xf:
+        with xf.element('{http://etherx.jabber.org/streams}stream'):
+            while True:
+                el = (yield)
+                xf.write(el)
+                xf.flush()
+
+w = writer(stream)
+next(w)   # start writing (run up to 'yield')
+
+

Then, whenever XML elements are available for writing, call

+
+w.send(element)
+
+

And when done:

+
+w.close()
+
+

Note the additional xf.flush() call in the example above, which is +available since lxml 3.4. Normally, the output stream is buffered to +avoid excessive I/O calls. Whenever the internal buffer fills up, its +content is written out. In the case above, however, we want to make +sure that each message that we write (i.e. each element subtree) is +written out immediately, so we flush the content explicitly at the +right point.

+

Alternatively, if buffering is not desired at all, it can be disabled +by passing the flag buffered=False into xmlfile() (also since +lxml 3.4).

+

Here is a similar example using an async coroutine in Py3.5 or later, which is +supported since lxml 4.0. The output stream is expected to have methods +async def write(self, data) and async def close(self) in this case.

+
+async def writer(out_stream, xml_messages):
+    async with xmlfile(out_stream) as xf:
+        async with xf.element('{http://etherx.jabber.org/streams}stream'):
+             async for el in xml_messages:
+                  await xf.write(el)
+                  await xf.flush()
+
+
+class DummyAsyncOut(object):
+    async def write(self, data):
+        print(data.decode('utf8'))
+
+    async def close(self):
+         pass
+
+stream = DummyAsyncOut()
+async_writer = writer(stream, async_message_stream)
+
+
+
+

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.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/api/abc.ABCMeta-class.html b/doc/html/api/abc.ABCMeta-class.html new file mode 100644 index 00000000..7b77c23f --- /dev/null +++ b/doc/html/api/abc.ABCMeta-class.html @@ -0,0 +1,449 @@ + + + + + abc.ABCMeta + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + abc :: + ABCMeta :: + Class ABCMeta + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Type ABCMeta

+
+object --+    
+         |    
+      type --+
+             |
+            ABCMeta
+
+ +
+

Metaclass for defining Abstract Base Classes (ABCs).

+

Use this metaclass to create an ABC. An ABC can be subclassed +directly, and then acts as a mix-in class. You can also register +unrelated concrete classes (even built-in classes) and unrelated +ABCs as 'virtual subclasses' -- these and their descendants will +be considered subclasses of the registering ABC by the built-in +issubclass() function, but the registering ABC won't show up in +their MRO (Method Resolution Order) nor will method +implementations defined by the registering ABC be callable (not +even via super()).

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ bool + + + + + + +
__instancecheck__(cls, + instance)
+ Override for isinstance(instance, cls).
+ + +
+ +
+ bool + + + + + + +
__subclasscheck__(cls, + subclass)
+ Override for issubclass(subclass, cls).
+ + +
+ +
+   + + + + + + +
_dump_registry(cls, + file=None)
+ Debug helper to print the ABC registry.
+ + +
+ +
+   + + + + + + +
register(cls, + subclass)
+ Register a virtual subclass of an ABC.
+ + +
+ +
+

Inherited from type: + __call__, + __delattr__, + __eq__, + __ge__, + __getattribute__, + __gt__, + __hash__, + __init__, + __le__, + __lt__, + __ne__, + __repr__, + __setattr__, + __subclasses__, + mro +

+

Inherited from object: + __format__, + __reduce__, + __reduce_ex__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(mcls, + name, + bases, + namespace) + + +
+ +
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _abc_invalidation_counter = 21 +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from type: + __abstractmethods__, + __base__, + __bases__, + __basicsize__, + __dictoffset__, + __flags__, + __itemsize__, + __mro__, + __name__, + __weakrefoffset__ +

+

Inherited from object: + __class__ +

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

__instancecheck__(cls, + instance) +

+
  +
+ + Override for isinstance(instance, cls). +
+
Returns: bool
+
Overrides: + type.__instancecheck__ +
+
+
+
+ +
+ +
+ + +
+

__new__(mcls, + name, + bases, + namespace) +
Static Method +

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

__subclasscheck__(cls, + subclass) +

+
  +
+ + Override for issubclass(subclass, cls). +
+
Returns: bool
+
Overrides: + type.__subclasscheck__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/api-objects.txt b/doc/html/api/api-objects.txt new file mode 100644 index 00000000..2299b129 --- /dev/null +++ b/doc/html/api/api-objects.txt @@ -0,0 +1,7938 @@ +lxml.ElementInclude lxml.ElementInclude-module.html +lxml.ElementInclude.DEFAULT_MAX_INCLUSION_DEPTH lxml.ElementInclude-module.html#DEFAULT_MAX_INCLUSION_DEPTH +lxml.ElementInclude.XINCLUDE_FALLBACK lxml.ElementInclude-module.html#XINCLUDE_FALLBACK +lxml.ElementInclude.XINCLUDE_INCLUDE lxml.ElementInclude-module.html#XINCLUDE_INCLUDE +lxml.ElementInclude._include lxml.ElementInclude-module.html#_include +lxml.ElementInclude.__package__ lxml.ElementInclude-module.html#__package__ +lxml.ElementInclude._lxml_default_loader lxml.ElementInclude-module.html#_lxml_default_loader +lxml.ElementInclude.include lxml.ElementInclude-module.html#include +lxml.ElementInclude.XINCLUDE lxml.ElementInclude-module.html#XINCLUDE +lxml.ElementInclude.XINCLUDE_ITER_TAG lxml.ElementInclude-module.html#XINCLUDE_ITER_TAG +lxml.ElementInclude._wrap_et_loader lxml.ElementInclude-module.html#_wrap_et_loader +lxml.ElementInclude.default_loader lxml.ElementInclude-module.html#default_loader +lxml lxml-module.html +lxml.get_include lxml-module.html#get_include +lxml.__package__ lxml-module.html#__package__ +lxml.builder lxml.builder-module.html +lxml.builder.E lxml.builder-module.html#E +lxml.builder.__reduce_cython__ lxml.builder-module.html#__reduce_cython__ +lxml.builder.__pyx_unpickle_ElementMaker lxml.builder-module.html#__pyx_unpickle_ElementMaker +lxml.builder.__package__ lxml.builder-module.html#__package__ +lxml.builder.__pyx_capi__ lxml.builder-module.html#__pyx_capi__ +lxml.builder.__test__ lxml.builder-module.html#__test__ +lxml.builder.__setstate_cython__ lxml.builder-module.html#__setstate_cython__ +lxml.cssselect lxml.cssselect-module.html +lxml.cssselect.ns lxml.cssselect-module.html#ns +lxml.cssselect._make_lower_case lxml.cssselect-module.html#_make_lower_case +lxml.cssselect.__package__ lxml.cssselect-module.html#__package__ +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.__package__ lxml.doctestcompare-module.html#__package__ +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.adopt_external_document lxml.etree-module.html#adopt_external_document +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.__package__ lxml.etree-module.html#__package__ +lxml.etree.dump lxml.etree-module.html#dump +lxml.etree.strip_elements lxml.etree-module.html#strip_elements +lxml.etree.HTML lxml.etree-module.html#HTML +lxml.etree.memory_debugger lxml.etree-module.html#memory_debugger +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.canonicalize lxml.etree-module.html#canonicalize +lxml.etree.__pyx_capi__ lxml.etree-module.html#__pyx_capi__ +lxml.etree.XML lxml.etree-module.html#XML +lxml.etree.__test__ lxml.etree-module.html#__test__ +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.register_namespace lxml.etree-module.html#register_namespace +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.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.ElementSoup.__package__ lxml.html.ElementSoup-module.html#__package__ +lxml.html lxml.html-module.html +lxml.html._rel_links_xpath lxml.html-module.html#_rel_links_xpath +lxml.html._looks_like_full_html_unicode lxml.html-module.html#_looks_like_full_html_unicode +lxml.html._unquote_match lxml.html-module.html#_unquote_match +lxml.html.parse lxml.html-module.html#parse +lxml.html._nons lxml.html-module.html#_nons +lxml.html._iter_css_imports lxml.html-module.html#_iter_css_imports +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.__package__ lxml.html-module.html#__package__ +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.fragments_fromstring lxml.html-module.html#fragments_fromstring +lxml.html._looks_like_full_html_bytes lxml.html-module.html#_looks_like_full_html_bytes +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.tostring lxml.html-module.html#tostring +lxml.html.find_class lxml.html-module.html#find_class +lxml.html.html_parser lxml.html-module.html#html_parser +lxml.html.open_in_browser lxml.html-module.html#open_in_browser +lxml.html._parse_meta_refresh_url lxml.html-module.html#_parse_meta_refresh_url +lxml.html.fromstring lxml.html-module.html#fromstring +lxml.html._label_xpath lxml.html-module.html#_label_xpath +lxml.html._iter_css_urls lxml.html-module.html#_iter_css_urls +lxml.html._transform_result lxml.html-module.html#_transform_result +lxml.html.find_rel_links lxml.html-module.html#find_rel_links +lxml.html.open_http_urllib lxml.html-module.html#open_http_urllib +lxml.html.xhtml_to_html lxml.html-module.html#xhtml_to_html +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.__package__ lxml.html.builder-module.html#__package__ +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._find_styled_elements lxml.html.clean-module.html#_find_styled_elements +lxml.html.clean.unichr lxml.html.clean-module.html#unichr +lxml.html.clean._break_text lxml.html.clean-module.html#_break_text +lxml.html.clean.basestring lxml.html.clean-module.html#basestring +lxml.html.clean._avoid_classes lxml.html.clean-module.html#_avoid_classes +lxml.html.clean.__package__ lxml.html.clean-module.html#__package__ +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._is_javascript_scheme lxml.html.clean-module.html#_is_javascript_scheme +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._is_possibly_malicious_scheme lxml.html.clean-module.html#_is_possibly_malicious_scheme +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.__test__ lxml.html.clean-module.html#__test__ +lxml.html.clean.clean_html lxml.html.clean-module.html#clean_html +lxml.html.clean._is_image_dataurl lxml.html.clean-module.html#_is_image_dataurl +lxml.html.clean._avoid_word_break_classes lxml.html.clean-module.html#_avoid_word_break_classes +lxml.html.clean._css_javascript_re lxml.html.clean-module.html#_css_javascript_re +lxml.html.clean.word_break lxml.html.clean-module.html#word_break +lxml.html.clean._insert_break lxml.html.clean-module.html#_insert_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.__package__ lxml.html.defs-module.html#__package__ +lxml.html.defs.top_level_tags lxml.html.defs-module.html#top_level_tags +lxml.html.defs.html5_tags lxml.html.defs-module.html#html5_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.frame_tags lxml.html.defs-module.html#frame_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.tokenize_annotated lxml.html.diff-module.html#tokenize_annotated +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.__package__ lxml.html.diff-module.html#__package__ +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.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.__test__ lxml.html.diff-module.html#__test__ +lxml.html.diff.cleanup_html lxml.html.diff-module.html#cleanup_html +lxml.html.diff.split_words_re lxml.html.diff-module.html#split_words_re +lxml.html.diff.parse_html lxml.html.diff-module.html#parse_html +lxml.html.diff.merge_delete lxml.html.diff-module.html#merge_delete +lxml.html.diff.split_trailing_whitespace lxml.html.diff-module.html#split_trailing_whitespace +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.is_end_tag lxml.html.diff-module.html#is_end_tag +lxml.html.diff.copy_annotations lxml.html.diff-module.html#copy_annotations +lxml.html.diff.merge_insert lxml.html.diff-module.html#merge_insert +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._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.__package__ lxml.html.formfill-module.html#__package__ +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.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.fill_form lxml.html.formfill-module.html#fill_form +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._tag lxml.html.formfill-module.html#_tag +lxml.html.formfill._find_form lxml.html.formfill-module.html#_find_form +lxml.html.html5parser lxml.html.html5parser-module.html +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.__package__ lxml.html.html5parser-module.html#__package__ +lxml.html.html5parser.xhtml_parser lxml.html.html5parser-module.html#xhtml_parser +lxml.html.html5parser.fragment_fromstring lxml.html.html5parser-module.html#fragment_fromstring +lxml.html.html5parser.fragments_fromstring lxml.html.html5parser-module.html#fragments_fromstring +lxml.html.html5parser.document_fromstring lxml.html.html5parser-module.html#document_fromstring +lxml.html.html5parser.fromstring lxml.html.html5parser-module.html#fromstring +lxml.html.html5parser._find_tag lxml.html.html5parser-module.html#_find_tag +lxml.html.html5parser._looks_like_url lxml.html.html5parser-module.html#_looks_like_url +lxml.html.soupparser lxml.html.soupparser-module.html +lxml.html.soupparser.parse lxml.html.soupparser-module.html#parse +lxml.html.soupparser.unichr lxml.html.soupparser-module.html#unichr +lxml.html.soupparser.handle_entities lxml.html.soupparser-module.html#handle_entities +lxml.html.soupparser.__package__ lxml.html.soupparser-module.html#__package__ +lxml.html.soupparser._parse_doctype_declaration lxml.html.soupparser-module.html#_parse_doctype_declaration +lxml.html.soupparser.convert_tree lxml.html.soupparser-module.html#convert_tree +lxml.html.soupparser._convert_tree lxml.html.soupparser-module.html#_convert_tree +lxml.html.soupparser._DECLARATION_OR_DOCTYPE lxml.html.soupparser-module.html#_DECLARATION_OR_DOCTYPE +lxml.html.soupparser.unescape lxml.html.soupparser-module.html#unescape +lxml.html.soupparser.fromstring lxml.html.soupparser-module.html#fromstring +lxml.html.soupparser._init_node_converters lxml.html.soupparser-module.html#_init_node_converters +lxml.html.soupparser._parse lxml.html.soupparser-module.html#_parse +lxml.html.usedoctest lxml.html.usedoctest-module.html +lxml.includes lxml.includes-module.html +lxml.includes.__package__ lxml.includes-module.html#__package__ +lxml.isoschematron lxml.isoschematron-module.html +lxml.isoschematron.SVRL_NS lxml.isoschematron-module.html#SVRL_NS +lxml.isoschematron.iso_svrl_for_xslt1 lxml.isoschematron-module.html#iso_svrl_for_xslt1 +lxml.isoschematron._xml_schema_root lxml.isoschematron-module.html#_xml_schema_root +lxml.isoschematron._stylesheet_param_dict lxml.isoschematron-module.html#_stylesheet_param_dict +lxml.isoschematron.svrl_validation_errors lxml.isoschematron-module.html#svrl_validation_errors +lxml.isoschematron.iso_dsdl_include lxml.isoschematron-module.html#iso_dsdl_include +lxml.isoschematron.extract_rng lxml.isoschematron-module.html#extract_rng +lxml.isoschematron._resources_dir lxml.isoschematron-module.html#_resources_dir +lxml.isoschematron.__package__ lxml.isoschematron-module.html#__package__ +lxml.isoschematron.SCHEMATRON_NS lxml.isoschematron-module.html#SCHEMATRON_NS +lxml.isoschematron._schematron_root lxml.isoschematron-module.html#_schematron_root +lxml.isoschematron.extract_xsd lxml.isoschematron-module.html#extract_xsd +lxml.isoschematron.RELAXNG_NS lxml.isoschematron-module.html#RELAXNG_NS +lxml.isoschematron.XML_SCHEMA_NS lxml.isoschematron-module.html#XML_SCHEMA_NS +lxml.isoschematron.schematron_schema_valid lxml.isoschematron-module.html#schematron_schema_valid +lxml.isoschematron.stylesheet_params lxml.isoschematron-module.html#stylesheet_params +lxml.isoschematron.iso_abstract_expand lxml.isoschematron-module.html#iso_abstract_expand +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.__package__ lxml.objectify-module.html#__package__ +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.__test__ lxml.objectify-module.html#__test__ +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.objectify.SubElement lxml.objectify-module.html#SubElement +lxml.pyclasslookup lxml.pyclasslookup-module.html +lxml.pyclasslookup.__package__ lxml.pyclasslookup-module.html#__package__ +lxml.sax lxml.sax-module.html +lxml.sax.Comment lxml.etree-module.html#Comment +lxml.sax.ProcessingInstruction lxml.etree-module.html#PI +lxml.sax.__reduce_cython__ lxml.sax-module.html#__reduce_cython__ +lxml.sax.__pyx_unpickle_ElementTreeProducer lxml.sax-module.html#__pyx_unpickle_ElementTreeProducer +lxml.sax.__pyx_capi__ lxml.sax-module.html#__pyx_capi__ +lxml.sax.SubElement lxml.etree-module.html#SubElement +lxml.sax.__package__ lxml.sax-module.html#__package__ +lxml.sax.__setstate_cython__ lxml.sax-module.html#__setstate_cython__ +lxml.sax._getNsTag lxml.sax-module.html#_getNsTag +lxml.sax.saxify lxml.sax-module.html#saxify +lxml.sax.__test__ lxml.sax-module.html#__test__ +lxml.sax.ElementTree lxml.etree-module.html#ElementTree +lxml.tests lxml.tests-module.html +lxml.tests.__package__ lxml.tests-module.html#__package__ +lxml.tests.common_imports lxml.tests.common_imports-module.html +lxml.tests.common_imports.tmpfile lxml.tests.common_imports-module.html#tmpfile +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.IS_PYTHON3 lxml.tests.common_imports-module.html#IS_PYTHON3 +lxml.tests.common_imports.IS_PYTHON2 lxml.tests.common_imports-module.html#IS_PYTHON2 +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.write_to_file lxml.tests.common_imports-module.html#write_to_file +lxml.tests.common_imports.unichr_escape lxml.tests.common_imports-module.html#unichr_escape +lxml.tests.common_imports.__package__ lxml.tests.common_imports-module.html#__package__ +lxml.tests.common_imports.filter_by_version lxml.tests.common_imports-module.html#filter_by_version +lxml.tests.common_imports._get_caller_relative_path lxml.tests.common_imports-module.html#_get_caller_relative_path +lxml.tests.common_imports.doctest_parser lxml.tests.common_imports-module.html#doctest_parser +lxml.tests.common_imports.fileUrlInTestDir lxml.tests.common_imports-module.html#fileUrlInTestDir +lxml.tests.common_imports._fix_bytes lxml.tests.common_imports-module.html#_fix_bytes +lxml.tests.common_imports.path2url lxml.tests.common_imports-module.html#path2url +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.ET_VERSION lxml.tests.common_imports-module.html#ET_VERSION +lxml.tests.common_imports.read_file lxml.tests.common_imports-module.html#read_file +lxml.tests.common_imports.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.common_imports.IS_PYPY lxml.tests.common_imports-module.html#IS_PYPY +lxml.tests.common_imports.CET_VERSION lxml.tests.common_imports-module.html#CET_VERSION +lxml.tests.common_imports._fix_traceback lxml.tests.common_imports-module.html#_fix_traceback +lxml.tests.common_imports.readFileInTestDir lxml.tests.common_imports-module.html#readFileInTestDir +lxml.tests.dummy_http_server lxml.tests.dummy_http_server-module.html +lxml.tests.dummy_http_server.build_web_server lxml.tests.dummy_http_server-module.html#build_web_server +lxml.tests.dummy_http_server.webserver lxml.tests.dummy_http_server-module.html#webserver +lxml.tests.dummy_http_server.__package__ lxml.tests.dummy_http_server-module.html#__package__ +lxml.tests.selftest lxml.tests.selftest-module.html +lxml.tests.selftest.bad_find lxml.tests.selftest-module.html#bad_find +lxml.tests.selftest.encoding lxml.tests.selftest-module.html#encoding +lxml.tests.selftest.serialize lxml.tests.selftest-module.html#serialize +lxml.tests.selftest.parseliteral lxml.tests.selftest-module.html#parseliteral +lxml.tests.selftest.check_element lxml.tests.selftest-module.html#check_element +lxml.tests.selftest.ENTITY_XML lxml.tests.selftest-module.html#ENTITY_XML +lxml.tests.selftest.XINCLUDE lxml.tests.selftest-module.html#XINCLUDE +lxml.tests.selftest.find lxml.tests.selftest-module.html#find +lxml.tests.selftest.bug_xmltoolkit28 lxml.tests.selftest-module.html#bug_xmltoolkit28 +lxml.tests.selftest.check_element_tree lxml.tests.selftest-module.html#check_element_tree +lxml.tests.selftest.fix_compatibility lxml.tests.selftest-module.html#fix_compatibility +lxml.tests.selftest.SAMPLE_XML lxml.tests.selftest-module.html#SAMPLE_XML +lxml.tests.selftest.check_string_or_none lxml.tests.selftest-module.html#check_string_or_none +lxml.tests.selftest.stdout lxml.tests.selftest-module.html#stdout +lxml.tests.selftest.namespace lxml.tests.selftest-module.html#namespace +lxml.tests.selftest.bug_xmltoolkit25 lxml.tests.selftest-module.html#bug_xmltoolkit25 +lxml.tests.selftest.__package__ lxml.tests.selftest-module.html#__package__ +lxml.tests.selftest.parsefile lxml.tests.selftest-module.html#parsefile +lxml.tests.selftest.normalize_crlf lxml.tests.selftest-module.html#normalize_crlf +lxml.tests.selftest.summarize_list lxml.tests.selftest-module.html#summarize_list +lxml.tests.selftest.simpleops lxml.tests.selftest-module.html#simpleops +lxml.tests.selftest.xinclude_loader lxml.tests.selftest-module.html#xinclude_loader +lxml.tests.selftest.iterators lxml.tests.selftest-module.html#iterators +lxml.tests.selftest.summarize lxml.tests.selftest-module.html#summarize +lxml.tests.selftest.writefile lxml.tests.selftest-module.html#writefile +lxml.tests.selftest.xinclude_default lxml.tests.selftest-module.html#xinclude_default +lxml.tests.selftest.interface lxml.tests.selftest-module.html#interface +lxml.tests.selftest.check_mapping lxml.tests.selftest-module.html#check_mapping +lxml.tests.selftest.xinclude lxml.tests.selftest-module.html#xinclude +lxml.tests.selftest.writestring lxml.tests.selftest-module.html#writestring +lxml.tests.selftest.check_string lxml.tests.selftest-module.html#check_string +lxml.tests.selftest.qname lxml.tests.selftest-module.html#qname +lxml.tests.selftest.iterparse lxml.tests.selftest-module.html#iterparse +lxml.tests.selftest.xpath_tokenizer lxml.tests.selftest-module.html#xpath_tokenizer +lxml.tests.selftest2 lxml.tests.selftest2-module.html +lxml.tests.selftest2.stdout lxml.tests.selftest2-module.html#stdout +lxml.tests.selftest2.serialize lxml.tests.selftest2-module.html#serialize +lxml.tests.selftest2.check_element lxml.tests.selftest2-module.html#check_element +lxml.tests.selftest2.ENTITY_XML lxml.tests.selftest2-module.html#ENTITY_XML +lxml.tests.selftest2.find lxml.tests.selftest2-module.html#find +lxml.tests.selftest2.summarize lxml.tests.selftest2-module.html#summarize +lxml.tests.selftest2.check_element_tree lxml.tests.selftest2-module.html#check_element_tree +lxml.tests.selftest2.SAMPLE_XML lxml.tests.selftest2-module.html#SAMPLE_XML +lxml.tests.selftest2.encoding lxml.tests.selftest2-module.html#encoding +lxml.tests.selftest2.unserialize lxml.tests.selftest2-module.html#unserialize +lxml.tests.selftest2.__package__ lxml.tests.selftest2-module.html#__package__ +lxml.tests.selftest2.parsefile lxml.tests.selftest2-module.html#parsefile +lxml.tests.selftest2.SAMPLE_XML_NS lxml.tests.selftest2-module.html#SAMPLE_XML_NS +lxml.tests.selftest2.summarize_list lxml.tests.selftest2-module.html#summarize_list +lxml.tests.selftest2.makeelement lxml.tests.selftest2-module.html#makeelement +lxml.tests.selftest2.writefile lxml.tests.selftest2-module.html#writefile +lxml.tests.selftest2.cdata lxml.tests.selftest2-module.html#cdata +lxml.tests.selftest2.check_mapping lxml.tests.selftest2-module.html#check_mapping +lxml.tests.selftest2.copy lxml.tests.selftest2-module.html#copy +lxml.tests.selftest2.check_string lxml.tests.selftest2-module.html#check_string +lxml.tests.selftest2.qname lxml.tests.selftest2-module.html#qname +lxml.tests.selftest2.element lxml.tests.selftest2-module.html#element +lxml.tests.selftest2.attrib lxml.tests.selftest2-module.html#attrib +lxml.tests.test_builder lxml.tests.test_builder-module.html +lxml.tests.test_builder.__package__ lxml.tests.test_builder-module.html#__package__ +lxml.tests.test_builder._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_builder.test_suite lxml.tests.test_builder-module.html#test_suite +lxml.tests.test_builder.this_dir lxml.tests.test_builder-module.html#this_dir +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.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_classlookup._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_classlookup.__package__ lxml.tests.test_classlookup-module.html#__package__ +lxml.tests.test_classlookup.this_dir lxml.tests.test_classlookup-module.html#this_dir +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.__package__ lxml.tests.test_css-module.html#__package__ +lxml.tests.test_css.HTML lxml.tests.test_css-module.html#HTML +lxml.tests.test_css.test_suite lxml.tests.test_css-module.html#test_suite +lxml.tests.test_doctestcompare lxml.tests.test_doctestcompare-module.html +lxml.tests.test_doctestcompare.__package__ lxml.tests.test_doctestcompare-module.html#__package__ +lxml.tests.test_doctestcompare.test_suite lxml.tests.test_doctestcompare-module.html#test_suite +lxml.tests.test_doctestcompare.indent lxml.tests.test_doctestcompare-module.html#indent +lxml.tests.test_dtd lxml.tests.test_dtd-module.html +lxml.tests.test_dtd.fileUrlInTestDir lxml.tests.common_imports-module.html#fileUrlInTestDir +lxml.tests.test_dtd.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_dtd._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_dtd.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_dtd.__package__ lxml.tests.test_dtd-module.html#__package__ +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_elementpath lxml.tests.test_elementpath-module.html +lxml.tests.test_elementpath.__package__ lxml.tests.test_elementpath-module.html#__package__ +lxml.tests.test_elementpath.test_suite lxml.tests.test_elementpath-module.html#test_suite +lxml.tests.test_elementpath.summarize lxml.tests.test_elementpath-module.html#summarize +lxml.tests.test_elementpath.normalize_crlf lxml.tests.test_elementpath-module.html#normalize_crlf +lxml.tests.test_elementpath.summarize_list lxml.tests.test_elementpath-module.html#summarize_list +lxml.tests.test_elementtree lxml.tests.test_elementtree-module.html +lxml.tests.test_elementtree.tmpfile lxml.tests.common_imports-module.html#tmpfile +lxml.tests.test_elementtree.ElementTreePullTestCase lxml.tests.test_elementtree-module.html#ElementTreePullTestCase +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.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_elementtree.next lxml.tests.common_imports-module.html#next +lxml.tests.test_elementtree.et_needs_pyversion lxml.tests.test_elementtree-module.html#et_needs_pyversion +lxml.tests.test_elementtree.filter_by_version lxml.tests.common_imports-module.html#filter_by_version +lxml.tests.test_elementtree.__package__ lxml.tests.test_elementtree-module.html#__package__ +lxml.tests.test_elementtree.ElementTreeC14NTest lxml.tests.test_elementtree-module.html#ElementTreeC14NTest +lxml.tests.test_elementtree.this_dir lxml.tests.test_elementtree-module.html#this_dir +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.test_suite lxml.tests.test_elementtree-module.html#test_suite +lxml.tests.test_errors lxml.tests.test_errors-module.html +lxml.tests.test_errors.__package__ lxml.tests.test_errors-module.html#__package__ +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.tmpfile lxml.tests.common_imports-module.html#tmpfile +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.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +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.__package__ lxml.tests.test_etree-module.html#__package__ +lxml.tests.test_etree.fileUrlInTestDir lxml.tests.common_imports-module.html#fileUrlInTestDir +lxml.tests.test_etree.path2url lxml.tests.common_imports-module.html#path2url +lxml.tests.test_etree.read_file lxml.tests.common_imports-module.html#read_file +lxml.tests.test_etree.test_suite lxml.tests.test_etree-module.html#test_suite +lxml.tests.test_external_document lxml.tests.test_external_document-module.html +lxml.tests.test_external_document.__package__ lxml.tests.test_external_document-module.html#__package__ +lxml.tests.test_external_document.DOC_NAME lxml.tests.test_external_document-module.html#DOC_NAME +lxml.tests.test_external_document.test_suite lxml.tests.test_external_document-module.html#test_suite +lxml.tests.test_external_document.DESTRUCTOR_NAME lxml.tests.test_external_document-module.html#DESTRUCTOR_NAME +lxml.tests.test_htmlparser lxml.tests.test_htmlparser-module.html +lxml.tests.test_htmlparser.write_to_file lxml.tests.common_imports-module.html#write_to_file +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.__package__ lxml.tests.test_htmlparser-module.html#__package__ +lxml.tests.test_htmlparser.this_dir lxml.tests.test_htmlparser-module.html#this_dir +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.next lxml.tests.common_imports-module.html#next +lxml.tests.test_http_io lxml.tests.test_http_io-module.html +lxml.tests.test_http_io.webserver lxml.tests.dummy_http_server-module.html#webserver +lxml.tests.test_http_io._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_http_io.__package__ lxml.tests.test_http_io-module.html#__package__ +lxml.tests.test_http_io.this_dir lxml.tests.test_http_io-module.html#this_dir +lxml.tests.test_http_io.test_suite lxml.tests.test_http_io-module.html#test_suite +lxml.tests.test_incremental_xmlfile lxml.tests.test_incremental_xmlfile-module.html +lxml.tests.test_incremental_xmlfile._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_incremental_xmlfile.this_dir lxml.tests.test_incremental_xmlfile-module.html#this_dir +lxml.tests.test_incremental_xmlfile.__package__ lxml.tests.test_incremental_xmlfile-module.html#__package__ +lxml.tests.test_incremental_xmlfile.test_suite lxml.tests.test_incremental_xmlfile-module.html#test_suite +lxml.tests.test_io lxml.tests.test_io-module.html +lxml.tests.test_io.tmpfile lxml.tests.common_imports-module.html#tmpfile +lxml.tests.test_io._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_io._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_io.read_file lxml.tests.common_imports-module.html#read_file +lxml.tests.test_io.__package__ lxml.tests.test_io-module.html#__package__ +lxml.tests.test_io.write_to_file lxml.tests.common_imports-module.html#write_to_file +lxml.tests.test_io.test_suite lxml.tests.test_io-module.html#test_suite +lxml.tests.test_isoschematron lxml.tests.test_isoschematron-module.html +lxml.tests.test_isoschematron.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_isoschematron.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_isoschematron.__package__ lxml.tests.test_isoschematron-module.html#__package__ +lxml.tests.test_isoschematron.test_suite lxml.tests.test_isoschematron-module.html#test_suite +lxml.tests.test_isoschematron.this_dir lxml.tests.test_isoschematron-module.html#this_dir +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.__package__ lxml.tests.test_nsclasses-module.html#__package__ +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.pytype2objclass lxml.tests.test_objectify-module.html#pytype2objclass +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.__package__ lxml.tests.test_objectify-module.html#__package__ +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.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_pyclasslookup.__package__ lxml.tests.test_pyclasslookup-module.html#__package__ +lxml.tests.test_pyclasslookup.this_dir lxml.tests.test_pyclasslookup-module.html#this_dir +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.rnc2rng lxml.tests.test_relaxng-module.html#rnc2rng +lxml.tests.test_relaxng.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_relaxng.__package__ lxml.tests.test_relaxng-module.html#__package__ +lxml.tests.test_relaxng.this_dir lxml.tests.test_relaxng-module.html#this_dir +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_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.this_dir lxml.tests.test_sax-module.html#this_dir +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.__package__ lxml.tests.test_sax-module.html#__package__ +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.__package__ lxml.tests.test_schematron-module.html#__package__ +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.__package__ lxml.tests.test_threading-module.html#__package__ +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._chr lxml.tests.test_unicode-module.html#_chr +lxml.tests.test_unicode.uxml lxml.tests.test_unicode-module.html#uxml +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.__package__ lxml.tests.test_unicode-module.html#__package__ +lxml.tests.test_unicode.this_dir lxml.tests.test_unicode-module.html#this_dir +lxml.tests.test_unicode._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_unicode.klingon lxml.tests.test_unicode-module.html#klingon +lxml.tests.test_unicode.test_suite lxml.tests.test_unicode-module.html#test_suite +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.__package__ lxml.tests.test_xmlschema-module.html#__package__ +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.tag lxml.tests.test_xpathevaluator-module.html#tag +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.__package__ lxml.tests.test_xpathevaluator-module.html#__package__ +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.stringListTest lxml.tests.test_xpathevaluator-module.html#stringListTest +lxml.tests.test_xpathevaluator.xpath lxml.tests.test_xpathevaluator-module.html#xpath +lxml.tests.test_xpathevaluator.tag_or_value lxml.tests.test_xpathevaluator-module.html#tag_or_value +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_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._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_xslt.this_dir lxml.tests.test_xslt-module.html#this_dir +lxml.tests.test_xslt.__package__ lxml.tests.test_xslt-module.html#__package__ +lxml.tests.test_xslt.is_python3 lxml.tests.test_xslt-module.html#is_python3 +lxml.tests.test_xslt.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_xslt.test_suite lxml.tests.test_xslt-module.html#test_suite +lxml.usedoctest lxml.usedoctest-module.html +xml.etree.ElementTree xml.etree.ElementTree-module.html +xml.etree.ElementTree.XMLID xml.etree.ElementTree-module.html#XMLID +xml.etree.ElementTree.register_namespace xml.etree.ElementTree-module.html#register_namespace +xml.etree.ElementTree.dump xml.etree.ElementTree-module.html#dump +xml.etree.ElementTree._raise_serialization_error xml.etree.ElementTree-module.html#_raise_serialization_error +xml.etree.ElementTree.HTML_EMPTY xml.etree.ElementTree-module.html#HTML_EMPTY +xml.etree.ElementTree._serialize_text xml.etree.ElementTree-module.html#_serialize_text +xml.etree.ElementTree.parse xml.etree.ElementTree-module.html#parse +xml.etree.ElementTree._encode xml.etree.ElementTree-module.html#_encode +xml.etree.ElementTree._namespace_map xml.etree.ElementTree-module.html#_namespace_map +xml.etree.ElementTree._sentinel xml.etree.ElementTree-module.html#_sentinel +xml.etree.ElementTree.__package__ xml.etree.ElementTree-module.html#__package__ +xml.etree.ElementTree._serialize xml.etree.ElementTree-module.html#_serialize +xml.etree.ElementTree._serialize_xml xml.etree.ElementTree-module.html#_serialize_xml +xml.etree.ElementTree.PI xml.etree.ElementTree-module.html#PI +xml.etree.ElementTree._escape_attrib xml.etree.ElementTree-module.html#_escape_attrib +xml.etree.ElementTree.XML xml.etree.ElementTree-module.html#XML +xml.etree.ElementTree._namespaces xml.etree.ElementTree-module.html#_namespaces +xml.etree.ElementTree._escape_cdata xml.etree.ElementTree-module.html#_escape_cdata +xml.etree.ElementTree._serialize_html xml.etree.ElementTree-module.html#_serialize_html +xml.etree.ElementTree._escape_attrib_html xml.etree.ElementTree-module.html#_escape_attrib_html +xml.etree.ElementTree.VERSION xml.etree.ElementTree-module.html#VERSION +xml.etree.ElementTree.tostring xml.etree.ElementTree-module.html#tostring +xml.etree.ElementTree.fromstringlist xml.etree.ElementTree-module.html#fromstringlist +xml.etree.ElementTree.iselement xml.etree.ElementTree-module.html#iselement +xml.etree.ElementTree.Comment xml.etree.ElementTree-module.html#Comment +xml.etree.ElementTree.ProcessingInstruction xml.etree.ElementTree-module.html#ProcessingInstruction +xml.etree.ElementTree.tostringlist xml.etree.ElementTree-module.html#tostringlist +xml.etree.ElementTree.fromstring xml.etree.ElementTree-module.html#fromstring +xml.etree.ElementTree.iterparse xml.etree.ElementTree-module.html#iterparse +xml.etree.ElementTree.SubElement xml.etree.ElementTree-module.html#SubElement +abc.ABCMeta abc.ABCMeta-class.html +abc.ABCMeta.__new__ abc.ABCMeta-class.html#__new__ +abc.ABCMeta._abc_invalidation_counter abc.ABCMeta-class.html#_abc_invalidation_counter +abc.ABCMeta.__instancecheck__ abc.ABCMeta-class.html#__instancecheck__ +abc.ABCMeta.__subclasscheck__ abc.ABCMeta-class.html#__subclasscheck__ +abc.ABCMeta.register abc.ABCMeta-class.html#register +abc.ABCMeta._dump_registry abc.ABCMeta-class.html#_dump_registry +cssselect.parser.SelectorError cssselect.parser.SelectorError-class.html +cssselect.parser.SelectorSyntaxError cssselect.parser.SelectorSyntaxError-class.html +cssselect.xpath.ExpressionError cssselect.xpath.ExpressionError-class.html +cssselect.xpath.XPathExpr cssselect.xpath.XPathExpr-class.html +cssselect.xpath.XPathExpr.add_star_prefix cssselect.xpath.XPathExpr-class.html#add_star_prefix +cssselect.xpath.XPathExpr.join cssselect.xpath.XPathExpr-class.html#join +cssselect.xpath.XPathExpr.__str__ cssselect.xpath.XPathExpr-class.html#__str__ +cssselect.xpath.XPathExpr.add_name_test cssselect.xpath.XPathExpr-class.html#add_name_test +cssselect.xpath.XPathExpr.__repr__ cssselect.xpath.XPathExpr-class.html#__repr__ +cssselect.xpath.XPathExpr.add_condition cssselect.xpath.XPathExpr-class.html#add_condition +cssselect.xpath.XPathExpr.__init__ cssselect.xpath.XPathExpr-class.html#__init__ +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.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.LxmlSyntaxError.__qualname__ lxml.etree.LxmlSyntaxError-class.html#__qualname__ +lxml.ElementInclude.LimitedRecursiveIncludeError lxml.ElementInclude.LimitedRecursiveIncludeError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.LxmlSyntaxError.__qualname__ lxml.etree.LxmlSyntaxError-class.html#__qualname__ +lxml.builder.ElementMaker lxml.builder.ElementMaker-class.html +lxml.builder.ElementMaker._namespace lxml.builder.ElementMaker-class.html#_namespace +lxml.builder.ElementMaker._typemap lxml.builder.ElementMaker-class.html#_typemap +lxml.builder.ElementMaker.__new__ lxml.builder.ElementMaker-class.html#__new__ +lxml.builder.ElementMaker.__setstate__ lxml.builder.ElementMaker-class.html#__setstate__ +lxml.builder.ElementMaker.__reduce__ lxml.builder.ElementMaker-class.html#__reduce__ +lxml.builder.ElementMaker.__getattribute__ lxml.builder.ElementMaker-class.html#__getattribute__ +lxml.builder.ElementMaker.__getattr__ lxml.builder.ElementMaker-class.html#__getattr__ +lxml.builder.ElementMaker._makeelement lxml.builder.ElementMaker-class.html#_makeelement +lxml.builder.ElementMaker.__init__ lxml.builder.ElementMaker-class.html#__init__ +lxml.builder.ElementMaker.__call__ lxml.builder.ElementMaker-class.html#__call__ +lxml.builder.ElementMaker._nsmap lxml.builder.ElementMaker-class.html#_nsmap +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.LxmlHTMLTranslator lxml.cssselect.LxmlHTMLTranslator-class.html +lxml.cssselect.LxmlTranslator.xpath_contains_function lxml.cssselect.LxmlTranslator-class.html#xpath_contains_function +cssselect.xpath.GenericTranslator.xpathexpr_cls cssselect.xpath.XPathExpr-class.html +lxml.cssselect.LxmlTranslator lxml.cssselect.LxmlTranslator-class.html +lxml.cssselect.LxmlTranslator.xpath_contains_function lxml.cssselect.LxmlTranslator-class.html#xpath_contains_function +cssselect.xpath.GenericTranslator.xpathexpr_cls cssselect.xpath.XPathExpr-class.html +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._ElementMatchIterator.__next__ lxml.etree._ElementMatchIterator-class.html#__next__ +lxml.etree._ElementMatchIterator.next lxml.etree._ElementMatchIterator-class.html#next +lxml.etree._ElementMatchIterator.__iter__ lxml.etree._ElementMatchIterator-class.html#__iter__ +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.C14NError.__new__ lxml.etree.C14NError-class.html#__new__ +lxml.etree.C14NWriterTarget lxml.etree.C14NWriterTarget-class.html +lxml.etree.C14NWriterTarget.comment lxml.etree.C14NWriterTarget-class.html#comment +lxml.etree.C14NWriterTarget.start_ns lxml.etree.C14NWriterTarget-class.html#start_ns +lxml.etree.C14NWriterTarget.close lxml.etree.C14NWriterTarget-class.html#close +lxml.etree.C14NWriterTarget.__init__ lxml.etree.C14NWriterTarget-class.html#__init__ +lxml.etree.C14NWriterTarget.end lxml.etree.C14NWriterTarget-class.html#end +lxml.etree.C14NWriterTarget.__new__ lxml.etree.C14NWriterTarget-class.html#__new__ +lxml.etree.C14NWriterTarget.start lxml.etree.C14NWriterTarget-class.html#start +lxml.etree.C14NWriterTarget.pi lxml.etree.C14NWriterTarget-class.html#pi +lxml.etree.C14NWriterTarget._iter_namespaces lxml.etree.C14NWriterTarget-class.html#_iter_namespaces +lxml.etree.C14NWriterTarget.data lxml.etree.C14NWriterTarget-class.html#data +lxml.etree.CDATA lxml.etree.CDATA-class.html +lxml.etree.CDATA.__new__ lxml.etree.CDATA-class.html#__new__ +lxml.etree.CommentBase lxml.etree.CommentBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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._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._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.CommentBase.__init__ lxml.etree.CommentBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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.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._Comment.__repr__ lxml.etree._Comment-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +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._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +lxml.etree.DTD.iterelements lxml.etree.DTD-class.html#iterelements +lxml.etree.DTD.system_url lxml.etree.DTD-class.html#system_url +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.DTD.__init__ lxml.etree.DTD-class.html#__init__ +lxml.etree.DTD.__new__ lxml.etree.DTD-class.html#__new__ +lxml.etree._Validator._clear_error_log lxml.etree._Validator-class.html#_clear_error_log +lxml.etree.DTD.iterentities lxml.etree.DTD-class.html#iterentities +lxml.etree.DTD.entities lxml.etree.DTD-class.html#entities +lxml.etree.DTD.__call__ lxml.etree.DTD-class.html#__call__ +lxml.etree.DTD.elements lxml.etree.DTD-class.html#elements +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree.DTD.name lxml.etree.DTD-class.html#name +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.external_id lxml.etree.DTD-class.html#external_id +lxml.etree.DTDError lxml.etree.DTDError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DTDError.__new__ lxml.etree.DTDError-class.html#__new__ +lxml.etree.DTDParseError lxml.etree.DTDParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DTDParseError.__new__ lxml.etree.DTDParseError-class.html#__new__ +lxml.etree.DTDValidateError lxml.etree.DTDValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DTDValidateError.__new__ lxml.etree.DTDValidateError-class.html#__new__ +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.encoding lxml.etree.DocInfo-class.html#encoding +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.__new__ lxml.etree.DocInfo-class.html#__new__ +lxml.etree.DocInfo.internalDTD lxml.etree.DocInfo-class.html#internalDTD +lxml.etree.DocInfo.URL lxml.etree.DocInfo-class.html#URL +lxml.etree.DocInfo.standalone lxml.etree.DocInfo-class.html#standalone +lxml.etree.DocInfo.clear lxml.etree.DocInfo-class.html#clear +lxml.etree.DocInfo.root_name lxml.etree.DocInfo-class.html#root_name +lxml.etree.DocInfo.doctype lxml.etree.DocInfo-class.html#doctype +lxml.etree.DocumentInvalid lxml.etree.DocumentInvalid-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DocumentInvalid.__new__ lxml.etree.DocumentInvalid-class.html#__new__ +lxml.etree.ETCompatXMLParser lxml.etree.ETCompatXMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree.ETCompatXMLParser.__init__ lxml.etree.ETCompatXMLParser-class.html#__init__ +lxml.etree.ETCompatXMLParser.__new__ lxml.etree.ETCompatXMLParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +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.cssselect lxml.etree._Element-class.html#cssselect +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._ElementMatchIterator.__next__ lxml.etree._ElementMatchIterator-class.html#__next__ +lxml.etree._ElementMatchIterator.next lxml.etree._ElementMatchIterator-class.html#next +lxml.etree._ElementMatchIterator.__iter__ lxml.etree._ElementMatchIterator-class.html#__iter__ +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.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.EntityBase lxml.etree.EntityBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +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._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._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.EntityBase.__init__ lxml.etree.EntityBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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._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._Entity.__repr__ lxml.etree._Entity-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.Error lxml.etree.Error-class.html +lxml.etree.Error.__new__ lxml.etree.Error-class.html#__new__ +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.XINCLUDE lxml.etree.ErrorDomains-class.html#XINCLUDE +lxml.etree.ErrorDomains.C14N lxml.etree.ErrorDomains-class.html#C14N +lxml.etree.ErrorDomains.__qualname__ lxml.etree.ErrorDomains-class.html#__qualname__ +lxml.etree.ErrorDomains.NONE lxml.etree.ErrorDomains-class.html#NONE +lxml.etree.ErrorDomains.DATATYPE lxml.etree.ErrorDomains-class.html#DATATYPE +lxml.etree.ErrorDomains._getName lxml.etree.ErrorDomains-class.html#_getName +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.BUFFER lxml.etree.ErrorDomains-class.html#BUFFER +lxml.etree.ErrorDomains.PARSER lxml.etree.ErrorDomains-class.html#PARSER +lxml.etree.ErrorDomains.NAMESPACE lxml.etree.ErrorDomains-class.html#NAMESPACE +lxml.etree.ErrorDomains.URI lxml.etree.ErrorDomains-class.html#URI +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.__qualname__ lxml.etree.ErrorLevels-class.html#__qualname__ +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.IO_ENFILE lxml.etree.ErrorTypes-class.html#IO_ENFILE +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.__qualname__ lxml.etree.ErrorTypes-class.html#__qualname__ +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.RNGP_EXTERNALREF_RECURSE lxml.etree.ErrorTypes-class.html#RNGP_EXTERNALREF_RECURSE +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.RNGP_PARENTREF_NO_NAME lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_NO_NAME +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.RNGP_INTERLEAVE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_INTERLEAVE_EMPTY +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.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.XPATH_UNKNOWN_FUNC_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNKNOWN_FUNC_ERROR +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.SCHEMAV_ATTRUNKNOWN lxml.etree.ErrorTypes-class.html#SCHEMAV_ATTRUNKNOWN +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.ERR_USER_STOP lxml.etree.ErrorTypes-class.html#ERR_USER_STOP +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.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.DTD_NO_ROOT lxml.etree.ErrorTypes-class.html#DTD_NO_ROOT +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.BUF_OVERFLOW lxml.etree.ErrorTypes-class.html#BUF_OVERFLOW +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.ERR_NAME_TOO_LONG lxml.etree.ErrorTypes-class.html#ERR_NAME_TOO_LONG +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._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree.HTMLParser.__init__ lxml.etree.HTMLParser-class.html#__init__ +lxml.etree.HTMLParser.__new__ lxml.etree.HTMLParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree.HTMLPullParser lxml.etree.HTMLPullParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree.HTMLPullParser.read_events lxml.etree.HTMLPullParser-class.html#read_events +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree.HTMLPullParser.__init__ lxml.etree.HTMLPullParser-class.html#__init__ +lxml.etree.HTMLPullParser.__new__ lxml.etree.HTMLPullParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree.LxmlError lxml.etree.LxmlError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.LxmlRegistryError lxml.etree.LxmlRegistryError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlRegistryError.__new__ lxml.etree.LxmlRegistryError-class.html#__new__ +lxml.etree.LxmlSyntaxError lxml.etree.LxmlSyntaxError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.LxmlSyntaxError.__qualname__ lxml.etree.LxmlSyntaxError-class.html#__qualname__ +lxml.etree.NamespaceRegistryError lxml.etree.NamespaceRegistryError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.NamespaceRegistryError.__new__ lxml.etree.NamespaceRegistryError-class.html#__new__ +lxml.etree.PIBase lxml.etree.PIBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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._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._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.PIBase.__init__ lxml.etree.PIBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._ProcessingInstruction.get lxml.etree._ProcessingInstruction-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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._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._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._ProcessingInstruction.attrib lxml.etree._ProcessingInstruction-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.ParseError lxml.etree.ParseError-class.html +lxml.etree.ParseError.__init__ lxml.etree.ParseError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.ParseError.__qualname__ lxml.etree.ParseError-class.html#__qualname__ +lxml.etree.ParseError.position lxml.etree.ParseError-class.html#position +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.ParserError.__new__ lxml.etree.ParserError-class.html#__new__ +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.text lxml.etree.QName-class.html#text +lxml.etree.QName.__str__ lxml.etree.QName-class.html#__str__ +lxml.etree.QName.localname lxml.etree.QName-class.html#localname +lxml.etree.QName.__lt__ lxml.etree.QName-class.html#__lt__ +lxml.etree.QName.__init__ lxml.etree.QName-class.html#__init__ +lxml.etree.QName.__new__ lxml.etree.QName-class.html#__new__ +lxml.etree.QName.namespace lxml.etree.QName-class.html#namespace +lxml.etree.QName.__ne__ lxml.etree.QName-class.html#__ne__ +lxml.etree.QName.__gt__ lxml.etree.QName-class.html#__gt__ +lxml.etree.QName.__eq__ lxml.etree.QName-class.html#__eq__ +lxml.etree.QName.__le__ lxml.etree.QName-class.html#__le__ +lxml.etree.QName.__hash__ lxml.etree.QName-class.html#__hash__ +lxml.etree.QName.__ge__ lxml.etree.QName-class.html#__ge__ +lxml.etree.RelaxNG lxml.etree.RelaxNG-class.html +lxml.etree._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.RelaxNG.__init__ lxml.etree.RelaxNG-class.html#__init__ +lxml.etree.RelaxNG.__new__ lxml.etree.RelaxNG-class.html#__new__ +lxml.etree._Validator._clear_error_log lxml.etree._Validator-class.html#_clear_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.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree.RelaxNG.from_rnc_string lxml.etree.RelaxNG-class.html#from_rnc_string +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree.RelaxNGError lxml.etree.RelaxNGError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.RelaxNGError.__new__ lxml.etree.RelaxNGError-class.html#__new__ +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_TYPEVAL lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_TYPEVAL +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_VALUE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_VALUE +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_ELEMEXTRANS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMEXTRANS +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.__qualname__ lxml.etree.RelaxNGErrorTypes-class.html#__qualname__ +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_INTERSEQ lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INTERSEQ +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.RelaxNGParseError.__new__ lxml.etree.RelaxNGParseError-class.html#__new__ +lxml.etree.RelaxNGValidateError lxml.etree.RelaxNGValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.RelaxNGValidateError.__new__ lxml.etree.RelaxNGValidateError-class.html#__new__ +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._clear_error_log lxml.etree._Validator-class.html#_clear_error_log +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +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.SchematronError.__new__ lxml.etree.SchematronError-class.html#__new__ +lxml.etree.SchematronParseError lxml.etree.SchematronParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SchematronParseError.__new__ lxml.etree.SchematronParseError-class.html#__new__ +lxml.etree.SchematronValidateError lxml.etree.SchematronValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SchematronValidateError.__new__ lxml.etree.SchematronValidateError-class.html#__new__ +lxml.etree.SerialisationError lxml.etree.SerialisationError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SerialisationError.__new__ lxml.etree.SerialisationError-class.html#__new__ +lxml.etree.SiblingsIterator lxml.etree.SiblingsIterator-class.html +lxml.etree.SiblingsIterator.__new__ lxml.etree.SiblingsIterator-class.html#__new__ +lxml.etree._ElementMatchIterator.__next__ lxml.etree._ElementMatchIterator-class.html#__next__ +lxml.etree._ElementMatchIterator.next lxml.etree._ElementMatchIterator-class.html#next +lxml.etree._ElementMatchIterator.__iter__ lxml.etree._ElementMatchIterator-class.html#__iter__ +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.XIncludeError.__new__ lxml.etree.XIncludeError-class.html#__new__ +lxml.etree.XMLParser lxml.etree.XMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree.XMLParser.__init__ lxml.etree.XMLParser-class.html#__init__ +lxml.etree.XMLParser.__new__ lxml.etree.XMLParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree.XMLPullParser lxml.etree.XMLPullParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree.XMLPullParser.read_events lxml.etree.XMLPullParser-class.html#read_events +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree.XMLPullParser.__init__ lxml.etree.XMLPullParser-class.html#__init__ +lxml.etree.XMLPullParser.__new__ lxml.etree.XMLPullParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree.XMLSchema lxml.etree.XMLSchema-class.html +lxml.etree.XMLSchema.__new__ lxml.etree.XMLSchema-class.html#__new__ +lxml.etree._Validator._clear_error_log lxml.etree._Validator-class.html#_clear_error_log +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +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.XMLSchemaError.__new__ lxml.etree.XMLSchemaError-class.html#__new__ +lxml.etree.XMLSchemaParseError lxml.etree.XMLSchemaParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLSchemaParseError.__new__ lxml.etree.XMLSchemaParseError-class.html#__new__ +lxml.etree.XMLSchemaValidateError lxml.etree.XMLSchemaValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLSchemaValidateError.__new__ lxml.etree.XMLSchemaValidateError-class.html#__new__ +lxml.etree.XMLSyntaxError lxml.etree.XMLSyntaxError-class.html +lxml.etree.ParseError.__init__ lxml.etree.ParseError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +lxml.etree.XMLSyntaxError.__qualname__ lxml.etree.XMLSyntaxError-class.html#__qualname__ +lxml.etree.ParseError.position lxml.etree.ParseError-class.html#position +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.XPathError.__new__ lxml.etree.XPathError-class.html#__new__ +lxml.etree.XPathEvalError lxml.etree.XPathEvalError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathEvalError.__new__ lxml.etree.XPathEvalError-class.html#__new__ +lxml.etree.XPathFunctionError lxml.etree.XPathFunctionError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathFunctionError.__new__ lxml.etree.XPathFunctionError-class.html#__new__ +lxml.etree.XPathResultError lxml.etree.XPathResultError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathResultError.__new__ lxml.etree.XPathResultError-class.html#__new__ +lxml.etree.XPathSyntaxError lxml.etree.XPathSyntaxError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathError.__new__ lxml.etree.XPathError-class.html#__new__ +lxml.etree.XPathSyntaxError.__qualname__ lxml.etree.XPathSyntaxError-class.html#__qualname__ +lxml.etree.XSLT lxml.etree.XSLT-class.html +lxml.etree.XSLT.apply lxml.etree.XSLT-class.html#apply +lxml.etree.XSLT.__init__ lxml.etree.XSLT-class.html#__init__ +lxml.etree.XSLT.__new__ lxml.etree.XSLT-class.html#__new__ +lxml.etree.XSLT.set_global_max_depth lxml.etree.XSLT-class.html#set_global_max_depth +lxml.etree.XSLT.__call__ lxml.etree.XSLT-class.html#__call__ +lxml.etree.XSLT.__deepcopy__ lxml.etree.XSLT-class.html#__deepcopy__ +lxml.etree.XSLT.tostring lxml.etree.XSLT-class.html#tostring +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.__copy__ lxml.etree.XSLT-class.html#__copy__ +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.XSLTApplyError.__new__ lxml.etree.XSLTApplyError-class.html#__new__ +lxml.etree.XSLTError lxml.etree.XSLTError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTError.__new__ lxml.etree.XSLTError-class.html#__new__ +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.XSLTExtension.process_children lxml.etree.XSLTExtension-class.html#process_children +lxml.etree.XSLTExtensionError lxml.etree.XSLTExtensionError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTExtensionError.__new__ lxml.etree.XSLTExtensionError-class.html#__new__ +lxml.etree.XSLTParseError lxml.etree.XSLTParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTParseError.__new__ lxml.etree.XSLTParseError-class.html#__new__ +lxml.etree.XSLTSaveError lxml.etree.XSLTSaveError-class.html +lxml.etree.XSLTSaveError.__qualname__ lxml.etree.XSLTSaveError-class.html#__qualname__ +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTError.__new__ lxml.etree.XSLTError-class.html#__new__ +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.__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.__deepcopy__ lxml.etree._Attrib-class.html#__deepcopy__ +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.__copy__ lxml.etree._Attrib-class.html#__copy__ +lxml.etree._Attrib.__ge__ lxml.etree._Attrib-class.html#__ge__ +lxml.etree._BaseErrorLog lxml.etree._BaseErrorLog-class.html +lxml.etree._BaseErrorLog.__new__ lxml.etree._BaseErrorLog-class.html#__new__ +lxml.etree._BaseErrorLog.receive lxml.etree._BaseErrorLog-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._BaseErrorLog.copy lxml.etree._BaseErrorLog-class.html#copy +lxml.etree._BaseErrorLog.__init__ lxml.etree._BaseErrorLog-class.html#__init__ +lxml.etree._Comment lxml.etree._Comment-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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._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._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._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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.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._Comment.__repr__ lxml.etree._Comment-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +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._ErrorLog.__exit__ lxml.etree._ErrorLog-class.html#__exit__ +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.values lxml.etree._Element-class.html#values +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.cssselect lxml.etree._Element-class.html#cssselect +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._ElementMatchIterator lxml.etree._ElementMatchIterator-class.html +lxml.etree._ElementMatchIterator.__new__ lxml.etree._ElementMatchIterator-class.html#__new__ +lxml.etree._ElementMatchIterator.__next__ lxml.etree._ElementMatchIterator-class.html#__next__ +lxml.etree._ElementMatchIterator.next lxml.etree._ElementMatchIterator-class.html#next +lxml.etree._ElementMatchIterator.__iter__ lxml.etree._ElementMatchIterator-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.__format__ str-class.html#__format__ +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._formatter_parser str-class.html#_formatter_parser +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.format str-class.html#format +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.__sizeof__ str-class.html#__sizeof__ +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 +lxml.etree._ElementStringResult.__qualname__ lxml.etree._ElementStringResult-class.html#__qualname__ +str.__le__ str-class.html#__le__ +str.__repr__ str-class.html#__repr__ +str._formatter_field_name_split str-class.html#_formatter_field_name_split +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.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.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.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.getelementpath lxml.etree._ElementTree-class.html#getelementpath +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.attrname lxml.etree._ElementUnicodeResult-class.html#attrname +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._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._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._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._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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._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._Entity.__repr__ lxml.etree._Entity-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +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._ErrorLog.__exit__ lxml.etree._ErrorLog-class.html#__exit__ +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._FeedParser lxml.etree._FeedParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.__new__ lxml.etree._FeedParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._IDDict lxml.etree._IDDict-class.html +lxml.etree._IDDict.has_key lxml.etree._IDDict-class.html#has_key +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._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._BaseErrorLog.receive lxml.etree._BaseErrorLog-class.html#receive +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.message lxml.etree._LogEntry-class.html#message +lxml.etree._LogEntry.level_name lxml.etree._LogEntry-class.html#level_name +lxml.etree._LogEntry.__new__ lxml.etree._LogEntry-class.html#__new__ +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.type lxml.etree._LogEntry-class.html#type +lxml.etree._LogEntry.path lxml.etree._LogEntry-class.html#path +lxml.etree._LogEntry.line lxml.etree._LogEntry-class.html#line +lxml.etree._LogEntry.level lxml.etree._LogEntry-class.html#level +lxml.etree._LogEntry.column lxml.etree._LogEntry-class.html#column +lxml.etree._LogEntry.__repr__ lxml.etree._LogEntry-class.html#__repr__ +lxml.etree._ProcessingInstruction lxml.etree._ProcessingInstruction-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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._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._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._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._ProcessingInstruction.get lxml.etree._ProcessingInstruction-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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._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._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._ProcessingInstruction.attrib lxml.etree._ProcessingInstruction-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +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._ErrorLog.__exit__ lxml.etree._ErrorLog-class.html#__exit__ +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._SaxParserTarget lxml.etree._SaxParserTarget-class.html +lxml.etree._SaxParserTarget.__new__ lxml.etree._SaxParserTarget-class.html#__new__ +lxml.etree._TargetParserResult lxml.etree._TargetParserResult-class.html +lxml.etree._TargetParserResult.__qualname__ lxml.etree._TargetParserResult-class.html#__qualname__ +lxml.etree._TargetParserResult.__init__ lxml.etree._TargetParserResult-class.html#__init__ +lxml.etree._Validator lxml.etree._Validator-class.html +lxml.etree._Validator.__new__ lxml.etree._Validator-class.html#__new__ +lxml.etree._Validator._clear_error_log lxml.etree._Validator-class.html#_clear_error_log +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +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._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._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._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._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.PIBase.__init__ lxml.etree.PIBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._ProcessingInstruction.get lxml.etree._ProcessingInstruction-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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._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._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._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._ProcessingInstruction.attrib lxml.etree._ProcessingInstruction-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +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.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.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.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.getelementpath lxml.etree._ElementTree-class.html#getelementpath +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._XSLTResultTree.write_output lxml.etree._XSLTResultTree-class.html#write_output +lxml.etree._ElementTree.getiterator lxml.etree._ElementTree-class.html#getiterator +lxml.etree._ElementTree.__copy__ lxml.etree._ElementTree-class.html#__copy__ +lxml.etree.htmlfile lxml.etree.htmlfile-class.html +lxml.etree.xmlfile.__exit__ lxml.etree.xmlfile-class.html#__exit__ +lxml.etree.htmlfile.__new__ lxml.etree.htmlfile-class.html#__new__ +lxml.etree.xmlfile.__aexit__ lxml.etree.xmlfile-class.html#__aexit__ +lxml.etree.xmlfile.__enter__ lxml.etree.xmlfile-class.html#__enter__ +lxml.etree.xmlfile.__aenter__ lxml.etree.xmlfile-class.html#__aenter__ +lxml.etree.htmlfile.__init__ lxml.etree.htmlfile-class.html#__init__ +lxml.etree.iterparse lxml.etree.iterparse-class.html +lxml.etree.iterparse.set_element_class_lookup lxml.etree.iterparse-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.iterparse.next lxml.etree.iterparse-class.html#next +lxml.etree.iterparse.version lxml.etree.iterparse-class.html#version +lxml.etree.iterparse.__next__ lxml.etree.iterparse-class.html#__next__ +lxml.etree.iterparse.makeelement lxml.etree.iterparse-class.html#makeelement +lxml.etree.iterparse.__iter__ lxml.etree.iterparse-class.html#__iter__ +lxml.etree.iterparse.resolvers lxml.etree.iterparse-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.etree.iterwalk.skip_subtree lxml.etree.iterwalk-class.html#skip_subtree +lxml.etree.xmlfile lxml.etree.xmlfile-class.html +lxml.etree.xmlfile.__exit__ lxml.etree.xmlfile-class.html#__exit__ +lxml.etree.xmlfile.__new__ lxml.etree.xmlfile-class.html#__new__ +lxml.etree.xmlfile.__aexit__ lxml.etree.xmlfile-class.html#__aexit__ +lxml.etree.xmlfile.__enter__ lxml.etree.xmlfile-class.html#__enter__ +lxml.etree.xmlfile.__aenter__ lxml.etree.xmlfile-class.html#__aenter__ +lxml.etree.xmlfile.__init__ lxml.etree.xmlfile-class.html#__init__ +lxml.html.CheckboxGroup lxml.html.CheckboxGroup-class.html +lxml.html.CheckboxGroup.value_options lxml.html.CheckboxGroup-class.html#value_options +lxml.html.CheckboxGroup.value lxml.html.CheckboxGroup-class.html#value +lxml.html.CheckboxGroup.__repr__ lxml.html.CheckboxGroup-class.html#__repr__ +lxml.html.CheckboxValues lxml.html.CheckboxValues-class.html +_abcoll.Sized.__metaclass__ abc.ABCMeta-class.html +lxml.html.CheckboxValues.__init__ lxml.html.CheckboxValues-class.html#__init__ +lxml.html.CheckboxValues.__abstractmethods__ lxml.html.CheckboxValues-class.html#__abstractmethods__ +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.Classes lxml.html.Classes-class.html +_abcoll.Sized.__metaclass__ abc.ABCMeta-class.html +lxml.html.Classes._abc_negative_cache lxml.html.Classes-class.html#_abc_negative_cache +lxml.html.Classes.toggle lxml.html.Classes-class.html#toggle +lxml.html.Classes.__init__ lxml.html.Classes-class.html#__init__ +lxml.html.Classes.__contains__ lxml.html.Classes-class.html#__contains__ +lxml.html.Classes.__abstractmethods__ lxml.html.Classes-class.html#__abstractmethods__ +lxml.html.Classes.add lxml.html.Classes-class.html#add +lxml.html.Classes.__len__ lxml.html.Classes-class.html#__len__ +lxml.html.Classes.update lxml.html.Classes-class.html#update +lxml.html.Classes.__iter__ lxml.html.Classes-class.html#__iter__ +lxml.html.Classes.remove lxml.html.Classes-class.html#remove +lxml.html.Classes._abc_negative_cache_version lxml.html.Classes-class.html#_abc_negative_cache_version +lxml.html.Classes.discard lxml.html.Classes-class.html#discard +lxml.html.Classes._abc_registry lxml.html.Classes-class.html#_abc_registry +lxml.html.FieldsDict lxml.html.FieldsDict-class.html +_abcoll.Sized.__metaclass__ abc.ABCMeta-class.html +lxml.html.FieldsDict._abc_negative_cache lxml.html.FieldsDict-class.html#_abc_negative_cache +lxml.html.FieldsDict.__init__ lxml.html.FieldsDict-class.html#__init__ +lxml.html.FieldsDict.__contains__ lxml.html.FieldsDict-class.html#__contains__ +lxml.html.FieldsDict.__abstractmethods__ lxml.html.FieldsDict-class.html#__abstractmethods__ +lxml.html.FieldsDict.__len__ lxml.html.FieldsDict-class.html#__len__ +lxml.html.FieldsDict.__getitem__ lxml.html.FieldsDict-class.html#__getitem__ +lxml.html.FieldsDict.keys lxml.html.FieldsDict-class.html#keys +lxml.html.FieldsDict.__iter__ lxml.html.FieldsDict-class.html#__iter__ +lxml.html.FieldsDict.__delitem__ lxml.html.FieldsDict-class.html#__delitem__ +lxml.html.FieldsDict.__setitem__ lxml.html.FieldsDict-class.html#__setitem__ +lxml.html.FieldsDict._abc_negative_cache_version lxml.html.FieldsDict-class.html#_abc_negative_cache_version +lxml.html.FieldsDict.__repr__ lxml.html.FieldsDict-class.html#__repr__ +lxml.html.FieldsDict._abc_registry lxml.html.FieldsDict-class.html#_abc_registry +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.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.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +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.html.HtmlElement.set lxml.html.HtmlElement-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.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.FormElement._name lxml.html.FormElement-class.html#_name +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-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.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.html.FormElement.form_values lxml.html.FormElement-class.html#form_values +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.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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.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._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.html.HTMLParser.__init__ lxml.html.HTMLParser-class.html#__init__ +lxml.etree.HTMLParser.__new__ lxml.etree.HTMLParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +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._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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.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.CommentBase.__init__ lxml.etree.CommentBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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.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.__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.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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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._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.html.HtmlElement.set lxml.html.HtmlElement-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.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.etree._Element.values lxml.etree._Element-class.html#values +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.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.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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-class.html#cssselect +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._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.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.EntityBase.__init__ lxml.etree.EntityBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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.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.__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._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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.html.HtmlMixin lxml.html.HtmlMixin-class.html +lxml.html.HtmlMixin.set lxml.html.HtmlMixin-class.html#set +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.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.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +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.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.PIBase.__init__ lxml.etree.PIBase-class.html#__init__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._ProcessingInstruction.get lxml.etree._ProcessingInstruction-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +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.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.__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._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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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._ProcessingInstruction.attrib lxml.etree._ProcessingInstruction-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.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.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +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.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +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.html.HtmlElement.set lxml.html.HtmlElement-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.etree._Element.findall lxml.etree._Element-class.html#findall +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.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-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.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +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.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +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.html.InputElement.value lxml.html.InputElement-class.html#value +lxml.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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.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.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.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.__repr__ lxml.html.InputMixin-class.html#__repr__ +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +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.html.HtmlElement.set lxml.html.HtmlElement-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.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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +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.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.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.base lxml.etree._Element-class.html#base +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-class.html#cssselect +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.MultipleSelectOptions lxml.html.MultipleSelectOptions-class.html +_abcoll.Sized.__metaclass__ abc.ABCMeta-class.html +lxml.html.MultipleSelectOptions.__init__ lxml.html.MultipleSelectOptions-class.html#__init__ +lxml.html.MultipleSelectOptions.__abstractmethods__ lxml.html.MultipleSelectOptions-class.html#__abstractmethods__ +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_options lxml.html.RadioGroup-class.html#value_options +lxml.html.RadioGroup.value lxml.html.RadioGroup-class.html#value +lxml.html.RadioGroup.__repr__ lxml.html.RadioGroup-class.html#__repr__ +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.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.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.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +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.html.HtmlElement.set lxml.html.HtmlElement-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.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-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.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +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.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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +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.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.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 lxml.html.TextareaElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.html.HtmlElement.set lxml.html.HtmlElement-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.html.TextareaElement.value lxml.html.TextareaElement-class.html#value +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.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._Element.iter lxml.etree._Element-class.html#iter +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +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.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.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.html.InputMixin.name lxml.html.InputMixin-class.html#name +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.html.HtmlMixin.classes lxml.html.HtmlMixin-class.html#classes +lxml.html.HtmlElement.cssselect lxml.html.HtmlElement-class.html#cssselect +lxml.html.InputMixin.__repr__ lxml.html.InputMixin-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.XHTMLParser lxml.html.XHTMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.html.XHTMLParser.__init__ lxml.html.XHTMLParser-class.html#__init__ +lxml.etree.XMLParser.__new__ lxml.etree.XMLParser-class.html#__new__ +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +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.kill_tags lxml.html.clean.Cleaner-class.html#kill_tags +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.inline_style lxml.html.clean.Cleaner-class.html#inline_style +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.safe_attrs lxml.html.clean.Cleaner-class.html#safe_attrs +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.clean.Cleaner.__qualname__ lxml.html.clean.Cleaner-class.html#__qualname__ +lxml.html.diff.DEL_END lxml.html.diff.DEL_END-class.html +lxml.html.diff.DEL_END.__qualname__ lxml.html.diff.DEL_END-class.html#__qualname__ +lxml.html.diff.DEL_START lxml.html.diff.DEL_START-class.html +lxml.html.diff.DEL_START.__qualname__ lxml.html.diff.DEL_START-class.html#__qualname__ +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.__qualname__ lxml.html.diff.InsensitiveSequenceMatcher-class.html#__qualname__ +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.NoDeletes.__qualname__ lxml.html.diff.NoDeletes-class.html#__qualname__ +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.href_token.__qualname__ lxml.html.diff.href_token-class.html#__qualname__ +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.__qualname__ lxml.html.diff.tag_token-class.html#__qualname__ +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.__qualname__ lxml.html.diff.token-class.html#__qualname__ +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.html.soupparser._PseudoTag lxml.html.soupparser._PseudoTag-class.html +lxml.html.soupparser._PseudoTag.__iter__ lxml.html.soupparser._PseudoTag-class.html#__iter__ +lxml.html.soupparser._PseudoTag.__init__ lxml.html.soupparser._PseudoTag-class.html#__init__ +lxml.isoschematron.Schematron lxml.isoschematron.Schematron-class.html +lxml.isoschematron.Schematron._extract_rng lxml.isoschematron.Schematron-class.html#_extract_rng +lxml.etree._Validator._append_log_message lxml.etree._Validator-class.html#_append_log_message +lxml.isoschematron.Schematron.validation_report lxml.isoschematron.Schematron-class.html#validation_report +lxml.isoschematron.Schematron.validator_xslt lxml.isoschematron.Schematron-class.html#validator_xslt +lxml.isoschematron.Schematron._expand lxml.isoschematron.Schematron-class.html#_expand +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.isoschematron.Schematron.__init__ lxml.isoschematron.Schematron-class.html#__init__ +lxml.etree._Validator.__new__ lxml.etree._Validator-class.html#__new__ +lxml.etree._Validator._clear_error_log lxml.etree._Validator-class.html#_clear_error_log +lxml.isoschematron.Schematron._extract lxml.isoschematron.Schematron-class.html#_extract +lxml.isoschematron.Schematron.__call__ lxml.isoschematron.Schematron-class.html#__call__ +lxml.isoschematron.Schematron._compile lxml.isoschematron.Schematron-class.html#_compile +lxml.isoschematron.Schematron.schematron lxml.isoschematron.Schematron-class.html#schematron +lxml.isoschematron.Schematron._validation_errors lxml.isoschematron.Schematron-class.html#_validation_errors +lxml.isoschematron.Schematron._include lxml.isoschematron.Schematron-class.html#_include +lxml.isoschematron.Schematron.ASSERTS_ONLY lxml.isoschematron.Schematron-class.html#ASSERTS_ONLY +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.isoschematron.Schematron._level lxml.isoschematron.Schematron-class.html#_level +lxml.isoschematron.Schematron._domain lxml.isoschematron.Schematron-class.html#_domain +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.isoschematron.Schematron.ASSERTS_AND_REPORTS lxml.isoschematron.Schematron-class.html#ASSERTS_AND_REPORTS +lxml.isoschematron.Schematron._error_type lxml.isoschematron.Schematron-class.html#_error_type +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.isoschematron.Schematron._extract_xsd lxml.isoschematron.Schematron-class.html#_extract_xsd +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.etree._Element.find lxml.etree._Element-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.etree._Element.findall lxml.etree._Element-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.etree._Element.findtext lxml.etree._Element-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.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.BoolElement.__hash__ lxml.objectify.BoolElement-class.html#__hash__ +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.etree._Element.iterfind lxml.etree._Element-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.IntElement.__index__ lxml.objectify.IntElement-class.html#__index__ +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.__call__ lxml.objectify.ElementMaker-class.html#__call__ +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.etree._Element.find lxml.etree._Element-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.etree._Element.findall lxml.etree._Element-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.etree._Element.findtext lxml.etree._Element-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.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.__hash__ lxml.objectify.NumberElement-class.html#__hash__ +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.etree._Element.iterfind lxml.etree._Element-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.etree._Element.find lxml.etree._Element-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.etree._Element.findall lxml.etree._Element-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.etree._Element.findtext lxml.etree._Element-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.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.__hash__ lxml.objectify.NumberElement-class.html#__hash__ +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.etree._Element.iterfind lxml.etree._Element-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.IntElement.__index__ lxml.objectify.IntElement-class.html#__index__ +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.etree._Element.find lxml.etree._Element-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.etree._Element.findall lxml.etree._Element-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.etree._Element.findtext lxml.etree._Element-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.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.__hash__ lxml.objectify.NumberElement-class.html#__hash__ +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.etree._Element.iterfind lxml.etree._Element-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.LongElement.__index__ lxml.objectify.LongElement-class.html#__index__ +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.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +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.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.find lxml.etree._Element-class.html#find +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.etree._Element._init lxml.etree._Element-class.html#_init +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.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +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.etree._Element.findtext lxml.etree._Element-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.objectify.ObjectifiedElement.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +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.cssselect lxml.etree._Element-class.html#cssselect +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.findall lxml.etree._Element-class.html#findall +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +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.objectify.NoneElement.__hash__ lxml.objectify.NoneElement-class.html#__hash__ +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.etree._Element.find lxml.etree._Element-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.etree._Element.findall lxml.etree._Element-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.etree._Element.findtext lxml.etree._Element-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.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +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.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.__hash__ lxml.objectify.NumberElement-class.html#__hash__ +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.etree._Element.iterfind lxml.etree._Element-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.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +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.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.find lxml.etree._Element-class.html#find +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.etree._Element._init lxml.etree._Element-class.html#_init +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.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +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.etree._Element.findtext lxml.etree._Element-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.objectify.ObjectifiedElement.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +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.cssselect lxml.etree._Element-class.html#cssselect +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.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.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +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.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.find lxml.etree._Element-class.html#find +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.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +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.objectify.ObjectifiedElement.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +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.cssselect lxml.etree._Element-class.html#cssselect +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.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +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.__new__ lxml.objectify.PyType-class.html#__new__ +lxml.objectify.PyType.xmlSchemaTypes lxml.objectify.PyType-class.html#xmlSchemaTypes +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.type_check lxml.objectify.PyType-class.html#type_check +lxml.objectify.PyType.__init__ lxml.objectify.PyType-class.html#__init__ +lxml.objectify.PyType.name lxml.objectify.PyType-class.html#name +lxml.objectify.StringElement lxml.objectify.StringElement-class.html +lxml.objectify.StringElement.__int__ lxml.objectify.StringElement-class.html#__int__ +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.ObjectifiedDataElement.__str__ lxml.objectify.ObjectifiedDataElement-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.StringElement.__rmul__ lxml.objectify.StringElement-class.html#__rmul__ +lxml.objectify.StringElement.__lt__ lxml.objectify.StringElement-class.html#__lt__ +lxml.etree._Element.find lxml.etree._Element-class.html#find +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.StringElement.__gt__ lxml.objectify.StringElement-class.html#__gt__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.StringElement.__nonzero__ lxml.objectify.StringElement-class.html#__nonzero__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.StringElement.__long__ lxml.objectify.StringElement-class.html#__long__ +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.objectify.StringElement.__rmod__ lxml.objectify.StringElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.index lxml.etree._Element-class.html#index +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.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.StringElement.__float__ lxml.objectify.StringElement-class.html#__float__ +lxml.objectify.StringElement.__ne__ lxml.objectify.StringElement-class.html#__ne__ +lxml.etree._Element.findtext lxml.etree._Element-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.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.etree._Element.cssselect lxml.etree._Element-class.html#cssselect +lxml.objectify.StringElement.__mul__ lxml.objectify.StringElement-class.html#__mul__ +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.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.StringElement.__complex__ lxml.objectify.StringElement-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.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.ObjectifiedElement.__reduce__ lxml.objectify.ObjectifiedElement-class.html#__reduce__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.StringElement.__eq__ lxml.objectify.StringElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.StringElement.__mod__ lxml.objectify.StringElement-class.html#__mod__ +lxml.objectify.StringElement.__le__ lxml.objectify.StringElement-class.html#__le__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.StringElement.__hash__ lxml.objectify.StringElement-class.html#__hash__ +lxml.objectify.StringElement.__ge__ lxml.objectify.StringElement-class.html#__ge__ +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.StringElement.__radd__ lxml.objectify.StringElement-class.html#__radd__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.objectify.StringElement.strlen lxml.objectify.StringElement-class.html#strlen +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.StringElement.__new__ lxml.objectify.StringElement-class.html#__new__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.objectify.StringElement.pyval lxml.objectify.StringElement-class.html#pyval +lxml.objectify.StringElement.__repr__ lxml.objectify.StringElement-class.html#__repr__ +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.StringElement.__add__ lxml.objectify.StringElement-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.sax.ElementTreeContentHandler lxml.sax.ElementTreeContentHandler-class.html +lxml.sax.ElementTreeContentHandler.startPrefixMapping lxml.sax.ElementTreeContentHandler-class.html#startPrefixMapping +lxml.sax.ElementTreeContentHandler.__qualname__ lxml.sax.ElementTreeContentHandler-class.html#__qualname__ +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._buildTag lxml.sax.ElementTreeContentHandler-class.html#_buildTag +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.__new__ lxml.sax.ElementTreeProducer-class.html#__new__ +lxml.sax.ElementTreeProducer.__setstate__ lxml.sax.ElementTreeProducer-class.html#__setstate__ +lxml.sax.ElementTreeProducer.__reduce__ lxml.sax.ElementTreeProducer-class.html#__reduce__ +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.sax.SaxError.__qualname__ lxml.sax.SaxError-class.html#__qualname__ +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlError.__new__ lxml.etree.LxmlError-class.html#__new__ +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._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +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.common_imports.skipif lxml.tests.common_imports.skipif-class.html +lxml.tests.common_imports.skipif.__call__ lxml.tests.common_imports.skipif-class.html#__call__ +lxml.tests.common_imports.skipif.__init__ lxml.tests.common_imports.skipif-class.html#__init__ +lxml.tests.dummy_http_server.HTTPRequestCollector lxml.tests.dummy_http_server.HTTPRequestCollector-class.html +lxml.tests.dummy_http_server.HTTPRequestCollector.__call__ lxml.tests.dummy_http_server.HTTPRequestCollector-class.html#__call__ +lxml.tests.dummy_http_server.HTTPRequestCollector.__init__ lxml.tests.dummy_http_server.HTTPRequestCollector-class.html#__init__ +lxml.tests.dummy_http_server.WebServer lxml.tests.dummy_http_server.WebServer-class.html +lxml.tests.dummy_http_server._RequestHandler lxml.tests.dummy_http_server._RequestHandler-class.html +lxml.tests.dummy_http_server._RequestHandler.log_message lxml.tests.dummy_http_server._RequestHandler-class.html#log_message +BaseHTTPServer.BaseHTTPRequestHandler.MessageClass mimetools.Message-class.html +lxml.tests.dummy_http_server._RequestHandler.get_stderr lxml.tests.dummy_http_server._RequestHandler-class.html#get_stderr +lxml.tests.test_builder.BuilderTestCase lxml.tests.test_builder.BuilderTestCase-class.html +lxml.tests.test_builder.BuilderTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_builder.BuilderTestCase.test_cdata lxml.tests.test_builder.BuilderTestCase-class.html#test_cdata +lxml.tests.test_builder.BuilderTestCase.test_cdata_solo lxml.tests.test_builder.BuilderTestCase-class.html#test_cdata_solo +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_builder.BuilderTestCase.test_build_from_xpath_result lxml.tests.test_builder.BuilderTestCase-class.html#test_build_from_xpath_result +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_builder.BuilderTestCase.test_unknown_type_raises lxml.tests.test_builder.BuilderTestCase-class.html#test_unknown_type_raises +lxml.tests.test_classlookup.ClassLookupTestCase lxml.tests.test_classlookup.ClassLookupTestCase-class.html +lxml.tests.test_classlookup.ClassLookupTestCase.test_namespace_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_namespace_lookup +lxml.tests.test_classlookup.ClassLookupTestCase.test_default_class_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_default_class_lookup +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.test_classlookup.ClassLookupTestCase.tearDown lxml.tests.test_classlookup.ClassLookupTestCase-class.html#tearDown +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_lookup_without_fallback lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_lookup_without_fallback +lxml.tests.test_classlookup.ClassLookupTestCase.test_custom_lookup_ns_fallback lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_custom_lookup_ns_fallback +lxml.tests.test_classlookup.ClassLookupTestCase.test_class_lookup_type_mismatch lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_class_lookup_type_mismatch +lxml.tests.test_classlookup.ClassLookupTestCase.test_default_class_lookup_pull_parser lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_default_class_lookup_pull_parser +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_parser_based_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_parser_based_lookup +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_classlookup.ClassLookupTestCase.test_evil_class_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_evil_class_lookup +lxml.tests.test_classlookup.ProxyTestCase lxml.tests.test_classlookup.ProxyTestCase-class.html +lxml.tests.test_classlookup.ProxyTestCase.test_proxy_reuse_after_del_root lxml.tests.test_classlookup.ProxyTestCase-class.html#test_proxy_reuse_after_del_root +lxml.tests.test_classlookup.ProxyTestCase.etree lxml.etree-module.html +lxml.tests.test_classlookup.ProxyTestCase.test_proxy_hashing lxml.tests.test_classlookup.ProxyTestCase-class.html#test_proxy_hashing +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_classlookup.ProxyTestCase.test_element_base_children lxml.tests.test_classlookup.ProxyTestCase-class.html#test_element_base_children +lxml.tests.test_classlookup.ProxyTestCase.test_pi_base lxml.tests.test_classlookup.ProxyTestCase-class.html#test_pi_base +lxml.tests.test_classlookup.ProxyTestCase.test_comment_base lxml.tests.test_classlookup.ProxyTestCase-class.html#test_comment_base +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_classlookup.ProxyTestCase.test_proxy_reuse_after_gc lxml.tests.test_classlookup.ProxyTestCase-class.html#test_proxy_reuse_after_gc +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_classlookup.ProxyTestCase.test_element_base lxml.tests.test_classlookup.ProxyTestCase-class.html#test_element_base +lxml.tests.test_classlookup.ProxyTestCase.test_proxy_reuse lxml.tests.test_classlookup.ProxyTestCase-class.html#test_proxy_reuse +lxml.tests.test_css.CSSTestCase lxml.tests.test_css.CSSTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_css.CSSTestCase.pytestmark lxml.tests.test_css.CSSTestCase-class.html#pytestmark +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_css.CSSTestCase.test_cssselect lxml.tests.test_css.CSSTestCase-class.html#test_cssselect +lxml.tests.test_doctestcompare.DoctestCompareTest lxml.tests.test_doctestcompare.DoctestCompareTest-class.html +lxml.tests.test_doctestcompare.DoctestCompareTest.test_missing_attributes lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_missing_attributes +lxml.tests.test_doctestcompare.DoctestCompareTest.test_differing_tags lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_differing_tags +lxml.tests.test_doctestcompare.DoctestCompareTest.test_tags_upper_lower_case lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_tags_upper_lower_case +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_doctestcompare.DoctestCompareTest.assert_diff lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#assert_diff +lxml.tests.test_doctestcompare.DoctestCompareTest.test_differing_attributes lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_differing_attributes +lxml.tests.test_doctestcompare.DoctestCompareTest._checker lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#_checker +lxml.tests.test_doctestcompare.DoctestCompareTest.test_equal_input lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_equal_input +lxml.tests.test_doctestcompare.DoctestCompareTest.test_missing_children lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_missing_children +lxml.tests.test_doctestcompare.DoctestCompareTest.test_extra_children lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_extra_children +lxml.tests.test_doctestcompare.DoctestCompareTest.test_tags_upper_lower_case_html lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_tags_upper_lower_case_html +lxml.tests.test_doctestcompare.DoctestCompareTest.test_extra_attributes lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#test_extra_attributes +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_doctestcompare.DoctestCompareTest.assert_nodiff lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#assert_nodiff +lxml.tests.test_doctestcompare.DoctestCompareTest.compare lxml.tests.test_doctestcompare.DoctestCompareTest-class.html#compare +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_doctestcompare.DummyInput lxml.tests.test_doctestcompare.DummyInput-class.html +lxml.tests.test_doctestcompare.DummyInput.__init__ lxml.tests.test_doctestcompare.DummyInput-class.html#__init__ +lxml.tests.test_dtd.ETreeDtdTestCase lxml.tests.test_dtd.ETreeDtdTestCase-class.html +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_declaration_escape_quote_pid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_declaration_escape_quote_pid +lxml.tests.test_dtd.ETreeDtdTestCase.test_internal_dtds lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_internal_dtds +lxml.tests.test_dtd.ETreeDtdTestCase.test_iterparse_file_dtd_start lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_iterparse_file_dtd_start +lxml.tests.test_dtd.ETreeDtdTestCase.test_comment_before_dtd lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_comment_before_dtd +lxml.tests.test_dtd.ETreeDtdTestCase.test_clean_doctype lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_clean_doctype +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_api_internal lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_api_internal +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_invalid_duplicate_id lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_invalid_duplicate_id +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_valid_file_url lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_valid_file_url +lxml.tests.test_dtd.ETreeDtdTestCase.test_iterparse_file_dtd_end lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_iterparse_file_dtd_end +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_stringio lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_stringio +lxml.tests.test_dtd.ETreeDtdTestCase.test_declaration_quote_withoutpid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_declaration_quote_withoutpid +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_assertValid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_assertValid +lxml.tests.test_dtd.ETreeDtdTestCase.test_declaration_apos lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_declaration_apos +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_dtd.ETreeDtdTestCase.test_set_decl_public lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_set_decl_public +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_attrs lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_attrs +lxml.tests.test_dtd.ETreeDtdTestCase.test_set_decl_system lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_set_decl_system +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_valid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_valid +lxml.tests.test_dtd.ETreeDtdTestCase.test_html_decl lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_html_decl +lxml.tests.test_dtd.ETreeDtdTestCase.test_ietf_decl lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_ietf_decl +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.case.TestCase.failureException exceptions.AssertionError-class.html +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_empty_decl lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_empty_decl +lxml.tests.test_dtd.ETreeDtdTestCase.test_invalid_decl_1 lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_invalid_decl_1 +lxml.tests.test_dtd.ETreeDtdTestCase.test_invalid_decl_2 lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_invalid_decl_2 +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_internal lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_internal +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_parse_valid_relative_file_url lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_valid_relative_file_url +lxml.tests.test_elementpath.EtreeElementPathTestCase lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html +lxml.tests.test_elementpath.EtreeElementPathTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_elementpath.EtreeElementPathTestCase.test_find lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#test_find +lxml.tests.test_elementpath.EtreeElementPathTestCase.test_tokenizer_predicates lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#test_tokenizer_predicates +lxml.tests.test_elementpath.EtreeElementPathTestCase.test_xpath_tokenizer lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#test_xpath_tokenizer +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_elementpath.EtreeElementPathTestCase.test_tokenizer lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#test_tokenizer +lxml.tests.test_elementpath.EtreeElementPathTestCase.test_cache lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#test_cache +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementpath.EtreeElementPathTestCase._assert_tokens lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html#_assert_tokens +lxml.tests.test_elementtree.CElementTreeElementSlicingTest lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_negative_steps +lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html#etree +lxml.tests.test_elementtree._ElementSlicingTest._make_elem_with_children lxml.tests.test_elementtree._ElementSlicingTest-class.html#_make_elem_with_children +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_single_index +lxml.tests.test_elementtree._ElementSlicingTest._subelem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_subelem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_negative_steps +lxml.tests.test_elementtree._ElementSlicingTest._elem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_elem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_single_index +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_delslice lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_delslice +lxml.tests.test_elementtree.CElementTreeTestCase lxml.tests.test_elementtree.CElementTreeTestCase-class.html +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_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_setslice_end_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end_exact +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_iterparse_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_namespace_roundtrip lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra_duplicate lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra_duplicate +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start_and_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start_and_close +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_getiterator_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_empty +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_parser_target_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_interface lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_interface +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_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_write_method_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_dict lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_dict +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_itertext_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext_child +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_attribute_namespace_roundtrip_replaced lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip_replaced +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_crash lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_crash +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_parse_encoding_8bit_explicit lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +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_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder +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_treebuilder_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_close +lxml.tests.test_elementtree._ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree._ETreeTestCaseBase.test_insert_name_interning lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_insert_name_interning +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_attrib_copy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_copy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_register_namespace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_register_namespace +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_set_tail_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_set_tail_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_unicode lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_unicode +lxml.tests.test_elementtree._ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_end +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.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_feed_parser_error_close_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +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_treebuilder_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree._ETreeTestCaseBase.assertRegex lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertRegex +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attrib +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_iterparse_large lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items +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_delslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice +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_deepcopy_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_comment +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_subelement_with_attributes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration +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._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_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.CElementTreeTestCase.etree lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree +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_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_subelement_with_attributes_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +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_qname_attribute_getset lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_empty +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_deepcopy_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_start_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_start_end_ns +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_encoding_8bit_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +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_wrong_unicode_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +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_itertext lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext +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_getiterator_filter_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_property lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_property +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_only_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_only_end_ns +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree._ETreeTestCaseBase.test_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree._ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_element_tree +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_delitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_while_iterating lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_while_iterating +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._rootstring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_rootstring +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_iterparse_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_str +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_ns_decl_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_decl_tostring +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_setslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_append +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_del_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra +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_write_ElementTreeDoctest lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree._ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start +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.test_weird_dict_interaction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter_remove_tail +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_set_text2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_clear_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_clear_tail +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_write_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_html +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_element_contains lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree._ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text +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_attribute_items_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items_ns +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_setitem_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_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_element_boolean lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_element_boolean +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.XMLParser lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#XMLParser +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_treebuilder_pi lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_pi +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text +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_attribute_keys lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys +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_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_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_getiterator_filter_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_all +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_clear_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_clear_sub +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_delslice_step_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getchildren lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getchildren +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_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_attribute_set lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_set +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_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_encoding_tostring_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items2 +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_tail_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_str_subclass +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_encoding_write_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem +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_text_escape_out lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_get +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_elementtree_parser_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_elementtree_parser_target +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_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.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_as_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_as_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative2 +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_deepcopy_namespaces lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_namespaces +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_parse_file_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_manipulation +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_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring +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_tostring_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring_method_html +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_tag_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree._ETreeTestCaseBase.required_versions_ET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_ET +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.test_iterparse_set_ns_attribute lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_set_ns_attribute +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_incomplete +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_bytes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_bytes +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_setslice_all_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree._ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_wildcard lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_wildcard +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attributes_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attributes_get +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_tag_write lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_write +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_error_from_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_error_from_file +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_setslice_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_setting +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_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_end_ns +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_tail_elementtree_root lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_elementtree_root +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_late_tail_mix_pi_comments lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail_mix_pi_comments +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_iteration_text_only lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_text_only +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_attribute_update_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_update_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_pi_nonsense +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.required_versions_cET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_cET +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_getslice_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice_text +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_getiterator_filter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative +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_iteration_del_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setitem +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_ns +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_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +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_setitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree._ETreeTestCaseBase.assertXML lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree._ETreeTestCaseBase.test_late_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail +lxml.tests.test_elementtree._ETreeTestCaseBase._check_string lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_string +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_attrib_deepcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_deepcopy +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.ETreeC14N2TostringTest lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html +lxml.tests.test_elementtree.ETreeC14N2TostringTest._canonicalize lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html#_canonicalize +lxml.tests.test_elementtree._C14NTest.c14n_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#c14n_roundtrip +lxml.tests.test_elementtree.ETreeC14NTest.etree lxml.etree-module.html +lxml.tests.test_elementtree._C14NTest.test_c14n_exclusion lxml.tests.test_elementtree._C14NTest-class.html#test_c14n_exclusion +lxml.tests.test_elementtree._C14NTest.test_simple_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#test_simple_roundtrip +lxml.tests.test_elementtree._C14NTest.maxDiff lxml.tests.test_elementtree._C14NTest-class.html#maxDiff +lxml.tests.test_elementtree._C14NTest.subTest lxml.tests.test_elementtree._C14NTest-class.html#subTest +lxml.tests.test_elementtree._C14NTest.test_xml_c14n2 lxml.tests.test_elementtree._C14NTest-class.html#test_xml_c14n2 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ETreeC14N2WriteTest lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html +lxml.tests.test_elementtree.ETreeC14N2WriteTest._canonicalize lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html#_canonicalize +lxml.tests.test_elementtree._C14NTest.c14n_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#c14n_roundtrip +lxml.tests.test_elementtree.ETreeC14NTest.etree lxml.etree-module.html +lxml.tests.test_elementtree._C14NTest.test_c14n_exclusion lxml.tests.test_elementtree._C14NTest-class.html#test_c14n_exclusion +lxml.tests.test_elementtree._C14NTest.test_simple_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#test_simple_roundtrip +lxml.tests.test_elementtree._C14NTest.maxDiff lxml.tests.test_elementtree._C14NTest-class.html#maxDiff +lxml.tests.test_elementtree._C14NTest.subTest lxml.tests.test_elementtree._C14NTest-class.html#subTest +lxml.tests.test_elementtree._C14NTest.test_xml_c14n2 lxml.tests.test_elementtree._C14NTest-class.html#test_xml_c14n2 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ETreeC14NTest lxml.tests.test_elementtree.ETreeC14NTest-class.html +lxml.tests.test_elementtree._C14NTest._canonicalize lxml.tests.test_elementtree._C14NTest-class.html#_canonicalize +lxml.tests.test_elementtree._C14NTest.c14n_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#c14n_roundtrip +lxml.tests.test_elementtree.ETreeC14NTest.etree lxml.etree-module.html +lxml.tests.test_elementtree._C14NTest.test_c14n_exclusion lxml.tests.test_elementtree._C14NTest-class.html#test_c14n_exclusion +lxml.tests.test_elementtree._C14NTest.test_simple_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#test_simple_roundtrip +lxml.tests.test_elementtree._C14NTest.maxDiff lxml.tests.test_elementtree._C14NTest-class.html#maxDiff +lxml.tests.test_elementtree._C14NTest.subTest lxml.tests.test_elementtree._C14NTest-class.html#subTest +lxml.tests.test_elementtree._C14NTest.test_xml_c14n2 lxml.tests.test_elementtree._C14NTest-class.html#test_xml_c14n2 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ETreeElementSlicingTest lxml.tests.test_elementtree.ETreeElementSlicingTest-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_negative_steps +lxml.tests.test_elementtree.ETreeElementSlicingTest.etree lxml.etree-module.html +lxml.tests.test_elementtree._ElementSlicingTest._make_elem_with_children lxml.tests.test_elementtree._ElementSlicingTest-class.html#_make_elem_with_children +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_single_index +lxml.tests.test_elementtree._ElementSlicingTest._subelem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_subelem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_negative_steps +lxml.tests.test_elementtree._ElementSlicingTest._elem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_elem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_single_index +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_delslice lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_delslice +lxml.tests.test_elementtree.ETreePullTestCase lxml.tests.test_elementtree.ETreePullTestCase-class.html +lxml.tests.test_elementtree.ETreePullTestCase.etree lxml.etree-module.html +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_start lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_start +lxml.tests.test_elementtree._XMLPullParserTest.assert_event_tuples lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_event_tuples +lxml.tests.test_elementtree._XMLPullParserTest.test_feed_while_iterating lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_feed_while_iterating +lxml.tests.test_elementtree._XMLPullParserTest.test_events_sequence lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_sequence +lxml.tests.test_elementtree._XMLPullParserTest.assert_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_events +lxml.tests.test_elementtree._XMLPullParserTest.test_simple_xml_with_ns lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_simple_xml_with_ns +lxml.tests.test_elementtree._XMLPullParserTest._feed lxml.tests.test_elementtree._XMLPullParserTest-class.html#_feed +lxml.tests.test_elementtree._XMLPullParserTest.test_events_pi lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_pi +lxml.tests.test_elementtree._XMLPullParserTest._close_and_return_root lxml.tests.test_elementtree._XMLPullParserTest-class.html#_close_and_return_root +lxml.tests.test_elementtree._XMLPullParserTest.test_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events +lxml.tests.test_elementtree._XMLPullParserTest.test_unknown_event lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_unknown_event +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_end_ns_only lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_end_ns_only +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_start_end lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_start_end +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events +lxml.tests.test_elementtree._XMLPullParserTest.test_simple_xml lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_simple_xml +lxml.tests.test_elementtree._XMLPullParserTest.test_events_comment lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_comment +lxml.tests.test_elementtree._XMLPullParserTest.assert_event_tags lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_event_tags +lxml.tests.test_elementtree.ETreeTestCase lxml.tests.test_elementtree.ETreeTestCase-class.html +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_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_setslice_end_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end_exact +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_iterparse_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_namespace_roundtrip lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra_duplicate lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra_duplicate +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start_and_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start_and_close +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_getiterator_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_empty +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_parser_target_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_interface lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_interface +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_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_write_method_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_dict lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_dict +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_itertext_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext_child +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_attribute_namespace_roundtrip_replaced lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip_replaced +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_crash lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_crash +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_parse_encoding_8bit_explicit lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +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_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder +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_treebuilder_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_close +lxml.tests.test_elementtree._ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree._ETreeTestCaseBase.test_insert_name_interning lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_insert_name_interning +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_attrib_copy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_copy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_register_namespace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_register_namespace +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_set_tail_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_set_tail_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_unicode lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_unicode +lxml.tests.test_elementtree._ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_end +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.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_feed_parser_error_close_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +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_treebuilder_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree._ETreeTestCaseBase.assertRegex lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertRegex +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attrib +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_iterparse_large lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items +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_delslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice +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_deepcopy_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_comment +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_subelement_with_attributes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration +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._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_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.ETreeTestCase.etree lxml.etree-module.html +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_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_subelement_with_attributes_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +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_qname_attribute_getset lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_empty +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_deepcopy_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_start_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_start_end_ns +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_encoding_8bit_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +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_wrong_unicode_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +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_itertext lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext +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_getiterator_filter_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_property lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_property +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_only_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_only_end_ns +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree._ETreeTestCaseBase.test_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree._ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_element_tree +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_delitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_while_iterating lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_while_iterating +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._rootstring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_rootstring +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_iterparse_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_str +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_ns_decl_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_decl_tostring +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_setslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_append +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_del_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra +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_write_ElementTreeDoctest lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree._ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start +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.test_weird_dict_interaction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter_remove_tail +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_set_text2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_clear_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_clear_tail +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_write_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_html +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_element_contains lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree._ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text +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_attribute_items_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items_ns +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_setitem_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_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_element_boolean lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_element_boolean +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.XMLParser lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#XMLParser +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_treebuilder_pi lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_pi +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text +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_attribute_keys lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys +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_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_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_getiterator_filter_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_all +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_clear_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_clear_sub +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_delslice_step_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getchildren lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getchildren +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_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_attribute_set lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_set +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_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_encoding_tostring_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items2 +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_tail_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_str_subclass +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_encoding_write_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem +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_text_escape_out lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_get +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_elementtree_parser_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_elementtree_parser_target +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_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.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_as_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_as_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative2 +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_deepcopy_namespaces lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_namespaces +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_parse_file_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_manipulation +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_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring +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_tostring_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring_method_html +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_tag_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree._ETreeTestCaseBase.required_versions_ET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_ET +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.test_iterparse_set_ns_attribute lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_set_ns_attribute +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_incomplete +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_bytes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_bytes +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_setslice_all_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree._ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_wildcard lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_wildcard +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attributes_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attributes_get +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_tag_write lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_write +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_error_from_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_error_from_file +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_setslice_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_setting +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_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_end_ns +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_tail_elementtree_root lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_elementtree_root +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_late_tail_mix_pi_comments lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail_mix_pi_comments +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_iteration_text_only lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_text_only +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_attribute_update_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_update_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_pi_nonsense +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.required_versions_cET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_cET +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_getslice_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice_text +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_getiterator_filter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative +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_iteration_del_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setitem +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_ns +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_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +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_setitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree._ETreeTestCaseBase.assertXML lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree._ETreeTestCaseBase.test_late_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail +lxml.tests.test_elementtree._ETreeTestCaseBase._check_string lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_string +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_attrib_deepcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_deepcopy +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.ElementTreeElementSlicingTest lxml.tests.test_elementtree.ElementTreeElementSlicingTest-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_negative_steps +lxml.tests.test_elementtree.ElementTreeElementSlicingTest.etree xml.etree.ElementTree-module.html +lxml.tests.test_elementtree._ElementSlicingTest._make_elem_with_children lxml.tests.test_elementtree._ElementSlicingTest-class.html#_make_elem_with_children +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_single_index +lxml.tests.test_elementtree._ElementSlicingTest._subelem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_subelem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_negative_steps +lxml.tests.test_elementtree._ElementSlicingTest._elem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_elem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_single_index +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_delslice lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_delslice +lxml.tests.test_elementtree.ElementTreeTestCase lxml.tests.test_elementtree.ElementTreeTestCase-class.html +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_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_setslice_end_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end_exact +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_iterparse_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_namespace_roundtrip lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra_duplicate lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra_duplicate +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start_and_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start_and_close +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_getiterator_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_empty +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_parser_target_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_interface lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_interface +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_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_write_method_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_dict lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_dict +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_itertext_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext_child +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_attribute_namespace_roundtrip_replaced lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip_replaced +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_crash lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_crash +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_parse_encoding_8bit_explicit lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +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_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder +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_treebuilder_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_close +lxml.tests.test_elementtree._ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree._ETreeTestCaseBase.test_insert_name_interning lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_insert_name_interning +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_attrib_copy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_copy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_register_namespace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_register_namespace +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_set_tail_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_set_tail_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_unicode lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_unicode +lxml.tests.test_elementtree.ElementTreeTestCase.setUpClass lxml.tests.test_elementtree.ElementTreeTestCase-class.html#setUpClass +lxml.tests.test_elementtree._ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_end +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.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_feed_parser_error_close_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +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_treebuilder_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree._ETreeTestCaseBase.assertRegex lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertRegex +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attrib +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_iterparse_large lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items +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_delslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice +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_deepcopy_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_comment +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_subelement_with_attributes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration +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._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_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.ElementTreeTestCase.etree xml.etree.ElementTree-module.html +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_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_subelement_with_attributes_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +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_qname_attribute_getset lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_empty +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_deepcopy_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_start_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_start_end_ns +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_encoding_8bit_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +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_wrong_unicode_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +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_itertext lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext +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_getiterator_filter_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_property lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_property +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_only_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_only_end_ns +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree._ETreeTestCaseBase.test_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree._ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_element_tree +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_delitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_while_iterating lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_while_iterating +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._rootstring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_rootstring +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_iterparse_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_str +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_ns_decl_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_decl_tostring +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_setslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_append +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_del_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra +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_write_ElementTreeDoctest lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree._ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start +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.test_weird_dict_interaction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter_remove_tail +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_set_text2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_clear_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_clear_tail +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_write_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_html +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_element_contains lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree._ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text +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_attribute_items_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items_ns +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_setitem_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_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_element_boolean lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_element_boolean +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.XMLParser lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#XMLParser +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_treebuilder_pi lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_pi +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text +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_attribute_keys lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys +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_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_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_getiterator_filter_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_all +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_clear_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_clear_sub +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_delslice_step_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getchildren lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getchildren +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_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_attribute_set lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_set +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_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_encoding_tostring_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items2 +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_tail_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_str_subclass +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_encoding_write_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem +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_text_escape_out lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_get +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_elementtree_parser_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_elementtree_parser_target +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_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.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_as_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_as_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative2 +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_deepcopy_namespaces lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_namespaces +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_parse_file_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_manipulation +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_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring +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_tostring_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring_method_html +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_tag_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree._ETreeTestCaseBase.required_versions_ET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_ET +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.test_iterparse_set_ns_attribute lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_set_ns_attribute +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_incomplete +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_bytes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_bytes +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_setslice_all_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree._ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_wildcard lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_wildcard +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attributes_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attributes_get +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_tag_write lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_write +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_error_from_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_error_from_file +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_setslice_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_setting +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_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_end_ns +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_tail_elementtree_root lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_elementtree_root +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_late_tail_mix_pi_comments lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail_mix_pi_comments +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_iteration_text_only lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_text_only +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_attribute_update_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_update_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_pi_nonsense +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.required_versions_cET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_cET +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_getslice_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice_text +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_getiterator_filter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative +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_iteration_del_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setitem +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_ns +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_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +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_setitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree._ETreeTestCaseBase.assertXML lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree._ETreeTestCaseBase.test_late_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail +lxml.tests.test_elementtree._ETreeTestCaseBase._check_string lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_string +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_attrib_deepcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_deepcopy +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._C14NTest lxml.tests.test_elementtree._C14NTest-class.html +lxml.tests.test_elementtree._C14NTest._canonicalize lxml.tests.test_elementtree._C14NTest-class.html#_canonicalize +lxml.tests.test_elementtree._C14NTest.c14n_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#c14n_roundtrip +lxml.tests.test_elementtree._C14NTest.etree lxml.tests.test_elementtree._C14NTest-class.html#etree +lxml.tests.test_elementtree._C14NTest.test_c14n_exclusion lxml.tests.test_elementtree._C14NTest-class.html#test_c14n_exclusion +lxml.tests.test_elementtree._C14NTest.test_simple_roundtrip lxml.tests.test_elementtree._C14NTest-class.html#test_simple_roundtrip +lxml.tests.test_elementtree._C14NTest.maxDiff lxml.tests.test_elementtree._C14NTest-class.html#maxDiff +lxml.tests.test_elementtree._C14NTest.subTest lxml.tests.test_elementtree._C14NTest-class.html#subTest +lxml.tests.test_elementtree._C14NTest.test_xml_c14n2 lxml.tests.test_elementtree._C14NTest-class.html#test_xml_c14n2 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._ETreeTestCaseBase lxml.tests.test_elementtree._ETreeTestCaseBase-class.html +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_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_setslice_end_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end_exact +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_iterparse_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_namespace_roundtrip lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra_duplicate lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra_duplicate +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start_and_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start_and_close +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_getiterator_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_empty +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_parser_target_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_attrib +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_findall_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_subelement_reference lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_reference +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_write_method_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_dict lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_dict +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_setslice_all lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all +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_attribute_namespace_roundtrip_replaced lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_namespace_roundtrip_replaced +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_crash lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_crash +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_parse_encoding_8bit_explicit lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +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_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +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_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_treebuilder_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_close lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_close +lxml.tests.test_elementtree._ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree._ETreeTestCaseBase.test_insert_name_interning lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_insert_name_interning +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_attrib_copy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_copy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_register_namespace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_register_namespace +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_set_tail_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_set_tail_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_unicode lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_unicode +lxml.tests.test_elementtree._ETreeTestCaseBase.test_interface lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_interface +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_parser_target_error_in_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_end +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.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_feed_parser_error_close_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +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_treebuilder_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree._ETreeTestCaseBase.assertRegex lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertRegex +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attrib +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_iterparse_large lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items +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_delslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice +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_deepcopy_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_comment +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_subelement_with_attributes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration +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._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_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.etree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#etree +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_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_subelement_with_attributes_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +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_qname_attribute_getset lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_empty +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_deepcopy_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_start_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_start_end_ns +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_encoding_8bit_parse_stringio lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +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_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_itertext lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_itertext +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_getiterator_filter_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_property lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_property +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_only_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_only_end_ns +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree._ETreeTestCaseBase.test_comment lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree._ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_element_tree +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_delitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_while_iterating lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_while_iterating +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._rootstring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_rootstring +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_iterparse_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_str +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_elementtree_parser_target lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_elementtree_parser_target +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_setslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_append +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_iter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element_with_attributes_extra lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_with_attributes_extra +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_write_ElementTreeDoctest lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +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_access2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_error_in_start lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_error_in_start +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.test_tag_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree._ETreeTestCaseBase.test_element lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iter_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iter_remove_tail +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_set_text2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iteration_clear_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_clear_tail +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_del_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setslice +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_element_contains lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree._ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_set_text +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_attribute_items_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items_ns +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_setitem_replace lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_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_element_boolean lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_element_boolean +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.XMLParser lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#XMLParser +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_treebuilder_pi lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_treebuilder_pi +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text +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_attribute_keys lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_keys +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_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_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_setslice_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_negative +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_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_delslice_step_negative lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree._ETreeTestCaseBase.test_getchildren lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getchildren +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_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_attribute_set lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_set +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_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_encoding_tostring_sub lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_items2 +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_tail_str_subclass lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_str_subclass +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_encoding_write_default_encoding lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delitem +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_text_escape_out lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_get +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_iterparse_move_elements lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_move_elements +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.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_as_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_as_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_negative2 +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_deepcopy_namespaces lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_deepcopy_namespaces +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_attribute_manipulation lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_manipulation +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_tostring lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring +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_tostring_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tostring_method_html +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_weird_dict_interaction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree._ETreeTestCaseBase.required_versions_ET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_ET +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.test_iterparse_set_ns_attribute lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_set_ns_attribute +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.test_elementtree._ETreeTestCaseBase._test_del_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_iterparse_incomplete lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iterparse_incomplete +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree._ETreeTestCaseBase.test_feed_parser_bytes lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_feed_parser_bytes +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_write_method_html lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_write_method_html +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._check_mapping lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree._ETreeTestCaseBase.test_findall_wildcard lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_findall_wildcard +lxml.tests.test_elementtree._ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree._ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_attributes_get lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attributes_get +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_tag_write lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tag_write +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_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_late_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_ns_setting +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_remove_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parser_target_end_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parser_target_end_ns +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_tail_elementtree_root lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_tail_elementtree_root +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_late_tail_mix_pi_comments lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_late_tail_mix_pi_comments +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_iteration_text_only lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_text_only +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_attribute_update_attrib lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attribute_update_attrib +lxml.tests.test_elementtree._ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_pi_nonsense +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.required_versions_cET lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#required_versions_cET +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_getslice_text lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getslice_text +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_getiterator_filter lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree._ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_qname_cmp +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_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_iteration_del_child lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree._ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree._ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_del_setitem +lxml.tests.test_elementtree._ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_remove_ns +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_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +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_setitem_tail lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree._ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree._ETreeTestCaseBase.assertXML lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree._ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree._ETreeTestCaseBase._check_string lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#_check_string +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_attrib_deepcopy lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#test_attrib_deepcopy +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._ElementSlicingTest lxml.tests.test_elementtree._ElementSlicingTest-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_negative_steps +lxml.tests.test_elementtree._ElementSlicingTest.etree lxml.tests.test_elementtree._ElementSlicingTest-class.html#etree +lxml.tests.test_elementtree._ElementSlicingTest._make_elem_with_children lxml.tests.test_elementtree._ElementSlicingTest-class.html#_make_elem_with_children +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_single_index +lxml.tests.test_elementtree._ElementSlicingTest._subelem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_subelem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_negative_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_negative_steps +lxml.tests.test_elementtree._ElementSlicingTest._elem_tags lxml.tests.test_elementtree._ElementSlicingTest-class.html#_elem_tags +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_single_index lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_single_index +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._ElementSlicingTest.test_setslice_range lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_setslice_range +lxml.tests.test_elementtree._ElementSlicingTest.test_getslice_steps lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_getslice_steps +lxml.tests.test_elementtree._ElementSlicingTest.test_delslice lxml.tests.test_elementtree._ElementSlicingTest-class.html#test_delslice +lxml.tests.test_elementtree._XMLPullParserTest lxml.tests.test_elementtree._XMLPullParserTest-class.html +lxml.tests.test_elementtree._XMLPullParserTest.etree lxml.tests.test_elementtree._XMLPullParserTest-class.html#etree +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_start lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_start +lxml.tests.test_elementtree._XMLPullParserTest.assert_event_tuples lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_event_tuples +lxml.tests.test_elementtree._XMLPullParserTest.test_feed_while_iterating lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_feed_while_iterating +lxml.tests.test_elementtree._XMLPullParserTest.test_events_sequence lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_sequence +lxml.tests.test_elementtree._XMLPullParserTest.assert_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_events +lxml.tests.test_elementtree._XMLPullParserTest.test_simple_xml_with_ns lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_simple_xml_with_ns +lxml.tests.test_elementtree._XMLPullParserTest._feed lxml.tests.test_elementtree._XMLPullParserTest-class.html#_feed +lxml.tests.test_elementtree._XMLPullParserTest.test_events_pi lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_pi +lxml.tests.test_elementtree._XMLPullParserTest._close_and_return_root lxml.tests.test_elementtree._XMLPullParserTest-class.html#_close_and_return_root +lxml.tests.test_elementtree._XMLPullParserTest.test_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events +lxml.tests.test_elementtree._XMLPullParserTest.test_unknown_event lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_unknown_event +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_end_ns_only lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_end_ns_only +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events_start_end lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events_start_end +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree._XMLPullParserTest.test_ns_events lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_ns_events +lxml.tests.test_elementtree._XMLPullParserTest.test_simple_xml lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_simple_xml +lxml.tests.test_elementtree._XMLPullParserTest.test_events_comment lxml.tests.test_elementtree._XMLPullParserTest-class.html#test_events_comment +lxml.tests.test_elementtree._XMLPullParserTest.assert_event_tags lxml.tests.test_elementtree._XMLPullParserTest-class.html#assert_event_tags +lxml.tests.test_errors.ErrorTestCase lxml.tests.test_errors.ErrorTestCase-class.html +lxml.tests.test_errors.ErrorTestCase.etree lxml.etree-module.html +lxml.tests.test_errors.ErrorTestCase.test_empty_parse lxml.tests.test_errors.ErrorTestCase-class.html#test_empty_parse +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_errors.ErrorTestCase.test_bad_element lxml.tests.test_errors.ErrorTestCase-class.html#test_bad_element +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_errors.ErrorTestCase.test_xmlsyntaxerror_has_info lxml.tests.test_errors.ErrorTestCase-class.html#test_xmlsyntaxerror_has_info +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_etree.ETreeC14NTestCase lxml.tests.test_etree.ETreeC14NTestCase-class.html +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_tostring_inclusive_ns_prefixes lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_tostring_inclusive_ns_prefixes +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_tostring_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_tostring_with_comments +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.test_etree.ETreeC14NTestCase.test_c14n2_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n2_with_comments +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_element_tostring_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_element_tostring_with_comments +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n2_with_text lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n2_with_text +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_with_comments +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_element_tostring_exclusive lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_element_tostring_exclusive +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_tostring_exclusive lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_tostring_exclusive +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_file lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_file +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n2_file_gzip lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n2_file_gzip +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n2_tostring_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n2_tostring_with_comments +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_file_gzip lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_file_gzip +lxml.tests.test_etree.ETreeErrorLogTest lxml.tests.test_etree.ETreeErrorLogTest-class.html +lxml.tests.test_etree.ETreeErrorLogTest.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.ETreeErrorLogTest._test_python_error_logging lxml.tests.test_etree.ETreeErrorLogTest-class.html#_test_python_error_logging +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.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +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_unicode_byte_invalid_sequence lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_unicode_byte_invalid_sequence +lxml.tests.test_etree.ETreeOnlyTestCase._writeElement lxml.tests.test_etree.ETreeOnlyTestCase-class.html#_writeElement +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_addprevious lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_pis_comments_tree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_pis_comments_tree +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_attribute_gets_namespace_prefix_on_merge lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_gets_namespace_prefix_on_merge +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_end_skip lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_end_skip +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag_multiple_reversed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag_multiple_reversed +lxml.tests.test_etree.ETreeOnlyTestCase.test_append_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_append_error +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_standalone lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_standalone +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_cycle_long lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_cycle_long +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_broken lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_broken +lxml.tests.test_etree.ETreeOnlyTestCase.test_findall_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_findall_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_comments_tree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_comments_tree +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_empty +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_iterparse_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag +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_attribute_set_nonstring lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_set_nonstring +lxml.tests.test_etree.ETreeOnlyTestCase.test_itersiblings_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itersiblings_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_cycle_long lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_cycle_long +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start_end_skip lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start_end_skip +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_addnext_cycle lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_cycle +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_element_names lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_names +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_strip_attributes lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_attributes +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_parse_fileobject_unicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_fileobject_unicode +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tag_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_tags_pi_comment_all lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags_pi_comment_all +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_parser_type_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_parser_type_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_encoding_tostring_utf16 lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_encoding_tostring_utf16 +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_cdata_errors lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_errors +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_output_override lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_doctype_output_override +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterdescendants_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterdescendants_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_name_only lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_name_only +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_refcycle lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_refcycle +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_include_paths lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_include_paths +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_empty +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_attribute_keeps_namespace_prefix_on_merge_with_nons lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_keeps_namespace_prefix_on_merge_with_nons +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_pis_comments_tree_no_events lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_pis_comments_tree_no_events +lxml.tests.test_etree.ETreeOnlyTestCase.test_deepcopy_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_deepcopy_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_tags_doc_style lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags_doc_style +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterancestors_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterancestors_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_dtd_io lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_dtd_io +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterancestors lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterancestors +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_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_dump_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_dump_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_has_key lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_has_key +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.test_namespaces_elementtree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_elementtree +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_multiple_tuple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_multiple_tuple +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_pi_pseudo_attributes_get lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi_pseudo_attributes_get +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_getiterator_filter_all_comment_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_all_comment_pi +lxml.tests.test_etree.ETreeOnlyTestCase.etree lxml.etree-module.html +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tag_ns_all lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag_ns_all +lxml.tests.test_etree.ETreeOnlyTestCase.test_pi_pseudo_attributes_attrib lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi_pseudo_attributes_attrib +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_XMLDTDID_no_id_dict lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XMLDTDID_no_id_dict +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_pis_root_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_pis_root_element +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_parse_remove_pis lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_remove_pis +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup_deep_to_top lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_deep_to_top +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_comment_immutable lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_immutable +lxml.tests.test_etree.ETreeOnlyTestCase.test_getnext lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getnext +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_feed_exception lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_feed_exception +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_parse lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_tail +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup +lxml.tests.test_etree.ETreeOnlyTestCase.test_feed_parser_recover_no_id_dict lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_feed_parser_recover_no_id_dict +lxml.tests.test_etree.ETreeOnlyTestCase.test_getparent lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getparent +lxml.tests.test_etree.ETreeOnlyTestCase.test_html_prefix_nsmap lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_html_prefix_nsmap +lxml.tests.test_etree.ETreeOnlyTestCase.test_clear_keep_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_clear_keep_tail +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_element_nsmap lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_nsmap +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_addnext_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_clear lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_clear +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_replace_new lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_replace_new +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_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_findall_syntax_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_findall_syntax_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_default lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_default +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_broken_recover lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_broken_recover +lxml.tests.test_etree.ETreeOnlyTestCase.test_XMLDTDID lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XMLDTDID +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_local_name lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_local_name +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_method_text_encoding lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_method_text_encoding +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeOnlyTestCase.test_XMLDTDID_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XMLDTDID_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag_posarg lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag_posarg +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_elementtree_getelementpath_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_getelementpath_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_c_api lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_c_api +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_pis_tree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_pis_tree +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_parser_encoding lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_encoding +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_default_and_other lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_default_and_other +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_setslice_all_reversed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_all_reversed +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_iterchildren_tag_multiple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag_multiple +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start_end_tags_with_root lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start_end_tags_with_root +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_append_parsed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_append_parsed +lxml.tests.test_etree.ETreeOnlyTestCase.test_index lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_index +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_iterancestors_tag_multiple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterancestors_tag_multiple +lxml.tests.test_etree.ETreeOnlyTestCase.test_byte_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_byte_invalid +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_step lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step +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_itertext_comment_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itertext_comment_pi +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_elementtree_findall_ns_qname lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_findall_ns_qname +lxml.tests.test_etree.ETreeOnlyTestCase.test_large_sourceline_XML lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_large_sourceline_XML +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag_multiple_posarg lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag_multiple_posarg +lxml.tests.test_etree.ETreeOnlyTestCase.test_xml_base lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_xml_base +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_tostring_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_parseid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parseid +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_cdata_type lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_type +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_with_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_with_tail +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_tags_and_remove lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags_and_remove +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_itersiblings_tag_multiple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itersiblings_tag_multiple +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterdescendants_tag_multiple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterdescendants_tag_multiple +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_strip_elements lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_elements +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_method_html_with_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_method_html_with_tail +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren +lxml.tests.test_etree.ETreeOnlyTestCase.test_pi_parse lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi_parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_deepcopy_pi_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_deepcopy_pi_dtd +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_iterparse_pis lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_pis +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_space lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_space +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_namespace_cleanup_keep_prefixes lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_keep_prefixes +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_ns_skip lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_ns_skip +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_XML lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_XML +lxml.tests.test_etree.ETreeOnlyTestCase.test_proxy_collect_siblings lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_proxy_collect_siblings +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_itersiblings lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itersiblings +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup_attributes lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_attributes +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_set lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_set +lxml.tests.test_etree.ETreeOnlyTestCase.test_getroottree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getroottree +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_iterparse_tree_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tree_comments +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_getiterator_filter_namespace lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_namespace +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_parser lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_parser +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_system lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_system +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_colon lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_colon +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tag_ns_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag_ns_empty +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_proxy_collect_siblings_text lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_proxy_collect_siblings_text +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup_deep lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_deep +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_tounicode_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_none +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_XML_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XML_base_url_docinfo +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_setslice_step_negative lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step_negative +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_multiple lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_multiple +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_comment +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_version lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_version +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start_end_tags lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start_end_tags +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup_keep_prefixes_top lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_keep_prefixes_top +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_restructure lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_restructure +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_cycle lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_cycle +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_comments_root_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_comments_root_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_gets_namespace_prefix_on_merge_with_nons lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_gets_namespace_prefix_on_merge_with_nons +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_elementtree_getelementpath lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_getelementpath +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_parser_target_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_comment +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.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_addnext_noops lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_noops +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_immutable_attrib lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_immutable_attrib +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_register_namespace_xml lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_register_namespace_xml +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_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_append_recursive_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_append_recursive_error +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_resolve_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_error +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_iterwalk_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode_pretty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_pretty +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_pretty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_pretty +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_tags_pi_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags_pi_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_broken_multi_recover lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_broken_multi_recover +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_addprevious_noops lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_noops +lxml.tests.test_etree.ETreeOnlyTestCase.test_attrib_order lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attrib_order +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode +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_parser_target_fromstring_exception lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_fromstring_exception +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_values lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_values +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_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_element_name_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_name_empty +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_sourceline_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_xpath lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_xpath +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_feed_no_id_dict lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_feed_no_id_dict +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_getiterator_filter_entities lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_entities +lxml.tests.test_etree.ETreeOnlyTestCase.test_findall_different_nsmaps lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_findall_different_nsmaps +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_iterparse_tag_ns_empty_all lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag_ns_empty_all +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_public lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_public +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_attrib_and_keywords lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attrib_and_keywords +lxml.tests.test_etree.ETreeOnlyTestCase.test_getprevious lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getprevious +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_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_HTML_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_HTML_base_url_docinfo +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_findall_empty_prefix lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_findall_empty_prefix +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.test_etree.ETreeOnlyTestCase.test_resolve_filename_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_filename_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_pypy_proxy_collect lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pypy_proxy_collect +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_attribute_keeps_namespace_prefix_on_merge lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_keeps_namespace_prefix_on_merge +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_namespace_cleanup_many lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup_many +lxml.tests.test_etree.ETreeOnlyTestCase.test_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start_tags lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start_tags +lxml.tests.test_etree.ETreeWriteTestCase lxml.tests.test_etree.ETreeWriteTestCase-class.html +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzipfile_parse lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzipfile_parse +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.ETreeWriteTestCase.test_write lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write +lxml.tests.test_etree.ETreeWriteTestCase.test_write_gzip lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_gzip +lxml.tests.test_etree.ETreeWriteTestCase.test_write_doctype lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_doctype +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzip_parse lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzip_parse +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_url lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_url +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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzip lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzip +lxml.tests.test_etree.ETreeWriteTestCase.test_write_gzip_doctype lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_gzip_doctype +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeXIncludeTestCase lxml.tests.test_etree.ETreeXIncludeTestCase-class.html +lxml.tests.test_etree._XIncludeTestCase.test_xinclude_resolver_recursive lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_resolver_recursive +lxml.tests.test_etree.ETreeXIncludeTestCase.include lxml.tests.test_etree.ETreeXIncludeTestCase-class.html#include +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +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.case.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.test_etree._XIncludeTestCase.test_xinclude_text lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.test_etree.ElementIncludeTestCase lxml.tests.test_etree.ElementIncludeTestCase-class.html +lxml.tests.test_etree._XIncludeTestCase.test_xinclude_resolver_recursive lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_resolver_recursive +lxml.tests.test_etree.ElementIncludeTestCase.XINCLUDE lxml.tests.test_etree.ElementIncludeTestCase-class.html#XINCLUDE +lxml.tests.test_etree.ElementIncludeTestCase.include lxml.tests.test_etree.ElementIncludeTestCase-class.html#include +lxml.tests.test_etree.ElementIncludeTestCase.test_multiple_include_of_same_file lxml.tests.test_etree.ElementIncludeTestCase-class.html#test_multiple_include_of_same_file +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ElementIncludeTestCase.xinclude_loader lxml.tests.test_etree.ElementIncludeTestCase-class.html#xinclude_loader +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.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ElementIncludeTestCase.test_xinclude_failures lxml.tests.test_etree.ElementIncludeTestCase-class.html#test_xinclude_failures +lxml.tests.test_etree._XIncludeTestCase.test_xinclude_resolver lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_resolver +lxml.tests.test_etree._XIncludeTestCase.test_xinclude_text lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.test_etree.XMLPullParserTest lxml.tests.test_etree.XMLPullParserTest-class.html +lxml.tests.test_etree.XMLPullParserTest.etree lxml.etree-module.html +lxml.tests.test_etree.XMLPullParserTest.test_pull_from_tree_builder lxml.tests.test_etree.XMLPullParserTest-class.html#test_pull_from_tree_builder +lxml.tests.test_etree.XMLPullParserTest.test_pull_from_simple_target lxml.tests.test_etree.XMLPullParserTest-class.html#test_pull_from_simple_target +lxml.tests.test_etree.XMLPullParserTest.test_pull_from_tree_builder_subclass lxml.tests.test_etree.XMLPullParserTest-class.html#test_pull_from_tree_builder_subclass +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.XMLPullParserTest.test_pull_from_simple_target_start_end lxml.tests.test_etree.XMLPullParserTest-class.html#test_pull_from_simple_target_start_end +lxml.tests.test_etree.XMLPullParserTest.assert_event_tags lxml.tests.test_etree.XMLPullParserTest-class.html#assert_event_tags +lxml.tests.test_etree._XIncludeTestCase lxml.tests.test_etree._XIncludeTestCase-class.html +lxml.tests.test_etree._XIncludeTestCase.test_xinclude_resolver_recursive lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_resolver_recursive +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +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.case.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.test_etree._XIncludeTestCase.test_xinclude_text lxml.tests.test_etree._XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.test_external_document.ExternalDocumentTestCase lxml.tests.test_external_document.ExternalDocumentTestCase-class.html +lxml.tests.test_external_document.ExternalDocumentTestCase.as_capsule lxml.tests.test_external_document.ExternalDocumentTestCase-class.html#as_capsule +lxml.tests.test_external_document.ExternalDocumentTestCase.test_external_document_adoption lxml.tests.test_external_document.ExternalDocumentTestCase-class.html#test_external_document_adoption +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_external_document.ExternalDocumentTestCase.setUp lxml.tests.test_external_document.ExternalDocumentTestCase-class.html#setUp +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +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_html_element_name_quote lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_quote +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_parser_target_doctype_empty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_parser_target_doctype_empty +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse_broken lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse_broken +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_boolean_attribute_xml_adds_empty_string lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_boolean_attribute_xml_adds_empty_string +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_subelement_name_space lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_space +lxml.tests.test_htmlparser.HtmlParserTestCase.etree lxml.etree-module.html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_parser_target_exceptions lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_parser_target_exceptions +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_fromstring_target_exceptions lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_fromstring_target_exceptions +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_parser_target_doctype_html_full lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_parser_target_doctype_html_full +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_subelement_name_quote lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_quote +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_feed_parser lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_feed_parser +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse +lxml.tests.test_htmlparser.HtmlParserTestCase.test_boolean_attribute lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_boolean_attribute +lxml.tests.test_htmlparser.HtmlParserTestCase.test_set_decl_html lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_set_decl_html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_feed_parser_more_tags lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_feed_parser_more_tags +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse_start lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse_start +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.uhtml_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#uhtml_str +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_module_HTML_unicode lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_unicode +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.test_html_ids lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_ids +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_module_parse_html_error lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html_error +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.test_html_parser_target_tag lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_parser_target_tag +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_htmlparser.HtmlParserTestCase.html_str_pretty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#html_str_pretty +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html5_doctype lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html5_doctype +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_html_element_name_empty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_empty +lxml.tests.test_htmlparser.HtmlParserTestCase.test_ietf_decl lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_ietf_decl +lxml.tests.test_htmlparser.HtmlParserTestCase.broken_html_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#broken_html_str +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.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_html_subelement_name_empty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_empty +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_parser_target_doctype_html lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_parser_target_doctype_html +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_boolean_attribute_round_trip lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_boolean_attribute_round_trip +lxml.tests.test_htmlparser.HtmlParserTestCase.test_wide_unicode_xml lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_wide_unicode_xml +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_file_error lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_file_error +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_ids_no_collect_ids lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_ids_no_collect_ids +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse_broken_no_recover lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse_broken_no_recover +lxml.tests.test_htmlparser.HtmlParserTestCase.html_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#html_str +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse_stop_short lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse_stop_short +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_parse_html_default_doctype lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html_default_doctype +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_feed_parser_chunky lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_feed_parser_chunky +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_http_io.HttpIOTestCase lxml.tests.test_http_io.HttpIOTestCase-class.html +lxml.tests.test_http_io.HttpIOTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_http_io.HttpIOTestCase._parse_from_http lxml.tests.test_http_io.HttpIOTestCase-class.html#_parse_from_http +lxml.tests.test_http_io.HttpIOTestCase.test_http_client lxml.tests.test_http_io.HttpIOTestCase-class.html#test_http_client +lxml.tests.test_http_io.HttpIOTestCase.test_network_dtd lxml.tests.test_http_io.HttpIOTestCase-class.html#test_network_dtd +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_http_io.HttpIOTestCase.test_http_client_404 lxml.tests.test_http_io.HttpIOTestCase-class.html#test_http_client_404 +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_http_io.HttpIOTestCase.test_http_client_gzip lxml.tests.test_http_io.HttpIOTestCase-class.html#test_http_client_gzip +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_http_io.HttpIOTestCase.test_parser_input_mix lxml.tests.test_http_io.HttpIOTestCase-class.html#test_parser_input_mix +lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase.test_async lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html#test_async +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase._run_async lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html#_run_async +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase.test_async_api lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html#test_async_api +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._parse_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.tearDown lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase.setUp lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html#setUp +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._read_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_read_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase.test_filelike_close lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html#test_filelike_close +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_flush lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_flush +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_buffering lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._parse_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_open_namespaced_element lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_open_namespaced_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_write_namespaced_element lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_write_namespaced_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.tearDown lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_write_declaration lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_write_declaration +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.setUp lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#setUp +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_void_elements lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_void_elements +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._read_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_read_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_method_context_manager_misuse lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_method_context_manager_misuse +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_xml_mode_write_inside_html lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_xml_mode_write_inside_html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_unescaped_script lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_unescaped_script +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_unescaped_script_incremental lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_unescaped_script_incremental +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_attribute_quoting_unicode lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_attribute_quoting_unicode +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_xml_mode_element_inside_html lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_xml_mode_element_inside_html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile.HtmlFileTestCase.test_attribute_quoting lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html#test_attribute_quoting +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_flush lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_flush +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_buffering lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase._parse_file lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.tearDown lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.setUp lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#setUp +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase._read_file lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#_read_file +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.test_write_fails lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#test_write_fails +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.test_filelike_not_closing lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#test_filelike_not_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.test_filelike_close lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html#test_filelike_close +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_flush lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_flush +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_buffering lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html#close +lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.__init__ lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html#__init__ +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase._parse_file lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase.tearDown lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase.setUp lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#setUp +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase._read_file lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#_read_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase.test_flush lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#test_flush +lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase.test_buffering lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._parse_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.tearDown lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase.setUp lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html#setUp +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._read_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_read_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_flush lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_flush +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_buffering lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._parse_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_parse_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace_and_other lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace_and_other +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_generator_close_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_generator_close_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_non_io_exception_continues_closing lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_non_io_exception_continues_closing +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_escaping lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_escaping +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.tearDown lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#tearDown +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element_repeatedly lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element_repeatedly +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested_with_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested_with_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_encoding lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_encoding +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_closing_out_of_order_in_error_case lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_closing_out_of_order_in_error_case +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase._read_file lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#_read_file +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra_duplicate lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra_duplicate +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_trailing_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_trailing_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_attribute_extra lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_attribute_extra +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_comment lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_comment +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_nested lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_nested +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nsmap lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nsmap +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_failure_preceding_text lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_failure_preceding_text +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_write_Element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_write_Element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_namespace_nested_anonymous lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_namespace_nested_anonymous +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.assertXml lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#assertXml +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element_write_empty lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element_write_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_flush lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_flush +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_buffering lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_buffering +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_nested_default_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_nested_default_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_anonymous_namespace lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_anonymous_namespace +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_element lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_element +lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase.test_pi lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html#test_pi +lxml.tests.test_io.ETreeIOTestCase lxml.tests.test_io.ETreeIOTestCase-class.html +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf8_bom +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 +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf16_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf16_bom +lxml.tests.test_io.ETreeIOTestCase.test_write_compressed_text lxml.tests.test_io.ETreeIOTestCase-class.html#test_write_compressed_text +lxml.tests.test_io.ETreeIOTestCase.etree lxml.etree-module.html +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_write_invalid_filename lxml.tests.test_io._IOTestCaseBase-class.html#test_write_invalid_filename +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.test_write_filename_special_plus lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_plus +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_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.test_io._IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.test_io._IOTestCaseBase.test_parse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_parse_utf8_bom +lxml.tests.test_io._IOTestCaseBase.test_etree_parse_io_error lxml.tests.test_io._IOTestCaseBase-class.html#test_etree_parse_io_error +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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io._IOTestCaseBase.test_write_filename_special_percent lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_percent +unittest.case.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_class_parse_filename_remove_previous lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +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.ElementTreeIOTestCase lxml.tests.test_io.ElementTreeIOTestCase-class.html +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf8_bom +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 +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf16_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf16_bom +lxml.tests.test_io.ElementTreeIOTestCase.etree xml.etree.ElementTree-module.html +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_write_invalid_filename lxml.tests.test_io._IOTestCaseBase-class.html#test_write_invalid_filename +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.test_write_filename_special_plus lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_plus +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_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.test_io._IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.test_io._IOTestCaseBase.test_parse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_parse_utf8_bom +lxml.tests.test_io._IOTestCaseBase.test_etree_parse_io_error lxml.tests.test_io._IOTestCaseBase-class.html#test_etree_parse_io_error +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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io._IOTestCaseBase.test_write_filename_special_percent lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_percent +unittest.case.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_class_parse_filename_remove_previous lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +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 lxml.tests.test_io._IOTestCaseBase-class.html +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf8_bom +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 +lxml.tests.test_io._IOTestCaseBase.test_iterparse_utf16_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf16_bom +lxml.tests.test_io._IOTestCaseBase.etree lxml.tests.test_io._IOTestCaseBase-class.html#etree +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_write_invalid_filename lxml.tests.test_io._IOTestCaseBase-class.html#test_write_invalid_filename +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.test_write_filename_special_plus lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_plus +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_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.test_io._IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.test_io._IOTestCaseBase.test_parse_utf8_bom lxml.tests.test_io._IOTestCaseBase-class.html#test_parse_utf8_bom +lxml.tests.test_io._IOTestCaseBase.test_etree_parse_io_error lxml.tests.test_io._IOTestCaseBase-class.html#test_etree_parse_io_error +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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io._IOTestCaseBase.test_write_filename_special_percent lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_percent +unittest.case.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_class_parse_filename_remove_previous lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +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_isoschematron.ETreeISOSchematronTestCase lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_from_file lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_from_file +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_invalid_args lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_invalid_args +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_error_log lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_error_log +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_customization lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_customization +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_phases_kwarg lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_phases_kwarg +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_xmlschema_embedded lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_xmlschema_embedded +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_from_tree lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_from_tree +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_store_xslt lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_store_xslt +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_validate lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_validate +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_from_element lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_from_element +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_assertValid lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_assertValid +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_result_report lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_result_report +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_empty_pattern lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_empty_pattern +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_store_schematron lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_store_schematron +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_elementtree_error lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_elementtree_error +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_abstract lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_abstract +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_phases lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_phases +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_call lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_call +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_invalid_schema_empty lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_invalid_schema_empty +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_relaxng_embedded lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_relaxng_embedded +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_fail_on_report lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_fail_on_report +lxml.tests.test_isoschematron.ETreeISOSchematronTestCase.test_schematron_invalid_schema_namespace lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html#test_schematron_invalid_schema_namespace +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html +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.tearDown lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#tearDown +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.bluff_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-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.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.case.TestCase.failureException exceptions.AssertionError-class.html +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.cssselect lxml.etree._Element-class.html#cssselect +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.cssselect lxml.etree._Element-class.html#cssselect +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.cssselect lxml.etree._Element-class.html#cssselect +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_pickle_floattelement lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_floattelement +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_xsiannotate_ignore_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xsiannotate_ignore_old +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_data_element_float_hash lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_float_hash +lxml.tests.test_objectify.ObjectifyTestCase.test_setitem_string lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setitem_string +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_hash lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_hash +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.test_delitem_index lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_delitem_index +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_object_path_default_relative lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_default_relative +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_addattr_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr_element +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_addattr_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr_list +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_data_element_int_hash lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_int_hash +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_date_element_efactory_text lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_date_element_efactory_text +lxml.tests.test_objectify.ObjectifyTestCase.test_root lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_root +lxml.tests.test_objectify.ObjectifyTestCase.test_type_float_precision lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_float_precision +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_pickle_intelement lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_intelement +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_pickle lxml.tests.test_objectify.ObjectifyTestCase-class.html#_test_pickle +lxml.tests.test_objectify.ObjectifyTestCase.test_date_element_efactory_tail lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_date_element_efactory_tail +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_setitem_index lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setitem_index +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_child_ns_nons lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_ns_nons +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_dataelement_xsi_nsmap lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_dataelement_xsi_nsmap +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_subtype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_subtype +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_float_hash_repr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_float_hash_repr +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +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_child_getattr_empty_ns lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_getattr_empty_ns +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_pickle_boolelement lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_boolelement +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.test_objectify.ObjectifyTestCase.test_data_element_element_arg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_element_arg +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_type_float_instantiation_precision lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_float_instantiation_precision +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_type_str_mod_data_elements lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_mod_data_elements +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_pickle_noneelement lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_noneelement +lxml.tests.test_objectify.ObjectifyTestCase.test_addattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr +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_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_type_float_precision_consistency lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_float_precision_consistency +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 +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_str_floatliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_str_floatliteral +lxml.tests.test_objectify.ObjectifyTestCase.etree lxml.etree-module.html +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_child_getattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_getattr +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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +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_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_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_pickle_strelement lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_strelement +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_float_precision lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_float_precision +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_setslice_partial_neg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_partial_neg +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_int lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_int +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_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_getslice_complete lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_getslice_complete +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.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_getitem_neg lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getitem_neg +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_comments_fallback lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_comments_fallback +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_iterchildren lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_iterchildren +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_prefix lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_prefix +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.etree lxml.etree-module.html +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.tearDown lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#tearDown +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_getparent lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getparent +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_tag lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_tag +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getitem lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getitem +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_sourceline lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_sourceline +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_attrib lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_attrib +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_getnext lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getnext +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getprevious lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getprevious +lxml.tests.test_pyclasslookup.PyClassLookupTestCase._buildElementClass lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#_buildElementClass +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.XML lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#XML +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getslice lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getslice +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 +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_text lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_text +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#Element +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_iter_children lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_iter_children +lxml.tests.test_relaxng.ETreeRelaxNGTestCase lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_stringio lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_stringio +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_elementtree_error lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_elementtree_error +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_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_generic_error lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_generic_error +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.case.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_error lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_error +lxml.tests.test_relaxng.RelaxNGCompactTestCase lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_relaxng.RelaxNGCompactTestCase.pytestmark lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html#pytestmark +lxml.tests.test_relaxng.RelaxNGCompactTestCase.test_relaxng_compact lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html#test_relaxng_compact +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_relaxng.RelaxNGCompactTestCase.test_relaxng_compact_file_obj lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html#test_relaxng_compact_file_obj +lxml.tests.test_relaxng.RelaxNGCompactTestCase.test_relaxng_compact_str lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html#test_relaxng_compact_str +lxml.tests.test_sax.ETreeSaxTestCase lxml.tests.test_sax.ETreeSaxTestCase-class.html +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_no_ns_attributes lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_no_ns_attributes +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_redefine_ns lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_redefine_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.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.test_sax.ETreeSaxTestCase.test_etree_sax_handler_default_ns_None lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_handler_default_ns_None +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.test_sax.ETreeSaxTestCase.test_etree_sax_error lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_error +lxml.tests.test_sax.ETreeSaxTestCase._saxify_serialize lxml.tests.test_sax.ETreeSaxTestCase-class.html#_saxify_serialize +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.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 +unittest.case.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_double lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_double +lxml.tests.test_sax.ETreeSaxTestCase.test_sax_to_pulldom_multiple_namespaces lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_sax_to_pulldom_multiple_namespaces +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_ns_attributes lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_ns_attributes +lxml.tests.test_sax.NSPrefixSaxTestCase lxml.tests.test_sax.NSPrefixSaxTestCase-class.html +lxml.tests.test_sax.NSPrefixSaxTestCase.test_element_sax_twin_ns_prefix lxml.tests.test_sax.NSPrefixSaxTestCase-class.html#test_element_sax_twin_ns_prefix +lxml.tests.test_sax.NSPrefixSaxTestCase.test_element_sax_default_ns_prefix lxml.tests.test_sax.NSPrefixSaxTestCase-class.html#test_element_sax_default_ns_prefix +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_sax.NSPrefixSaxTestCase._saxify lxml.tests.test_sax.NSPrefixSaxTestCase-class.html#_saxify +lxml.tests.test_sax.NSPrefixSaxTestCase.test_element_sax_ns_prefix lxml.tests.test_sax.NSPrefixSaxTestCase-class.html#test_element_sax_ns_prefix +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_sax.SimpleContentHandler lxml.tests.test_sax.SimpleContentHandler-class.html +lxml.tests.test_sax.SimpleContentHandler.ignorableWhitespace lxml.tests.test_sax.SimpleContentHandler-class.html#ignorableWhitespace +lxml.tests.test_sax.SimpleContentHandler.__init__ lxml.tests.test_sax.SimpleContentHandler-class.html#__init__ +lxml.tests.test_sax.SimpleContentHandler.endElementNS lxml.tests.test_sax.SimpleContentHandler-class.html#endElementNS +lxml.tests.test_sax.SimpleContentHandler.startDocument lxml.tests.test_sax.SimpleContentHandler-class.html#startDocument +lxml.tests.test_sax.SimpleContentHandler.startPrefixMapping lxml.tests.test_sax.SimpleContentHandler-class.html#startPrefixMapping +lxml.tests.test_sax.SimpleContentHandler.endPrefixMapping lxml.tests.test_sax.SimpleContentHandler-class.html#endPrefixMapping +lxml.tests.test_sax.SimpleContentHandler.processingInstruction lxml.tests.test_sax.SimpleContentHandler-class.html#processingInstruction +lxml.tests.test_sax.SimpleContentHandler.endElement lxml.tests.test_sax.SimpleContentHandler-class.html#endElement +lxml.tests.test_sax.SimpleContentHandler.skippedEntity lxml.tests.test_sax.SimpleContentHandler-class.html#skippedEntity +lxml.tests.test_sax.SimpleContentHandler.startElementNS lxml.tests.test_sax.SimpleContentHandler-class.html#startElementNS +lxml.tests.test_sax.SimpleContentHandler.characters lxml.tests.test_sax.SimpleContentHandler-class.html#characters +lxml.tests.test_sax.SimpleContentHandler.startElement lxml.tests.test_sax.SimpleContentHandler-class.html#startElement +lxml.tests.test_sax.SimpleContentHandler.endDocument lxml.tests.test_sax.SimpleContentHandler-class.html#endDocument +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_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 lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron_invalid_schema_empty lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_invalid_schema_empty +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_invalid_schema_namespace lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_invalid_schema_namespace +lxml.tests.test_threading.ThreadPipelineTestCase lxml.tests.test_threading.ThreadPipelineTestCase-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.Validate lxml.tests.test_threading.ThreadPipelineTestCase.Validate-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.test_threading.ThreadPipelineTestCase.test_thread_pipeline_thread_parse lxml.tests.test_threading.ThreadPipelineTestCase-class.html#test_thread_pipeline_thread_parse +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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.ReverseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html +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.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.ParseAndInjectWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-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.ParseAndInjectWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-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.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.Validate lxml.tests.test_threading.ThreadPipelineTestCase.Validate-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.Validate.handle lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.Worker lxml.tests.test_threading.ThreadPipelineTestCase.Worker-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.Worker.handle lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#handle +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_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 +lxml.tests.test_threading.ThreadingTestCase.test_thread_xslt_parsing_error_log lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_xslt_parsing_error_log +lxml.tests.test_threading.ThreadingTestCase.etree lxml.etree-module.html +lxml.tests.test_threading.ThreadingTestCase.test_thread_mix lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_mix +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_threading.ThreadingTestCase.test_concurrent_proxies lxml.tests.test_threading.ThreadingTestCase-class.html#test_concurrent_proxies +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.test_threading.ThreadingTestCase.test_subtree_copy_thread lxml.tests.test_threading.ThreadingTestCase-class.html#test_subtree_copy_thread +lxml.tests.test_threading.ThreadingTestCase.test_concurrent_attribute_names_in_dicts lxml.tests.test_threading.ThreadingTestCase-class.html#test_concurrent_attribute_names_in_dicts +lxml.tests.test_threading.ThreadingTestCase.test_thread_create_xslt lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_create_xslt +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_threading.ThreadingTestCase.test_thread_error_log lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_error_log +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_threading.ThreadingTestCase.test_thread_xslt_apply_error_log lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_xslt_apply_error_log +lxml.tests.test_threading.ThreadingTestCase._run_threads lxml.tests.test_threading.ThreadingTestCase-class.html#_run_threads +lxml.tests.test_unicode.EncodingsTestCase lxml.tests.test_unicode.EncodingsTestCase-class.html +lxml.tests.test_unicode.EncodingsTestCase.test_utf8sig_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf8sig_fromstring +lxml.tests.test_unicode.EncodingsTestCase.test_utf16BE_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf16BE_fromstring +lxml.tests.test_unicode.EncodingsTestCase._test_encoding lxml.tests.test_unicode.EncodingsTestCase-class.html#_test_encoding +lxml.tests.test_unicode.EncodingsTestCase.test_utf32LE_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf32LE_fromstring +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_unicode.EncodingsTestCase.test_illegal_utf8_recover lxml.tests.test_unicode.EncodingsTestCase-class.html#test_illegal_utf8_recover +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_unicode.EncodingsTestCase.test_illegal_utf8 lxml.tests.test_unicode.EncodingsTestCase-class.html#test_illegal_utf8 +lxml.tests.test_unicode.EncodingsTestCase.test_utf32BE_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf32BE_fromstring +lxml.tests.test_unicode.EncodingsTestCase.test_utf16LE_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf16LE_fromstring +lxml.tests.test_unicode.EncodingsTestCase.test_utf8_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf8_fromstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_unicode.EncodingsTestCase.test_utf32_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf32_fromstring +lxml.tests.test_unicode.EncodingsTestCase.test_utf16_fromstring lxml.tests.test_unicode.EncodingsTestCase-class.html#test_utf16_fromstring +lxml.tests.test_unicode.UnicodeTestCase lxml.tests.test_unicode.UnicodeTestCase-class.html +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_xml_broken lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_xml_broken +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_text lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_text +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_uniname lxml.tests.test_unicode.UnicodeTestCase-class.html#test_uniname +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_attr lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_attr +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_qname lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_qname +lxml.tests.test_unicode.UnicodeTestCase.test__str lxml.tests.test_unicode.UnicodeTestCase-class.html#test__str +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_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_xml lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_xml +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_repr1 lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_repr1 +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_repr2 lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_repr2 +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_repr3 lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_repr3 +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_repr4 lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_repr4 +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_ns_invalid lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_ns_invalid +lxml.tests.test_unicode.UnicodeTestCase.test_wide_unicode_xml lxml.tests.test_unicode.UnicodeTestCase-class.html#test_wide_unicode_xml +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_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_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.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.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.test_xmlschema_resolvers lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#test_xmlschema_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.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.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_shortcut lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_shortcut +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_default_attributes lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_default_attributes +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_parse lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse +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_parse_default_attributes lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse_default_attributes +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_iterparse_incomplete lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_iterparse_incomplete +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_stringio lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_stringio +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_illegal_validation_error lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_illegal_validation_error +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_comment_error lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_comment_error +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +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_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_error_log_path lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_error_log_path +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_error_log lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_error_log +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_iterparse lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_iterparse +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_create_from_partial_doc lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_create_from_partial_doc +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_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.test_xpathevaluator.ETreeETXPathClassTestCase._test_xpath_compile_unicode lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html#_test_xpath_compile_unicode +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.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html +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.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +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_compile_doc lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_doc +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_elementtree_error lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_elementtree_error +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_compile_error lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_error +lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html +lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase.test_xpath_exslt_functions_strings lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html#test_xpath_exslt_functions_strings +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase.NSMAP lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html#NSMAP +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase.test_xpath_exslt_functions_date lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html#test_xpath_exslt_functions_date +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +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_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_extensions_nodes_append lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_nodes_append +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_list_attribute lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_attribute +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.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_text_from_other_document lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_text_from_other_document +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_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.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.ETreeEXSLTTestCase lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_match lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_match +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_match1 lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_match1 +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_match2 lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_match2 +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_str lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_str +lxml.tests.test_xslt.ETreeEXSLTTestCase._test_exslt_regexp_match4 lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#_test_exslt_regexp_match4 +lxml.tests.test_xslt.ETreeEXSLTTestCase._test_exslt_regexp_match3 lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#_test_exslt_regexp_match3 +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_replace lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_replace +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_test lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_test +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_math lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_math +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_str_attribute_replace lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_str_attribute_replace +lxml.tests.test_xslt.ETreeEXSLTTestCase.test_exslt_regexp_match_groups lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html#test_exslt_regexp_match_groups +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase._test_extension_element_attribute_context lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#_test_extension_element_attribute_context +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_apply_templates_elements_only lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_apply_templates_elements_only +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_apply_templates_target_node lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_apply_templates_target_node +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_apply_templates lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_apply_templates +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extensions_nsmap lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extensions_nsmap +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_apply_templates_remove_blank_text lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_apply_templates_remove_blank_text +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_content lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_content +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_process_children_to_append_only lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_process_children_to_append_only +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_process_children lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_process_children +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_process_children_to_read_only_raise lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_process_children_to_read_only_raise +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_comment_pi_context lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_comment_pi_context +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_apply_templates_target_node_doc lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_apply_templates_target_node_doc +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_raise lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_raise +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_process_children_with_subextension_element lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_process_children_with_subextension_element +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase._test_multiple_extension_elements_with_output_parent lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#_test_multiple_extension_elements_with_output_parent +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element_doc_context lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element_doc_context +lxml.tests.test_xslt.ETreeXSLTExtElementTestCase.test_extension_element lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html#test_extension_element +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase.test_variable_result_tree_fragment lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html#test_variable_result_tree_fragment +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase.test_xpath_on_context_node lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html#test_xpath_on_context_node +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase.test_extensions2 lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html#test_extensions2 +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase.test_extensions1 lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html#test_extensions1 +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase.test_xpath_on_foreign_context_node lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html#test_xpath_on_foreign_context_node +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._xslt_setup lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#_xslt_setup +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_xslt_parsing_error_log lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parsing_error_log +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_access_control_repr lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_access_control_repr +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_write_output_file_oserror lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_file_oserror +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_document_parse_allow lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_parse_allow +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_message lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_message +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_write_output_file_path lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_file_path +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_write_output_bytesio lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_bytesio +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_write_output_file lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_file +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_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_apply_error_log lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_apply_error_log +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_xslt_unicode_standalone lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_unicode_standalone +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_parameter_xpath_object lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parameter_xpath_object +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_xslt_write_output_failure lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_failure +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_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_multiple_elementrees lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_multiple_elementrees +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_input_partial_doc lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_input_partial_doc +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_write_output_file_path_urlescaped_plus lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_file_path_urlescaped_plus +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_write_output_file_path_urlescaped lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_write_output_file_path_urlescaped +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_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_xslt_string_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_string_parameters +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.case.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_multiple_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_multiple_parameters +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_xslt_encoding lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_encoding +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.test_xslt.Py3XSLTTestCase.test_xslt_result_bytes lxml.tests.test_xslt.Py3XSLTTestCase-class.html#test_xslt_result_bytes +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xslt.Py3XSLTTestCase.pytestmark lxml.tests.test_xslt.Py3XSLTTestCase-class.html#pytestmark +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.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.case.TestCase.failureException exceptions.AssertionError-class.html +mimetools.Message mimetools.Message-class.html +mimetools.Message.getmaintype mimetools.Message-class.html#getmaintype +mimetools.Message.getsubtype mimetools.Message-class.html#getsubtype +mimetools.Message.parseplist mimetools.Message-class.html#parseplist +mimetools.Message.__init__ mimetools.Message-class.html#__init__ +mimetools.Message.getparamnames mimetools.Message-class.html#getparamnames +mimetools.Message.getencoding mimetools.Message-class.html#getencoding +mimetools.Message.getparam mimetools.Message-class.html#getparam +mimetools.Message.parsetype mimetools.Message-class.html#parsetype +mimetools.Message.getplist mimetools.Message-class.html#getplist +mimetools.Message.gettype mimetools.Message-class.html#gettype +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.__format__ str-class.html#__format__ +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._formatter_parser str-class.html#_formatter_parser +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.format str-class.html#format +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.__sizeof__ str-class.html#__sizeof__ +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._formatter_field_name_split str-class.html#_formatter_field_name_split +str.islower str-class.html#islower +str.title str-class.html#title +str.isupper str-class.html#isupper +str.__ge__ str-class.html#__ge__ +xml.etree.ElementTree.Element xml.etree.ElementTree.Element-class.html +xml.etree.ElementTree.Element.set xml.etree.ElementTree.Element-class.html#set +xml.etree.ElementTree.Element.text xml.etree.ElementTree.Element-class.html#text +xml.etree.ElementTree.Element.iterfind xml.etree.ElementTree.Element-class.html#iterfind +xml.etree.ElementTree.Element.tag xml.etree.ElementTree.Element-class.html#tag +xml.etree.ElementTree.Element.iter xml.etree.ElementTree.Element-class.html#iter +xml.etree.ElementTree.Element.findall xml.etree.ElementTree.Element-class.html#findall +xml.etree.ElementTree.Element.append xml.etree.ElementTree.Element-class.html#append +xml.etree.ElementTree.Element.__getitem__ xml.etree.ElementTree.Element-class.html#__getitem__ +xml.etree.ElementTree.Element.itertext xml.etree.ElementTree.Element-class.html#itertext +xml.etree.ElementTree.Element.findtext xml.etree.ElementTree.Element-class.html#findtext +xml.etree.ElementTree.Element.tail xml.etree.ElementTree.Element-class.html#tail +xml.etree.ElementTree.Element.find xml.etree.ElementTree.Element-class.html#find +xml.etree.ElementTree.Element.getchildren xml.etree.ElementTree.Element-class.html#getchildren +xml.etree.ElementTree.Element.__init__ xml.etree.ElementTree.Element-class.html#__init__ +xml.etree.ElementTree.Element.__delitem__ xml.etree.ElementTree.Element-class.html#__delitem__ +xml.etree.ElementTree.Element.__len__ xml.etree.ElementTree.Element-class.html#__len__ +xml.etree.ElementTree.Element.extend xml.etree.ElementTree.Element-class.html#extend +xml.etree.ElementTree.Element.get xml.etree.ElementTree.Element-class.html#get +xml.etree.ElementTree.Element.keys xml.etree.ElementTree.Element-class.html#keys +xml.etree.ElementTree.Element.makeelement xml.etree.ElementTree.Element-class.html#makeelement +xml.etree.ElementTree.Element.__setitem__ xml.etree.ElementTree.Element-class.html#__setitem__ +xml.etree.ElementTree.Element.copy xml.etree.ElementTree.Element-class.html#copy +xml.etree.ElementTree.Element.insert xml.etree.ElementTree.Element-class.html#insert +xml.etree.ElementTree.Element.__nonzero__ xml.etree.ElementTree.Element-class.html#__nonzero__ +xml.etree.ElementTree.Element.items xml.etree.ElementTree.Element-class.html#items +xml.etree.ElementTree.Element.clear xml.etree.ElementTree.Element-class.html#clear +xml.etree.ElementTree.Element.remove xml.etree.ElementTree.Element-class.html#remove +xml.etree.ElementTree.Element.__repr__ xml.etree.ElementTree.Element-class.html#__repr__ +xml.etree.ElementTree.Element.getiterator xml.etree.ElementTree.Element-class.html#getiterator +xml.etree.ElementTree.Element.attrib xml.etree.ElementTree.Element-class.html#attrib +xml.etree.ElementTree.ElementTree xml.etree.ElementTree.ElementTree-class.html +xml.etree.ElementTree.ElementTree.getroot xml.etree.ElementTree.ElementTree-class.html#getroot +xml.etree.ElementTree.ElementTree.iterfind xml.etree.ElementTree.ElementTree-class.html#iterfind +xml.etree.ElementTree.ElementTree.parse xml.etree.ElementTree.ElementTree-class.html#parse +xml.etree.ElementTree.ElementTree.findall xml.etree.ElementTree.ElementTree-class.html#findall +xml.etree.ElementTree.ElementTree.__init__ xml.etree.ElementTree.ElementTree-class.html#__init__ +xml.etree.ElementTree.ElementTree.findtext xml.etree.ElementTree.ElementTree-class.html#findtext +xml.etree.ElementTree.ElementTree.find xml.etree.ElementTree.ElementTree-class.html#find +xml.etree.ElementTree.ElementTree.write xml.etree.ElementTree.ElementTree-class.html#write +xml.etree.ElementTree.ElementTree._setroot xml.etree.ElementTree.ElementTree-class.html#_setroot +xml.etree.ElementTree.ElementTree.write_c14n xml.etree.ElementTree.ElementTree-class.html#write_c14n +xml.etree.ElementTree.ElementTree.getiterator xml.etree.ElementTree.ElementTree-class.html#getiterator +xml.etree.ElementTree.ElementTree.iter xml.etree.ElementTree.ElementTree-class.html#iter +xml.etree.ElementTree.ParseError xml.etree.ElementTree.ParseError-class.html +xml.etree.ElementTree.QName xml.etree.ElementTree.QName-class.html +xml.etree.ElementTree.QName.__str__ xml.etree.ElementTree.QName-class.html#__str__ +xml.etree.ElementTree.QName.__cmp__ xml.etree.ElementTree.QName-class.html#__cmp__ +xml.etree.ElementTree.QName.__hash__ xml.etree.ElementTree.QName-class.html#__hash__ +xml.etree.ElementTree.QName.__init__ xml.etree.ElementTree.QName-class.html#__init__ +xml.etree.ElementTree.TreeBuilder xml.etree.ElementTree.TreeBuilder-class.html +xml.etree.ElementTree.TreeBuilder.end xml.etree.ElementTree.TreeBuilder-class.html#end +xml.etree.ElementTree.TreeBuilder.start xml.etree.ElementTree.TreeBuilder-class.html#start +xml.etree.ElementTree.TreeBuilder._flush xml.etree.ElementTree.TreeBuilder-class.html#_flush +xml.etree.ElementTree.TreeBuilder.close xml.etree.ElementTree.TreeBuilder-class.html#close +xml.etree.ElementTree.TreeBuilder.data xml.etree.ElementTree.TreeBuilder-class.html#data +xml.etree.ElementTree.TreeBuilder.__init__ xml.etree.ElementTree.TreeBuilder-class.html#__init__ +xml.etree.ElementTree.XMLParser xml.etree.ElementTree.XMLParser-class.html +xml.etree.ElementTree.XMLParser.feed xml.etree.ElementTree.XMLParser-class.html#feed +xml.etree.ElementTree.XMLParser.__doctype xml.etree.ElementTree.XMLParser-class.html#__doctype +xml.etree.ElementTree.XMLParser._fixtext xml.etree.ElementTree.XMLParser-class.html#_fixtext +xml.etree.ElementTree.XMLParser._fixname xml.etree.ElementTree.XMLParser-class.html#_fixname +xml.etree.ElementTree.XMLParser.close xml.etree.ElementTree.XMLParser-class.html#close +xml.etree.ElementTree.XMLParser._start xml.etree.ElementTree.XMLParser-class.html#_start +xml.etree.ElementTree.XMLParser.__init__ xml.etree.ElementTree.XMLParser-class.html#__init__ +xml.etree.ElementTree.XMLParser._pi xml.etree.ElementTree.XMLParser-class.html#_pi +xml.etree.ElementTree.XMLParser._end xml.etree.ElementTree.XMLParser-class.html#_end +xml.etree.ElementTree.XMLParser._default xml.etree.ElementTree.XMLParser-class.html#_default +xml.etree.ElementTree.XMLParser._start_list xml.etree.ElementTree.XMLParser-class.html#_start_list +xml.etree.ElementTree.XMLParser._data xml.etree.ElementTree.XMLParser-class.html#_data +xml.etree.ElementTree.XMLParser._raiseerror xml.etree.ElementTree.XMLParser-class.html#_raiseerror +xml.etree.ElementTree.XMLParser._comment xml.etree.ElementTree.XMLParser-class.html#_comment +xml.etree.ElementTree.XMLParser.doctype xml.etree.ElementTree.XMLParser-class.html#doctype +xml.etree.ElementTree._IterParseIterator xml.etree.ElementTree._IterParseIterator-class.html +xml.etree.ElementTree._IterParseIterator.next xml.etree.ElementTree._IterParseIterator-class.html#next +xml.etree.ElementTree._IterParseIterator.__iter__ xml.etree.ElementTree._IterParseIterator-class.html#__iter__ +xml.etree.ElementTree._IterParseIterator.__init__ xml.etree.ElementTree._IterParseIterator-class.html#__init__ +xml.etree.ElementTree._SimpleElementPath xml.etree.ElementTree._SimpleElementPath-class.html +xml.etree.ElementTree._SimpleElementPath.iterfind xml.etree.ElementTree._SimpleElementPath-class.html#iterfind +xml.etree.ElementTree._SimpleElementPath.findtext xml.etree.ElementTree._SimpleElementPath-class.html#findtext +xml.etree.ElementTree._SimpleElementPath.find xml.etree.ElementTree._SimpleElementPath-class.html#find +xml.etree.ElementTree._SimpleElementPath.findall xml.etree.ElementTree._SimpleElementPath-class.html#findall diff --git a/doc/html/api/class-tree.html b/doc/html/api/class-tree.html new file mode 100644 index 00000000..4d5f5292 --- /dev/null +++ b/doc/html/api/class-tree.html @@ -0,0 +1,1395 @@ + + + + + Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Class Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/cssselect.parser.SelectorError-class.html b/doc/html/api/cssselect.parser.SelectorError-class.html new file mode 100644 index 00000000..8df9501c --- /dev/null +++ b/doc/html/api/cssselect.parser.SelectorError-class.html @@ -0,0 +1,217 @@ + + + + + cssselect.parser.SelectorError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + cssselect :: + parser :: + SelectorError :: + Class SelectorError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SelectorError

+
+              object --+        
+                       |        
+exceptions.BaseException --+    
+                           |    
+        exceptions.Exception --+
+                               |
+                              SelectorError
+
+ +
Known Subclasses:
+
+ +
+ +
+
+Common parent for :class:`SelectorSyntaxError` and
+:class:`ExpressionError`.
+
+You can just use ``except SelectorError:`` when calling
+:meth:`~GenericTranslator.css_to_xpath` and handle both exceptions types.
+
+
+ + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

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

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/cssselect.parser.SelectorSyntaxError-class.html b/doc/html/api/cssselect.parser.SelectorSyntaxError-class.html new file mode 100644 index 00000000..5cd4d938 --- /dev/null +++ b/doc/html/api/cssselect.parser.SelectorSyntaxError-class.html @@ -0,0 +1,224 @@ + + + + + cssselect.parser.SelectorSyntaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + cssselect :: + parser :: + SelectorSyntaxError :: + Class SelectorSyntaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SelectorSyntaxError

+
+                  object --+            
+                           |            
+    exceptions.BaseException --+        
+                               |        
+            exceptions.Exception --+    
+                                   |    
+                       SelectorError --+
+                                       |
+              object --+               |
+                       |               |
+exceptions.BaseException --+           |
+                           |           |
+        exceptions.Exception --+       |
+                               |       |
+        exceptions.StandardError --+   |
+                                   |   |
+              exceptions.SyntaxError --+
+                                       |
+                                      SelectorSyntaxError
+
+ +
+Parsing a selector that does not match the grammar. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

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

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/cssselect.xpath.ExpressionError-class.html b/doc/html/api/cssselect.xpath.ExpressionError-class.html new file mode 100644 index 00000000..7d693051 --- /dev/null +++ b/doc/html/api/cssselect.xpath.ExpressionError-class.html @@ -0,0 +1,216 @@ + + + + + cssselect.xpath.ExpressionError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + cssselect :: + xpath :: + ExpressionError :: + Class ExpressionError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ExpressionError

+
+                  object --+            
+                           |            
+    exceptions.BaseException --+        
+                               |        
+            exceptions.Exception --+    
+                                   |    
+                parser.SelectorError --+
+                                       |
+              object --+               |
+                       |               |
+exceptions.BaseException --+           |
+                           |           |
+        exceptions.Exception --+       |
+                               |       |
+        exceptions.StandardError --+   |
+                                   |   |
+             exceptions.RuntimeError --+
+                                       |
+                                      ExpressionError
+
+ +
+Unknown or unsupported selector (eg. pseudo-class). + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

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

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/cssselect.xpath.XPathExpr-class.html b/doc/html/api/cssselect.xpath.XPathExpr-class.html new file mode 100644 index 00000000..72aec847 --- /dev/null +++ b/doc/html/api/cssselect.xpath.XPathExpr-class.html @@ -0,0 +1,402 @@ + + + + + cssselect.xpath.XPathExpr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + cssselect :: + xpath :: + XPathExpr :: + Class XPathExpr + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathExpr

+
+object --+
+         |
+        XPathExpr
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + path='', + element='*', + condition='', + star_prefix=False)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(self)
+ str(x)
+ + +
+ +
+   + + + + + + +
add_condition(self, + condition) + + +
+ +
+   + + + + + + +
add_name_test(self) + + +
+ +
+   + + + + + + +
add_star_prefix(self)
+ Append '*/' to the path to keep the context constrained +to a single parent.
+ + +
+ +
+   + + + + + + +
join(self, + combiner, + other) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

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

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

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

__str__(self) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/deprecated-index.html b/doc/html/api/deprecated-index.html new file mode 100644 index 00000000..b4a6e7e7 --- /dev/null +++ b/doc/html/api/deprecated-index.html @@ -0,0 +1,168 @@ + + + + + Deprecation List + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+

Deprecation List

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/epydoc.css b/doc/html/api/epydoc.css new file mode 100644 index 00000000..86d41706 --- /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 00000000..753451e1 --- /dev/null +++ b/doc/html/api/exceptions.AssertionError-class.html @@ -0,0 +1,303 @@ + + + + + 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 help(type(x)) 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__, + __unicode__ +

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

Inherited from BaseException: + args, + message +

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..7c416686 --- /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 00000000..dc1b4f09 --- /dev/null +++ b/doc/html/api/help.html @@ -0,0 +1,279 @@ + + + + + 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:

+ + +

Each Module Documentation page contains:

+ + +

Each Class Documentation page contains:

+ + +

Project Documentation

+ +

The Trees page contains the module and class hierarchies:

+ + +

The Index page contains indices of terms and + identifiers:

+ + +

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 00000000..2454080e --- /dev/null +++ b/doc/html/api/identifier-index-A.html @@ -0,0 +1,301 @@ + + + + + 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 00000000..4c77985c --- /dev/null +++ b/doc/html/api/identifier-index-B.html @@ -0,0 +1,241 @@ + + + + + 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 00000000..a44c0201 --- /dev/null +++ b/doc/html/api/identifier-index-C.html @@ -0,0 +1,524 @@ + + + + + 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 00000000..337b4587 --- /dev/null +++ b/doc/html/api/identifier-index-D.html @@ -0,0 +1,408 @@ + + + + + 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 00000000..237bd714 --- /dev/null +++ b/doc/html/api/identifier-index-E.html @@ -0,0 +1,772 @@ + + + + + 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 00000000..a615fbf5 --- /dev/null +++ b/doc/html/api/identifier-index-F.html @@ -0,0 +1,351 @@ + + + + + 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 00000000..a5f7bfd2 --- /dev/null +++ b/doc/html/api/identifier-index-G.html @@ -0,0 +1,232 @@ + + + + + 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 00000000..7faaba4a --- /dev/null +++ b/doc/html/api/identifier-index-H.html @@ -0,0 +1,330 @@ + + + + + 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 00000000..ceca5f00 --- /dev/null +++ b/doc/html/api/identifier-index-I.html @@ -0,0 +1,518 @@ + + + + + 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 00000000..9ed013df --- /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 00000000..4fbd7287 --- /dev/null +++ b/doc/html/api/identifier-index-K.html @@ -0,0 +1,177 @@ + + + + + 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 00000000..c6e12001 --- /dev/null +++ b/doc/html/api/identifier-index-L.html @@ -0,0 +1,255 @@ + + + + + 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 00000000..eda62bee --- /dev/null +++ b/doc/html/api/identifier-index-M.html @@ -0,0 +1,229 @@ + + + + + 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 00000000..2a6b1240 --- /dev/null +++ b/doc/html/api/identifier-index-N.html @@ -0,0 +1,249 @@ + + + + + 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 00000000..5da0ae21 --- /dev/null +++ b/doc/html/api/identifier-index-O.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 + _ +] +
+ + + +

O

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

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-P.html b/doc/html/api/identifier-index-P.html new file mode 100644 index 00000000..54254828 --- /dev/null +++ b/doc/html/api/identifier-index-P.html @@ -0,0 +1,328 @@ + + + + + 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 00000000..374a83d8 --- /dev/null +++ b/doc/html/api/identifier-index-Q.html @@ -0,0 +1,167 @@ + + + + + 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 00000000..635ec20d --- /dev/null +++ b/doc/html/api/identifier-index-R.html @@ -0,0 +1,750 @@ + + + + + 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 00000000..056b2d88 --- /dev/null +++ b/doc/html/api/identifier-index-S.html @@ -0,0 +1,1235 @@ + + + + + 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 00000000..9f7d1f43 --- /dev/null +++ b/doc/html/api/identifier-index-T.html @@ -0,0 +1,4037 @@ + + + + + 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 00000000..7a14c208 --- /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 00000000..34a30c65 --- /dev/null +++ b/doc/html/api/identifier-index-V.html @@ -0,0 +1,208 @@ + + + + + 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 00000000..a17c1c7f --- /dev/null +++ b/doc/html/api/identifier-index-W.html @@ -0,0 +1,217 @@ + + + + + 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 00000000..fc96435a --- /dev/null +++ b/doc/html/api/identifier-index-X.html @@ -0,0 +1,478 @@ + + + + + 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 00000000..eb3b6930 --- /dev/null +++ b/doc/html/api/identifier-index-Y.html @@ -0,0 +1,146 @@ + + + + + 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 00000000..9a36d0df --- /dev/null +++ b/doc/html/api/identifier-index-Z.html @@ -0,0 +1,146 @@ + + + + + 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 00000000..0f20f5e5 --- /dev/null +++ b/doc/html/api/identifier-index-_.html @@ -0,0 +1,2125 @@ + + + + + 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 00000000..28a753f2 --- /dev/null +++ b/doc/html/api/identifier-index.html @@ -0,0 +1,301 @@ + + + + + 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 00000000..7c416686 --- /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 00000000..32f7a78f --- /dev/null +++ b/doc/html/api/lxml-module.html @@ -0,0 +1,261 @@ + + + + + lxml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package lxml

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
get_include()
+ Returns a list of header include paths (for lxml itself, libxml2 +and libxslt) needed to compile C code against lxml if it was built +with statically linked libraries.
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None
+ hash(x) +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml-pysrc.html b/doc/html/api/lxml-pysrc.html new file mode 100644 index 00000000..5f8fb7d8 --- /dev/null +++ b/doc/html/api/lxml-pysrc.html @@ -0,0 +1,152 @@ + + + + + lxml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml

+
+ 1  # this is a package 
+ 2   
+
3 -def get_include(): +
4 """ + 5 Returns a list of header include paths (for lxml itself, libxml2 + 6 and libxslt) needed to compile C code against lxml if it was built + 7 with statically linked libraries. + 8 """ + 9 import os +10 lxml_path = __path__[0] +11 include_path = os.path.join(lxml_path, 'includes') +12 includes = [include_path, lxml_path] +13 +14 for name in os.listdir(include_path): +15 path = os.path.join(include_path, name) +16 if os.path.isdir(path): +17 includes.append(path) +18 +19 return includes +
20 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude-module.html b/doc/html/api/lxml.ElementInclude-module.html new file mode 100644 index 00000000..f7a1bc9a --- /dev/null +++ b/doc/html/api/lxml.ElementInclude-module.html @@ -0,0 +1,323 @@ + + + + + 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 +
+   + + LimitedRecursiveIncludeError +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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, + max_depth=6) + source code + +
+ +
+   + + + + + + +
_include(elem, + loader=None, + base_url=None, + max_depth=6, + _parent_hrefs=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' +
+   + + XINCLUDE_ITER_TAG = '{http://www.w3.org/2001/XInclude}*' +
+   + + DEFAULT_MAX_INCLUSION_DEPTH = 6 +
+   + + __package__ = 'lxml' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude-pysrc.html b/doc/html/api/lxml.ElementInclude-pysrc.html new file mode 100644 index 00000000..1556e1e7 --- /dev/null +++ b/doc/html/api/lxml.ElementInclude-pysrc.html @@ -0,0 +1,607 @@ + + + + + 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  try: 
+ 55      from urlparse import urljoin 
+ 56      from urllib2 import urlopen 
+ 57  except ImportError: 
+ 58      # Python 3 
+ 59      from urllib.parse import urljoin 
+ 60      from urllib.request import urlopen 
+ 61   
+ 62  XINCLUDE = "{http://www.w3.org/2001/XInclude}" 
+ 63   
+ 64  XINCLUDE_INCLUDE = XINCLUDE + "include" 
+ 65  XINCLUDE_FALLBACK = XINCLUDE + "fallback" 
+ 66  XINCLUDE_ITER_TAG = XINCLUDE + "*" 
+ 67   
+ 68  # For security reasons, the inclusion depth is limited to this read-only value by default. 
+ 69  DEFAULT_MAX_INCLUSION_DEPTH = 6 
+ 70   
+ 71   
+ 72  ## 
+ 73  # Fatal include error. 
+ 74   
+
75 -class FatalIncludeError(etree.LxmlSyntaxError): +
76 pass +
77 + 78 +
79 -class LimitedRecursiveIncludeError(FatalIncludeError): +
80 pass +
81 + 82 + 83 ## + 84 # ET compatible default loader. + 85 # This loader reads an included resource from disk. + 86 # + 87 # @param href Resource reference. + 88 # @param parse Parse mode. Either "xml" or "text". + 89 # @param encoding Optional text encoding. + 90 # @return The expanded resource. If the parse mode is "xml", this + 91 # is an ElementTree instance. If the parse mode is "text", this + 92 # is a Unicode string. If the loader fails, it can return None + 93 # or raise an IOError exception. + 94 # @throws IOError If the loader fails to load the resource. + 95 +
96 -def default_loader(href, parse, encoding=None): +
97 file = open(href, 'rb') + 98 if parse == "xml": + 99 data = etree.parse(file).getroot() +100 else: +101 data = file.read() +102 if not encoding: +103 encoding = 'utf-8' +104 data = data.decode(encoding) +105 file.close() +106 return data +
107 +108 +109 ## +110 # Default loader used by lxml.etree - handles custom resolvers properly +111 # +112 +
113 -def _lxml_default_loader(href, parse, encoding=None, parser=None): +
114 if parse == "xml": +115 data = etree.parse(href, parser).getroot() +116 else: +117 if "://" in href: +118 f = urlopen(href) +119 else: +120 f = open(href, 'rb') +121 data = f.read() +122 f.close() +123 if not encoding: +124 encoding = 'utf-8' +125 data = data.decode(encoding) +126 return data +
127 +128 +129 ## +130 # Wrapper for ET compatibility - drops the parser +131 +
132 -def _wrap_et_loader(loader): +
133 def load(href, parse, encoding=None, parser=None): +134 return loader(href, parse, encoding) +
135 return load +136 +137 +138 ## +139 # Expand XInclude directives. +140 # +141 # @param elem Root element. +142 # @param loader Optional resource loader. If omitted, it defaults +143 # to {@link default_loader}. If given, it should be a callable +144 # that implements the same interface as <b>default_loader</b>. +145 # @param base_url The base URL of the original file, to resolve +146 # relative include file references. +147 # @param max_depth The maximum number of recursive inclusions. +148 # Limited to reduce the risk of malicious content explosion. +149 # Pass None to disable the limitation. +150 # @throws LimitedRecursiveIncludeError If the {@link max_depth} was exceeded. +151 # @throws FatalIncludeError If the function fails to include a given +152 # resource, or if the tree contains malformed XInclude elements. +153 # @throws IOError If the function fails to load a given resource. +154 # @returns the node or its replacement if it was an XInclude node +155 +
156 -def include(elem, loader=None, base_url=None, +157 max_depth=DEFAULT_MAX_INCLUSION_DEPTH): +
158 if max_depth is None: +159 max_depth = -1 +160 elif max_depth < 0: +161 raise ValueError("expected non-negative depth or None for 'max_depth', got %r" % max_depth) +162 +163 if base_url is None: +164 if hasattr(elem, 'getroot'): +165 tree = elem +166 elem = elem.getroot() +167 else: +168 tree = elem.getroottree() +169 if hasattr(tree, 'docinfo'): +170 base_url = tree.docinfo.URL +171 elif hasattr(elem, 'getroot'): +172 elem = elem.getroot() +173 _include(elem, loader, base_url, max_depth) +
174 +175 +
176 -def _include(elem, loader=None, base_url=None, +177 max_depth=DEFAULT_MAX_INCLUSION_DEPTH, _parent_hrefs=None): +
178 if loader is not None: +179 load_include = _wrap_et_loader(loader) +180 else: +181 load_include = _lxml_default_loader +182 +183 if _parent_hrefs is None: +184 _parent_hrefs = set() +185 +186 parser = elem.getroottree().parser +187 +188 include_elements = list( +189 elem.iter(XINCLUDE_ITER_TAG)) +190 +191 for e in include_elements: +192 if e.tag == XINCLUDE_INCLUDE: +193 # process xinclude directive +194 href = urljoin(base_url, e.get("href")) +195 parse = e.get("parse", "xml") +196 parent = e.getparent() +197 if parse == "xml": +198 if href in _parent_hrefs: +199 raise FatalIncludeError( +200 "recursive include of %r detected" % href +201 ) +202 if max_depth == 0: +203 raise LimitedRecursiveIncludeError( +204 "maximum xinclude depth reached when including file %s" % href) +205 node = load_include(href, parse, parser=parser) +206 if node is None: +207 raise FatalIncludeError( +208 "cannot load %r as %r" % (href, parse) +209 ) +210 node = _include(node, loader, href, max_depth - 1, {href} | _parent_hrefs) +211 if e.tail: +212 node.tail = (node.tail or "") + e.tail +213 if parent is None: +214 return node # replaced the root node! +215 parent.replace(e, node) +216 elif parse == "text": +217 text = load_include(href, parse, encoding=e.get("encoding")) +218 if text is None: +219 raise FatalIncludeError( +220 "cannot load %r as %r" % (href, parse) +221 ) +222 predecessor = e.getprevious() +223 if predecessor is not None: +224 predecessor.tail = (predecessor.tail or "") + text +225 elif parent is None: +226 return text # replaced the root node! +227 else: +228 parent.text = (parent.text or "") + text + (e.tail or "") +229 parent.remove(e) +230 else: +231 raise FatalIncludeError( +232 "unknown parse type in xi:include tag (%r)" % parse +233 ) +234 elif e.tag == XINCLUDE_FALLBACK: +235 parent = e.getparent() +236 if parent is not None and parent.tag != XINCLUDE_INCLUDE: +237 raise FatalIncludeError( +238 "xi:fallback tag must be child of xi:include (%r)" % e.tag +239 ) +240 else: +241 raise FatalIncludeError( +242 "Invalid element found in XInclude namespace (%r)" % e.tag +243 ) +244 return elem +
245 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..275c36f9 --- /dev/null +++ b/doc/html/api/lxml.ElementInclude.FatalIncludeError-class.html @@ -0,0 +1,258 @@ + + + + + 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
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.LxmlError: + __init__, + __new__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

Inherited from etree.LxmlSyntaxError: + __qualname__ +

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

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

+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude.LimitedRecursiveIncludeError-class.html b/doc/html/api/lxml.ElementInclude.LimitedRecursiveIncludeError-class.html new file mode 100644 index 00000000..dcb29b1d --- /dev/null +++ b/doc/html/api/lxml.ElementInclude.LimitedRecursiveIncludeError-class.html @@ -0,0 +1,254 @@ + + + + + lxml.ElementInclude.LimitedRecursiveIncludeError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module ElementInclude :: + Class LimitedRecursiveIncludeError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LimitedRecursiveIncludeError

source code

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

Inherited from etree.LxmlError: + __init__, + __new__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

Inherited from etree.LxmlSyntaxError: + __qualname__ +

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

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

+

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

+

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 00000000..bea86e54 --- /dev/null +++ b/doc/html/api/lxml.builder-module.html @@ -0,0 +1,311 @@ + + + + + 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]
+
+   + + basestring
+ str(object='') -> string +
+   + + unicode
+ str(object='') -> string +
+   + + ElementMaker
+ Element generator factory. +
+ + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
__pyx_unpickle_ElementMaker(...) + source code + +
+ +
+   + + + + + + +
__reduce_cython__(...) + source code + +
+ +
+   + + + + + + +
__setstate_cython__(...) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + E = <lxml.builder.ElementMaker object> +
+   + + __package__ = None
+ hash(x) +
+   + + __pyx_capi__ = {'ET': <capsule object "PyObject *" at 0x7f4dd2... +
+   + + __test__ = {} +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

__pyx_capi__

+ +
+
+
+
Value:
+
+{'ET': <capsule object "PyObject *" at 0x7f4dd2fc6a50>,
+ 'partial': <capsule object "PyObject *" at 0x7f4dd2fc6a80>}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.builder-pysrc.html b/doc/html/api/lxml.builder-pysrc.html new file mode 100644 index 00000000..935d078d --- /dev/null +++ b/doc/html/api/lxml.builder-pysrc.html @@ -0,0 +1,464 @@ + + + + + lxml.builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module builder + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.builder

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

Inherited from object: + __delattr__, + __format__, + __hash__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + _makeelement +
+   + + _namespace +
+   + + _nsmap +
+   + + _typemap +
+

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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__getattribute__(...) +

+
source code  +
+ + x.__getattribute__('name') <==> x.name +
+
Overrides: + object.__getattribute__ +
+
+
+
+ +
+ +
+ + +
+

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

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

__reduce__(...) +

+
source code  +
+ + helper for pickle +
+
Overrides: + object.__reduce__ +
(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 00000000..02c9fff9 --- /dev/null +++ b/doc/html/api/lxml.cssselect-module.html @@ -0,0 +1,254 @@ + + + + + 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.

+

This is a thin wrapper around cssselect 0.7 or later.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + SelectorSyntaxError
+ Parsing a selector that does not match the grammar. +
+   + + ExpressionError
+ Unknown or unsupported selector (eg. pseudo-class). +
+   + + SelectorError
+ Common parent for :class:`SelectorSyntaxError` and +:class:`ExpressionError`. +
+   + + LxmlTranslator
+ A custom CSS selector to XPath translator with lxml-specific extensions. +
+   + + LxmlHTMLTranslator
+ lxml extensions + HTML support. +
+   + + CSSSelector
+ A CSS selector. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
_make_lower_case(context, + s) + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + ns = FunctionNamespace('http://codespeak.net/lxml/css/') +
+   + + __package__ = 'lxml' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect-pysrc.html b/doc/html/api/lxml.cssselect-pysrc.html new file mode 100644 index 00000000..96678e48 --- /dev/null +++ b/doc/html/api/lxml.cssselect-pysrc.html @@ -0,0 +1,341 @@ + + + + + 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  This is a thin wrapper around cssselect 0.7 or later. 
+  7  """ 
+  8   
+  9  from __future__ import absolute_import 
+ 10   
+ 11  from . import etree 
+ 12  try: 
+ 13      import cssselect as external_cssselect 
+ 14  except ImportError: 
+ 15      raise ImportError( 
+ 16          'cssselect does not seem to be installed. ' 
+ 17          'See http://packages.python.org/cssselect/') 
+ 18   
+ 19   
+ 20  SelectorSyntaxError = external_cssselect.SelectorSyntaxError 
+ 21  ExpressionError = external_cssselect.ExpressionError 
+ 22  SelectorError = external_cssselect.SelectorError 
+ 23   
+ 24   
+ 25  __all__ = ['SelectorSyntaxError', 'ExpressionError', 'SelectorError', 
+ 26             'CSSSelector'] 
+ 27   
+ 28   
+
29 -class LxmlTranslator(external_cssselect.GenericTranslator): +
30 """ + 31 A custom CSS selector to XPath translator with lxml-specific extensions. + 32 """ +
33 - def xpath_contains_function(self, xpath, function): +
34 # Defined there, removed in later drafts: + 35 # http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#content-selectors + 36 if function.argument_types() not in (['STRING'], ['IDENT']): + 37 raise ExpressionError( + 38 "Expected a single string or ident for :contains(), got %r" + 39 % function.arguments) + 40 value = function.arguments[0].value + 41 return xpath.add_condition( + 42 'contains(__lxml_internal_css:lower-case(string(.)), %s)' + 43 % self.xpath_literal(value.lower())) +
44 + 45 +
46 -class LxmlHTMLTranslator(LxmlTranslator, external_cssselect.HTMLTranslator): +
47 """ + 48 lxml extensions + HTML support. + 49 """ +
50 + 51 +
52 -def _make_lower_case(context, s): +
53 return s.lower() +
54 + 55 ns = etree.FunctionNamespace('http://codespeak.net/lxml/css/') + 56 ns.prefix = '__lxml_internal_css' + 57 ns['lower-case'] = _make_lower_case + 58 + 59 +
60 -class CSSSelector(etree.XPath): +
61 """A CSS selector. + 62 + 63 Usage:: + 64 + 65 >>> from lxml import etree, cssselect + 66 >>> select = cssselect.CSSSelector("a tag > child") + 67 + 68 >>> root = etree.XML("<a><b><c/><tag><child>TEXT</child></tag></b></a>") + 69 >>> [ el.tag for el in select(root) ] + 70 ['child'] + 71 + 72 To use CSS namespaces, you need to pass a prefix-to-namespace + 73 mapping as ``namespaces`` keyword argument:: + 74 + 75 >>> rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' + 76 >>> select_ns = cssselect.CSSSelector('root > rdf|Description', + 77 ... namespaces={'rdf': rdfns}) + 78 + 79 >>> rdf = etree.XML(( + 80 ... '<root xmlns:rdf="%s">' + 81 ... '<rdf:Description>blah</rdf:Description>' + 82 ... '</root>') % rdfns) + 83 >>> [(el.tag, el.text) for el in select_ns(rdf)] + 84 [('{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Description', 'blah')] + 85 + 86 """ +
87 - def __init__(self, css, namespaces=None, translator='xml'): +
88 if translator == 'xml': + 89 translator = LxmlTranslator() + 90 elif translator == 'html': + 91 translator = LxmlHTMLTranslator() + 92 elif translator == 'xhtml': + 93 translator = LxmlHTMLTranslator(xhtml=True) + 94 path = translator.css_to_xpath(css) + 95 etree.XPath.__init__(self, path, namespaces=namespaces) + 96 self.css = css +
97 +
98 - def __repr__(self): +
99 return '<%s %s for %r>' % ( +100 self.__class__.__name__, +101 hex(abs(id(self)))[2:], +102 self.css) +
103 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0bff99e6 --- /dev/null +++ b/doc/html/api/lxml.cssselect.CSSSelector-class.html @@ -0,0 +1,331 @@ + + + + + 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']
+
+

To use CSS namespaces, you need to pass a prefix-to-namespace +mapping as namespaces keyword argument:

+
+>>> rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
+>>> select_ns = cssselect.CSSSelector('root > rdf|Description',
+...                                   namespaces={'rdf': rdfns})
+
+>>> rdf = etree.XML((
+...     '<root xmlns:rdf="%s">'
+...       '<rdf:Description>blah</rdf:Description>'
+...     '</root>') % rdfns)
+>>> [(el.tag, el.text) for el in select_ns(rdf)]
+[('{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Description', 'blah')]
+
+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + css, + namespaces=None, + translator='xml')
+ x.__init__(...) initializes x; see help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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, + namespaces=None, + translator='xml') +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.LxmlHTMLTranslator-class.html b/doc/html/api/lxml.cssselect.LxmlHTMLTranslator-class.html new file mode 100644 index 00000000..92a1db66 --- /dev/null +++ b/doc/html/api/lxml.cssselect.LxmlHTMLTranslator-class.html @@ -0,0 +1,334 @@ + + + + + lxml.cssselect.LxmlHTMLTranslator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class LxmlHTMLTranslator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LxmlHTMLTranslator

source code

+
+                       object --+        
+                                |        
+cssselect.xpath.GenericTranslator --+    
+                                    |    
+                       LxmlTranslator --+
+                                        |
+                       object --+       |
+                                |       |
+cssselect.xpath.GenericTranslator --+   |
+                                    |   |
+       cssselect.xpath.HTMLTranslator --+
+                                        |
+                                       LxmlHTMLTranslator
+
+ +
+lxml extensions + HTML support. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from cssselect.xpath.GenericTranslator: + xpathexpr_cls +

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

Inherited from LxmlTranslator: + xpath_contains_function +

+

Inherited from cssselect.xpath.HTMLTranslator: + __init__, + xpath_checked_pseudo, + xpath_disabled_pseudo, + xpath_enabled_pseudo, + xpath_lang_function, + xpath_link_pseudo +

+

Inherited from cssselect.xpath.GenericTranslator: + css_to_xpath, + pseudo_never_matches, + selector_to_xpath, + xpath, + xpath_active_pseudo, + xpath_attrib, + xpath_attrib_dashmatch, + xpath_attrib_different, + xpath_attrib_equals, + xpath_attrib_exists, + xpath_attrib_includes, + xpath_attrib_prefixmatch, + xpath_attrib_substringmatch, + xpath_attrib_suffixmatch, + xpath_child_combinator, + xpath_class, + xpath_combinedselector, + xpath_descendant_combinator, + xpath_direct_adjacent_combinator, + xpath_element, + xpath_empty_pseudo, + xpath_first_child_pseudo, + xpath_first_of_type_pseudo, + xpath_focus_pseudo, + xpath_function, + xpath_hash, + xpath_hover_pseudo, + xpath_indirect_adjacent_combinator, + xpath_last_child_pseudo, + xpath_last_of_type_pseudo, + xpath_negation, + xpath_nth_child_function, + xpath_nth_last_child_function, + xpath_nth_last_of_type_function, + xpath_nth_of_type_function, + xpath_only_child_pseudo, + xpath_only_of_type_pseudo, + xpath_pseudo, + xpath_pseudo_element, + xpath_root_pseudo, + xpath_target_pseudo, + xpath_visited_pseudo +

+

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

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

Inherited from cssselect.xpath.GenericTranslator: + xpath_literal +

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

Inherited from cssselect.xpath.HTMLTranslator: + lang_attribute +

+

Inherited from cssselect.xpath.GenericTranslator: + attribute_operator_mapping, + combinator_mapping, + id_attribute, + lower_case_attribute_names, + lower_case_attribute_values, + lower_case_element_names +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.LxmlTranslator-class.html b/doc/html/api/lxml.cssselect.LxmlTranslator-class.html new file mode 100644 index 00000000..20054af2 --- /dev/null +++ b/doc/html/api/lxml.cssselect.LxmlTranslator-class.html @@ -0,0 +1,386 @@ + + + + + lxml.cssselect.LxmlTranslator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class LxmlTranslator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LxmlTranslator

source code

+
+                       object --+    
+                                |    
+cssselect.xpath.GenericTranslator --+
+                                    |
+                                   LxmlTranslator
+
+ +
Known Subclasses:
+
+ +
+ +
+A custom CSS selector to XPath translator with lxml-specific extensions. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from cssselect.xpath.GenericTranslator: + xpathexpr_cls +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
xpath_contains_function(self, + xpath, + function) + source code + +
+ +
+

Inherited from cssselect.xpath.GenericTranslator: + css_to_xpath, + pseudo_never_matches, + selector_to_xpath, + xpath, + xpath_active_pseudo, + xpath_attrib, + xpath_attrib_dashmatch, + xpath_attrib_different, + xpath_attrib_equals, + xpath_attrib_exists, + xpath_attrib_includes, + xpath_attrib_prefixmatch, + xpath_attrib_substringmatch, + xpath_attrib_suffixmatch, + xpath_checked_pseudo, + xpath_child_combinator, + xpath_class, + xpath_combinedselector, + xpath_descendant_combinator, + xpath_direct_adjacent_combinator, + xpath_disabled_pseudo, + xpath_element, + xpath_empty_pseudo, + xpath_enabled_pseudo, + xpath_first_child_pseudo, + xpath_first_of_type_pseudo, + xpath_focus_pseudo, + xpath_function, + xpath_hash, + xpath_hover_pseudo, + xpath_indirect_adjacent_combinator, + xpath_lang_function, + xpath_last_child_pseudo, + xpath_last_of_type_pseudo, + xpath_link_pseudo, + xpath_negation, + xpath_nth_child_function, + xpath_nth_last_child_function, + xpath_nth_last_of_type_function, + xpath_nth_of_type_function, + xpath_only_child_pseudo, + xpath_only_of_type_pseudo, + xpath_pseudo, + xpath_pseudo_element, + xpath_root_pseudo, + xpath_target_pseudo, + xpath_visited_pseudo +

+

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

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

Inherited from cssselect.xpath.GenericTranslator: + xpath_literal +

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

Inherited from cssselect.xpath.GenericTranslator: + attribute_operator_mapping, + combinator_mapping, + id_attribute, + lang_attribute, + lower_case_attribute_names, + lower_case_attribute_values, + lower_case_element_names +

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

Inherited from object: + __class__ +

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

xpath_contains_function(self, + xpath, + function) +

+
source code  +
+ + +
+
Overrides: + cssselect.xpath.GenericTranslator.xpath_contains_function +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare-module.html b/doc/html/api/lxml.doctestcompare-module.html new file mode 100644 index 00000000..ff638624 --- /dev/null +++ b/doc/html/api/lxml.doctestcompare-module.html @@ -0,0 +1,498 @@ + + + + + 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 = <lxml.etree.HTMLParser object> +
+   + + _repr_re = re.compile(r'^<[^>]+ (at|object) ') +
+   + + _norm_whitespace_re = re.compile(r'[ \t\n][ \t\n]+') +
+   + + __test__ = {'basic': '\n >>> temp_install()\n >>> print ... +
+   + + __package__ = 'lxml' +
+ + + + + + +
+ + + + + +
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]
+
+ +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..a6f4b88e --- /dev/null +++ b/doc/html/api/lxml.etree-module.html @@ -0,0 +1,2656 @@ + + + + + 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: + 4.4.3 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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. +
+   + + C14NWriterTarget
+ Canonicalization writer target for the XMLParser. +
+   + + 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, huge_tree=False, 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, smart_strings=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, schema: XMLSchema =None, recover=True, compact=True, collect_ids=True, huge_tree=False) +
+   + + HTMLPullParser
+ HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs) +
+   + + LxmlError
+ Main exception base class for lxml. All other exceptions inherit from +this one. +
+   + + 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, logger=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_or_element, 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
+ comment_factory=None, pi_factory=None, +insert_comments=True, insert_pis=True) +
+   + + 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, schema: XMLSchema =None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, collect_ids=True, target=None, compact=True) +
+   + + XMLPullParser
+ XMLPullParser(self, events=None, *, tag=None, **kwargs) +
+   + + 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. +
+   + + XMLTreeBuilder
+ ETCompatXMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema=None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=True, remove_pis=True, strip_cdata=True, target=None, compact=True) +
+   + + 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. +
+   + + _Attrib
+ A dict-like proxy for the Element.attrib property. +
+   + + _BaseErrorLog +
+   + + _Comment +
+   + + _Document
+ Internal base class to reference a libxml document. +
+   + + _DomainErrorLog +
+   + + _Element
+ Element class. +
+   + + _ElementIterator
+ Dead but public. :) +
+   + + _ElementMatchIterator +
+   + + _ElementStringResult +
+   + + _ElementTagMatcher
+ Dead but public. :) +
+   + + _ElementTree +
+   + + _ElementUnicodeResult +
+   + + _Entity +
+   + + _ErrorLog +
+   + + _FeedParser +
+   + + _IDDict
+ IDDict(self, etree) +A dictionary-like proxy class that mapps ID attributes to elements. +
+   + + _ListErrorLog
+ Immutable base version of a list based error log. +
+   + + _LogEntry
+ A log message entry from an error log. +
+   + + _ProcessingInstruction +
+   + + _RotatingErrorLog +
+   + + _SaxParserTarget +
+   + + _TargetParserResult +
+   + + _Validator
+ Base class for XML validators. +
+   + + _XPathEvaluatorBase +
+   + + _XSLTProcessingInstruction +
+   + + _XSLTResultTree
+ The result of an XSLT evaluation. +
+   + + htmlfile
+ htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True) +
+   + + 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, recover=None, huge_tree=False, schema=None) +
+   + + iterwalk
+ iterwalk(self, element_or_tree, events=("end",), tag=None) +
+   + + xmlfile
+ xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True) +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[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.
+ + +
+ +
+   + + + + + + +
ElementTree(element=None, + file=None, + parser=None)
+ ElementTree wrapper class.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+   + + + + + + +
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. Returns the root +node (or the result returned by a parser target). This function +can be used to embed "HTML literals" in Python code.
+ + +
+ +
+   + + + + + + +
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
+ + +
+ +
+   + + + + + + +
XMLDTDID(text, + parser=None, + base_url=None)
+ 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.
+ + +
+ +
+   + + + + + + +
XMLID(text, + parser=None, + base_url=None)
+ 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.
+ + +
+ +
+   + + + + + + +
adopt_external_document(capsule, + parser=None)
+ Unpack a libxml2 document pointer from a PyCapsule and wrap it in an +lxml ElementTree object.
+ + +
+ +
+   + + + + + + +
canonicalize(...)
+ Convert XML to its C14N 2.0 serialised form.
+ + +
+ +
+   + + + + + + +
cleanup_namespaces(tree_or_element, + top_nsmap=None, + keep_ns_prefixes=None)
+ 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. Note that this log is already bound to a +fixed size.
+ + +
+ +
+   + + + + + + +
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).
+ + +
+ +
+   + + + + + + +
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).
+ + +
+ +
+   + + + + + + +
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. If no parser +is provided as second argument, the default parser is used.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+   + + + + + + +
register_namespace(...)
+ Registers a namespace prefix that newly created Elements in that +namespace will use. The registry is global, and any existing +mapping for either the given prefix or the namespace URI will be +removed.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+   + + + + + + +
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. 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 keyword argument option to False.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+   + + + + + + +
tostring(element_or_tree, + encoding=None, + method="xml", + xml_declaration=None, + pretty_print=False, + with_tail=True, + standalone=None, + doctype=None, + exclusive=False, + inclusive_ns_prefixes=None, + with_comments=True, + strip_text=False, + )
+ 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, + doctype=None)
+ 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, 9, 4) +
+   + + LIBXML_VERSION = (2, 9, 4) +
+   + + LIBXSLT_COMPILED_VERSION = (1, 1, 29) +
+   + + LIBXSLT_VERSION = (1, 1, 29) +
+   + + LXML_VERSION = (4, 4, 3, 0) +
+   + + __package__ = None
+ hash(x) +
+   + + __pyx_capi__ = {'adoptExternalDocument': <capsule object "stru... +
+   + + __test__ = {u'FunctionNamespace (line 207)': u'FunctionNamespa... +
+   + + memory_debugger = <lxml.etree._MemDebug object> +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

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.

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

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.

+

Usage:

+
+>>> ns_functions = FunctionNamespace("http://schema.org/Movie")
+
+>>> @ns_functions  # uses function name
+... def add2(x):
+...     return x + 2
+
+>>> @ns_functions("add3")  # uses explicit name
+... def add_three(x):
+...     return x + 3
+
+
+
+
+ +
+ +
+ + +
+

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, ...).

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

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 = XML("<root><test/></root>")
+>>> print(root.tag)
+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, + parser=None, + base_url=None) +

+
  +
+ +

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.

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

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.

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

adopt_external_document(capsule, + parser=None) +

+
  +
+ +

Unpack a libxml2 document pointer from a PyCapsule and wrap it in an +lxml ElementTree object.

+

This allows external libraries to build XML/HTML trees using libxml2 +and then pass them efficiently into lxml for further processing.

+

If a parser is provided, it will be used for configuring the +lxml document. No parsing will be done.

+

The capsule must have the name "libxml2:xmlDoc" and its pointer +value must reference a correct libxml2 document of type xmlDoc*. +The creator of the capsule must take care to correctly clean up the +document using an appropriate capsule destructor. By default, the +libxml2 document will be copied to let lxml safely own the memory +of the internal tree that it uses.

+

If the capsule context is non-NULL, it must point to a C string that +can be compared using strcmp(). If the context string equals +"destructor:xmlFreeDoc", the libxml2 document will not be copied +but the capsule invalidated instead by clearing its destructor and +name. That way, lxml takes ownership of the libxml2 document in memory +without creating a copy first, and the capsule destructor will not be +called. The document will then eventually be cleaned up by lxml using +the libxml2 API function xmlFreeDoc() once it is no longer used.

+

If no copy is made, later modifications of the tree outside of lxml +should not be attempted after transferring the ownership.

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

canonicalize(...) +

+
  +
+ +

Convert XML to its C14N 2.0 serialised form.

+

If out is provided, it must be a file or file-like object that receives +the serialised canonical XML output (text, not bytes) through its .write() +method. To write to a file, open it in text mode with encoding "utf-8". +If out is not provided, this function returns the output as text string.

+

Either xml_data (an XML string, tree or Element) or file +(a file path or file-like object) must be provided as input.

+

The configuration options are the same as for the C14NWriterTarget.

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

cleanup_namespaces(tree_or_element, + top_nsmap=None, + keep_ns_prefixes=None) +

+
  +
+ +

Remove all namespace declarations from a subtree that are not used +by any of the elements or attributes in that tree.

+

If a 'top_nsmap' is provided, it must be a mapping from prefixes +to namespace URIs. These namespaces will be declared on the top +element of the subtree before running the cleanup, which allows +moving namespace declarations to the top of the tree.

+

If a 'keep_ns_prefixes' is provided, it must be a list of prefixes. +These prefixes will not be removed as part of the cleanup.

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

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.

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

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 source can be any of the following:

+
    +
  • a file name/path
  • +
  • a file object
  • +
  • a file-like object
  • +
  • a URL using the HTTP or FTP protocol
  • +
+

To parse from a string, use the fromstring() function instead.

+

Note that it is generally faster to parse from a file path or URL +than from an open file object or file-like object. Transparent +decompression from gzip compressed sources is supported (unless +explicitly disabled in libxml2).

+

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.

+

Attribute names can contain wildcards as in _Element.iter.

+

Example usage:

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

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 keyword argument option to False.

+

Tag names can contain wildcards as in _Element.iter.

+

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
+    lxml.etree.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.

+

Tag names can contain wildcards as in _Element.iter.

+

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, + doctype=None, + exclusive=False, + inclusive_ns_prefixes=None, + with_comments=True, + strip_text=False, + ) +

+
  +
+ +

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 name 'unicode' as encoding (or the str function +in Py3 or unicode in Py2). This changes the return value from +a byte string to an unencoded unicode string.

+

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

+

The keyword argument 'method' selects the output method: 'xml', +'html', plain 'text' (text content without tags), 'c14n' or 'c14n2'. +Default is 'xml'.

+

With method="c14n" (C14N version 1), the options exclusive, +with_comments and inclusive_ns_prefixes request exclusive +C14N, include comments, and list the inclusive prefixes respectively.

+

With method="c14n2" (C14N version 2), the with_comments and +strip_text options control the output of comments and text space +according to C14N 2.0.

+

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

+

The doctype option allows passing in a plain string that will +be serialised before the XML tree. Note that passing in non +well-formed content here will make the XML output non well-formed. +Also, an existing doctype in the document tree will not be removed +when serialising an ElementTree instance.

+

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, + doctype=None) +

+
  +
+ +

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:
+
+{'adoptExternalDocument': <capsule object "struct LxmlElementTree *(xm\
+lDoc *, PyObject *, int)" at 0x7f4dd3ff67b0>,
+ 'appendChild': <capsule object "void (struct LxmlElement *, struct Lx\
+mlElement *)" at 0x7f4dd3ff6f90>,
+ 'appendChildToElement': <capsule object "int (struct LxmlElement *, s\
+truct LxmlElement *)" at 0x7f4dd3ff6fc0>,
+ 'attributeValue': <capsule object "PyObject *(xmlNode *, xmlAttr *)" \
+at 0x7f4dd3ff6c60>,
+...
+
+
+
+
+
+ +
+ +
+

__test__

+ +
+
+
+
Value:
+
+{u'FunctionNamespace (line 207)': 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.
+
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..31c768b8 --- /dev/null +++ b/doc/html/api/lxml.etree.AncestorsIterator-class.html @@ -0,0 +1,256 @@ + + + + + lxml.etree.AncestorsIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class AncestorsIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class AncestorsIterator

+
+           object --+    
+                    |    
+_ElementMatchIterator --+
+                        |
+                       AncestorsIterator
+
+ +
+AncestorsIterator(self, node, tag=None) +Iterates over the ancestors of an element (from parent to parent). + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

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

+
+ + + + + + + + + +
+ + + + + +
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.AttributeBasedElementClassLookup-class.html b/doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html new file mode 100644 index 00000000..cce8dc4d --- /dev/null +++ b/doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html @@ -0,0 +1,316 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from FallbackElementClassLookup: + set_fallback +

+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..24d2be8a --- /dev/null +++ b/doc/html/api/lxml.etree.C14NError-class.html @@ -0,0 +1,268 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.C14NWriterTarget-class.html b/doc/html/api/lxml.etree.C14NWriterTarget-class.html new file mode 100644 index 00000000..4a48bede --- /dev/null +++ b/doc/html/api/lxml.etree.C14NWriterTarget-class.html @@ -0,0 +1,434 @@ + + + + + lxml.etree.C14NWriterTarget + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class C14NWriterTarget + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class C14NWriterTarget

+
+object --+
+         |
+        C14NWriterTarget
+
+ +
+

Canonicalization writer target for the XMLParser.

+

Serialises parse events to XML C14N 2.0.

+

Configuration options:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_iter_namespaces(...) + + +
+ +
+   + + + + + + +
close(...) + + +
+ +
+   + + + + + + +
comment(...) + + +
+ +
+   + + + + + + +
data(...) + + +
+ +
+   + + + + + + +
end(...) + + +
+ +
+   + + + + + + +
pi(...) + + +
+ +
+   + + + + + + +
start(...) + + +
+ +
+   + + + + + + +
start_ns(...) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.CDATA-class.html b/doc/html/api/lxml.etree.CDATA-class.html new file mode 100644 index 00000000..8f582215 --- /dev/null +++ b/doc/html/api/lxml.etree.CDATA-class.html @@ -0,0 +1,259 @@ + + + + + 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:

+
+>>> el = Element('content')
+>>> el.text = CDATA('a string')
+
+>>> print(el.text)
+a string
+>>> print(tostring(el, encoding="unicode"))
+<content><![CDATA[a string]]></content>
+
+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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.CommentBase-class.html b/doc/html/api/lxml.etree.CommentBase-class.html new file mode 100644 index 00000000..8ca8f849 --- /dev/null +++ b/doc/html/api/lxml.etree.CommentBase-class.html @@ -0,0 +1,372 @@ + + + + + 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.

+

To create an XML Comment instance, use the Comment() factory.

+

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]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Comment: + __repr__ +

+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _Comment: + tag +

+

Inherited from unreachable.__ContentOnlyElement: + attrib, + text +

+

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.CustomElementClassLookup-class.html b/doc/html/api/lxml.etree.CustomElementClassLookup-class.html new file mode 100644 index 00000000..c60b29ef --- /dev/null +++ b/doc/html/api/lxml.etree.CustomElementClassLookup-class.html @@ -0,0 +1,295 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..31b07bb7 --- /dev/null +++ b/doc/html/api/lxml.etree.DTD-class.html @@ -0,0 +1,434 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
elements(...) + + +
+ +
+   + + + + + + +
entities(...) + + +
+ +
+   + + + + + + +
iterelements(...) + + +
+ +
+   + + + + + + +
iterentities(...) + + +
+ +
+

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

+

Inherited from _Validator (private): + _append_log_message, + _clear_error_log +

+

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

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + external_id +
+   + + name +
+   + + system_url +
+

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 help(type(x)) 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 00000000..a8f29478 --- /dev/null +++ b/doc/html/api/lxml.etree.DTDError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.DTDParseError-class.html b/doc/html/api/lxml.etree.DTDParseError-class.html new file mode 100644 index 00000000..d72cb1f8 --- /dev/null +++ b/doc/html/api/lxml.etree.DTDParseError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.DTDValidateError-class.html b/doc/html/api/lxml.etree.DTDValidateError-class.html new file mode 100644 index 00000000..d836e619 --- /dev/null +++ b/doc/html/api/lxml.etree.DTDValidateError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.DocInfo-class.html b/doc/html/api/lxml.etree.DocInfo-class.html new file mode 100644 index 00000000..1eac9fc7 --- /dev/null +++ b/doc/html/api/lxml.etree.DocInfo-class.html @@ -0,0 +1,395 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
clear(...)
+ Removes DOCTYPE and internal subset from the document.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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
+ 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. 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. +
+   + + system_url
+ System ID of the DOCTYPE. +
+   + + xml_version
+ Returns the XML version as declared by the document. +
+

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]
+
+ +
+ +
+

public_id

+

Public ID of the DOCTYPE.

+

Mutable. May be set to a valid string or None. If a DTD does not +exist, setting this variable (even to None) will create one.

+
+
+
+
+ +
+ +
+

system_url

+

System ID of the DOCTYPE.

+

Mutable. May be set to a valid string or None. If a DTD does not +exist, setting this variable (even to None) will create one.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9d430f72 --- /dev/null +++ b/doc/html/api/lxml.etree.DocumentInvalid-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.ETCompatXMLParser-class.html b/doc/html/api/lxml.etree.ETCompatXMLParser-class.html new file mode 100644 index 00000000..5007fe08 --- /dev/null +++ b/doc/html/api/lxml.etree.ETCompatXMLParser-class.html @@ -0,0 +1,348 @@ + + + + + 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, huge_tree=False, 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, + huge_tree=False, + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

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

+

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

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

Inherited from _FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + 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, + huge_tree=False, + 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 help(type(x)) 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 00000000..5ac44708 --- /dev/null +++ b/doc/html/api/lxml.etree.ETXPath-class.html @@ -0,0 +1,316 @@ + + + + + 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, smart_strings=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, + smart_strings=True)
+ x.__init__(...) initializes x; see help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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, + smart_strings=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..b59c2e8c --- /dev/null +++ b/doc/html/api/lxml.etree.ElementBase-class.html @@ -0,0 +1,385 @@ + + + + + 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:

+ +

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 help(type(x)) 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, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..8a3821e7 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementChildIterator-class.html @@ -0,0 +1,256 @@ + + + + + lxml.etree.ElementChildIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementChildIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementChildIterator

+
+           object --+    
+                    |    
+_ElementMatchIterator --+
+                        |
+                       ElementChildIterator
+
+ +
+ElementChildIterator(self, node, tag=None, reversed=False) +Iterates over the children of an element. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

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

+
+ + + + + + + + + +
+ + + + + +
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.ElementClassLookup-class.html b/doc/html/api/lxml.etree.ElementClassLookup-class.html new file mode 100644 index 00000000..0318b6f1 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementClassLookup-class.html @@ -0,0 +1,255 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..5ad68a87 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementDefaultClassLookup-class.html @@ -0,0 +1,329 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..0703e1ee --- /dev/null +++ b/doc/html/api/lxml.etree.ElementDepthFirstIterator-class.html @@ -0,0 +1,310 @@ + + + + + lxml.etree.ElementDepthFirstIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementDepthFirstIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementDepthFirstIterator

+
+object --+
+         |
+        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 +argument to receive only Elements.

+

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]
+
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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.ElementNamespaceClassLookup-class.html b/doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html new file mode 100644 index 00000000..e5f99f40 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html @@ -0,0 +1,354 @@ + + + + + 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.

+

Usage:

+
+>>> lookup = ElementNamespaceClassLookup()
+>>> ns_elements = lookup.get_namespace("http://schema.org/Movie")
+
+>>> @ns_elements
+... class movie(ElementBase):
+...     "Element implementation for 'movie' tag (using class name) in schema namespace."
+
+>>> @ns_elements("movie")
+... class MovieElement(ElementBase):
+...     "Element implementation for 'movie' tag (explicit tag name) in schema namespace."
+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + fallback=None)
+ x.__init__(...) initializes x; see help(type(x)) 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. +Pass None for the empty namespace.
+ + +
+ +
+

Inherited from FallbackElementClassLookup: + set_fallback +

+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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. +Pass None for the empty namespace.

+

Creates a new namespace object 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 00000000..3cb0033c --- /dev/null +++ b/doc/html/api/lxml.etree.ElementTextIterator-class.html @@ -0,0 +1,302 @@ + + + + + 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 (e.g. if you know that it's only whitespace from pretty-printing).

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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.EntityBase-class.html b/doc/html/api/lxml.etree.EntityBase-class.html new file mode 100644 index 00000000..5f759042 --- /dev/null +++ b/doc/html/api/lxml.etree.EntityBase-class.html @@ -0,0 +1,373 @@ + + + + + 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.

+

To create an XML Entity instance, use the Entity() factory.

+

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]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Entity: + __repr__ +

+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _Entity: + name, + tag, + text +

+

Inherited from unreachable.__ContentOnlyElement: + attrib +

+

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.Error-class.html b/doc/html/api/lxml.etree.Error-class.html new file mode 100644 index 00000000..d1287772 --- /dev/null +++ b/doc/html/api/lxml.etree.Error-class.html @@ -0,0 +1,268 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from exceptions.Exception: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.ErrorDomains-class.html b/doc/html/api/lxml.etree.ErrorDomains-class.html new file mode 100644 index 00000000..327fb1a3 --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorDomains-class.html @@ -0,0 +1,508 @@ + + + + + lxml.etree.ErrorDomains + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorDomains + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorDomains

+
+object --+
+         |
+        ErrorDomains
+
+ +
+Libxml2 error domains + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + BUFFER = 29 +
+   + + 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 +
+   + + URI = 30 +
+   + + VALID = 23 +
+   + + WRITER = 25 +
+   + + XINCLUDE = 11 +
+   + + XPATH = 12 +
+   + + XPOINTER = 13 +
+   + + XSLT = 22 +
+   + + __qualname__ = 'ErrorDomains' +
+   + + _names = {0: 'NONE', 1: 'PARSER', 2: 'TREE', 3: 'NAMESPACE', 4... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: 'NONE',
+ 1: 'PARSER',
+ 2: 'TREE',
+ 3: 'NAMESPACE',
+ 4: 'DTD',
+ 5: 'HTML',
+ 6: 'MEMORY',
+ 7: '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 00000000..868c689f --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorLevels-class.html @@ -0,0 +1,266 @@ + + + + + lxml.etree.ErrorLevels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorLevels + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorLevels

+
+object --+
+         |
+        ErrorLevels
+
+ +
+Libxml2 error levels + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + ERROR = 2 +
+   + + FATAL = 3 +
+   + + NONE = 0 +
+   + + WARNING = 1 +
+   + + __qualname__ = 'ErrorLevels' +
+   + + _names = {0: 'NONE', 1: 'WARNING', 2: 'ERROR', 3: 'FATAL'} +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..fdab5f74 --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorTypes-class.html @@ -0,0 +1,5429 @@ + + + + + lxml.etree.ErrorTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorTypes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorTypes

+
+object --+
+         |
+        ErrorTypes
+
+ +
+Libxml2 error types + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + BUF_OVERFLOW = 7000 +
+   + + 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_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 +
+   + + 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_NAME_TOO_LONG = 110 +
+   + + 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_USER_STOP = 111 +
+   + + 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 +
+   + + __qualname__ = 'ErrorTypes' +
+   + + _names = {0: 'ERR_OK', 1: 'ERR_INTERNAL_ERROR', 2: 'ERR_NO_MEM... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: 'ERR_OK',
+ 1: 'ERR_INTERNAL_ERROR',
+ 2: 'ERR_NO_MEMORY',
+ 3: 'ERR_DOCUMENT_START',
+ 4: 'ERR_DOCUMENT_EMPTY',
+ 5: 'ERR_DOCUMENT_END',
+ 6: 'ERR_INVALID_HEX_CHARREF',
+ 7: '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 00000000..463be2ed --- /dev/null +++ b/doc/html/api/lxml.etree.FallbackElementClassLookup-class.html @@ -0,0 +1,323 @@ + + + + + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from object: + __class__ +

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

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

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..1e6844d2 --- /dev/null +++ b/doc/html/api/lxml.etree.HTMLParser-class.html @@ -0,0 +1,370 @@ + + + + + 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, schema: XMLSchema =None, recover=True, compact=True, collect_ids=True, huge_tree=False)

+

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:

+ +

Other keyword arguments:

+ +

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, + schema: XMLSchema=None, + recover=True, + compact=True, + collect_ids=True, + huge_tree=False)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

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

+

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

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

Inherited from _FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + 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, + schema: XMLSchema=None, + recover=True, + compact=True, + collect_ids=True, + huge_tree=False) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.HTMLPullParser-class.html b/doc/html/api/lxml.etree.HTMLPullParser-class.html new file mode 100644 index 00000000..a260836b --- /dev/null +++ b/doc/html/api/lxml.etree.HTMLPullParser-class.html @@ -0,0 +1,349 @@ + + + + + lxml.etree.HTMLPullParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class HTMLPullParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTMLPullParser

+
+    object --+            
+             |            
+??._BaseParser --+        
+                 |        
+       _FeedParser --+    
+                     |    
+            HTMLParser --+
+                         |
+                        HTMLPullParser
+
+ +
+

HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)

+

HTML parser that collects parse events in an iterator.

+

The collected events are the same as for iterparse(), but the +parser itself is non-blocking in the sense that it receives +data chunks incrementally through its .feed() method, instead +of reading them directly from a file(-like) object all by itself.

+

By default, it collects Element end events. To change that, +pass any subset of the available events into the events +argument: 'start', 'end', 'start-ns', +'end-ns', 'comment', 'pi'.

+

To support loading external dependencies relative to the input +source, you can pass the base_url.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + events=None, + tag=None, + base_url=None, + *, + **kwargs)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
read_events(...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

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

+

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

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

Inherited from _FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + version +

+

Inherited from object: + __class__ +

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

__init__(self, + events=None, + tag=None, + base_url=None, + *, + **kwargs) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..314c6f78 --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlError-class.html @@ -0,0 +1,310 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.LxmlRegistryError-class.html b/doc/html/api/lxml.etree.LxmlRegistryError-class.html new file mode 100644 index 00000000..445a07a5 --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlRegistryError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.LxmlSyntaxError-class.html b/doc/html/api/lxml.etree.LxmlSyntaxError-class.html new file mode 100644 index 00000000..593bd0b6 --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlSyntaxError-class.html @@ -0,0 +1,258 @@ + + + + + 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__, + __new__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'LxmlSyntaxError' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

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

+

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

+

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 00000000..37abd59c --- /dev/null +++ b/doc/html/api/lxml.etree.NamespaceRegistryError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.PIBase-class.html b/doc/html/api/lxml.etree.PIBase-class.html new file mode 100644 index 00000000..cf023c76 --- /dev/null +++ b/doc/html/api/lxml.etree.PIBase-class.html @@ -0,0 +1,374 @@ + + + + + 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.

+

To create an XML ProcessingInstruction instance, use the PI() +factory.

+

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]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _ProcessingInstruction: + __repr__, + get +

+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _ProcessingInstruction: + attrib, + tag, + target +

+

Inherited from unreachable.__ContentOnlyElement: + text +

+

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.ParseError-class.html b/doc/html/api/lxml.etree.ParseError-class.html new file mode 100644 index 00000000..258a6ca7 --- /dev/null +++ b/doc/html/api/lxml.etree.ParseError-class.html @@ -0,0 +1,363 @@ + + + + + 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]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+

Inherited from LxmlError: + __new__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'ParseError' +
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + position +
+

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

+

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

position

+ +
+
Get Method:
+
unreachable.position(...) +
+
Set Method:
+
unreachable.position(...) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..eecd80fd --- /dev/null +++ b/doc/html/api/lxml.etree.ParserBasedElementClassLookup-class.html @@ -0,0 +1,259 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..b53f2334 --- /dev/null +++ b/doc/html/api/lxml.etree.ParserError-class.html @@ -0,0 +1,268 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.PyErrorLog-class.html b/doc/html/api/lxml.etree.PyErrorLog-class.html new file mode 100644 index 00000000..f233a99c --- /dev/null +++ b/doc/html/api/lxml.etree.PyErrorLog-class.html @@ -0,0 +1,456 @@ + + + + + lxml.etree.PyErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class PyErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PyErrorLog

+
+   object --+    
+            |    
+_BaseErrorLog --+
+                |
+               PyErrorLog
+
+ +
+

PyErrorLog(self, logger_name=None, logger=None) +A global error log that connects to the Python stdlib logging package.

+

The constructor accepts an optional logger name or a readily +instantiated logger instance.

+

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, + logger=None)
+ x.__init__(...) initializes x; see help(type(x)) 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. This handles the error level +mapping.
+ + +
+ +
+   + + + + + + +
receive(self, + log_entry)
+ Receive a _LogEntry instance from the logging system. Calls +the .log() method with appropriate parameters:
+ + +
+ +
+

Inherited from _BaseErrorLog: + __repr__ +

+

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

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

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

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

__init__(self, + logger_name=None, + logger=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.

+
+
Overrides: + _BaseErrorLog.receive +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9e3e058a --- /dev/null +++ b/doc/html/api/lxml.etree.PythonElementClassLookup-class.html @@ -0,0 +1,312 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..b0a14e4e --- /dev/null +++ b/doc/html/api/lxml.etree.QName-class.html @@ -0,0 +1,510 @@ + + + + + lxml.etree.QName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class QName + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class QName

+
+object --+
+         |
+        QName
+
+ +
+

QName(text_or_uri_or_element, 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. Alternatively, pass an Element to +extract its tag name. None as first argument is ignored in +order to allow for generic 2-argument usage.

+

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 +on assignment and set a qualified text value. This is helpful in XML +languages like SOAP or XML-Schema that use prefixed tag names in +their text content.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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_or_element, + tag=None)
+ x.__init__(...) initializes x; see help(type(x)) 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__(x)
+ str(x)
+ + +
+ +
+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
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_or_element, + tag=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..a8356186 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNG-class.html @@ -0,0 +1,406 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

Inherited from _Validator (private): + _append_log_message, + _clear_error_log +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+   + + + + + + +
from_rnc_string(...)
+ Parse a RelaxNG schema in compact syntax from a text string
+ + +
+ +
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

from_rnc_string(...) +
Class Method +

+
  +
+ +

Parse a RelaxNG schema in compact syntax from a text string

+

Requires the rnc2rng package to be installed.

+

Passing the source URL or file path of the source as 'base_url' +will enable resolving resource references relative to the source.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..2cd8998c --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.RelaxNGErrorTypes-class.html b/doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html new file mode 100644 index 00000000..15860fe9 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html @@ -0,0 +1,571 @@ + + + + + lxml.etree.RelaxNGErrorTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNGErrorTypes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGErrorTypes

+
+object --+
+         |
+        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.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 +
+   + + __qualname__ = 'RelaxNGErrorTypes' +
+   + + _names = {0: 'RELAXNG_OK', 1: 'RELAXNG_ERR_MEMORY', 2: 'RELAXN... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: 'RELAXNG_OK',
+ 1: 'RELAXNG_ERR_MEMORY',
+ 2: 'RELAXNG_ERR_TYPE',
+ 3: 'RELAXNG_ERR_TYPEVAL',
+ 4: 'RELAXNG_ERR_DUPID',
+ 5: 'RELAXNG_ERR_TYPECMP',
+ 6: 'RELAXNG_ERR_NOSTATE',
+ 7: '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 00000000..e2721da8 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGParseError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.RelaxNGValidateError-class.html b/doc/html/api/lxml.etree.RelaxNGValidateError-class.html new file mode 100644 index 00000000..9d93dbf4 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGValidateError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.Resolver-class.html b/doc/html/api/lxml.etree.Resolver-class.html new file mode 100644 index 00000000..2e20e900 --- /dev/null +++ b/doc/html/api/lxml.etree.Resolver-class.html @@ -0,0 +1,477 @@ + + + + + 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. The third argument is an +opaque context object.
+ + +
+ +
+   + + + + + + +
resolve_empty(self, + context)
+ Return an empty input document.
+ + +
+ +
+   + + + + + + +
resolve_file(self, + f, + context, + base_url=None, + close=True)
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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, + close=True) +

+
  +
+ +

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. If the close flag is True (the +default), the file will be closed after reading.

+

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 00000000..4b50fd63 --- /dev/null +++ b/doc/html/api/lxml.etree.Schematron-class.html @@ -0,0 +1,389 @@ + + + + + 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 = Schematron(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 = XML('''
+... <AAA name="aaa">
+...   <BBB id="bbb"/>
+...   <CCC color="ccc"/>
+... </AAA>
+... ''')
+
+>>> schematron.validate(xml)
+0
+
+>>> xml = 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

Inherited from _Validator (private): + _append_log_message, + _clear_error_log +

+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..16e5b0a2 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.SchematronParseError-class.html b/doc/html/api/lxml.etree.SchematronParseError-class.html new file mode 100644 index 00000000..e69c1230 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronParseError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.SchematronValidateError-class.html b/doc/html/api/lxml.etree.SchematronValidateError-class.html new file mode 100644 index 00000000..8a4b1bc7 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronValidateError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.SerialisationError-class.html b/doc/html/api/lxml.etree.SerialisationError-class.html new file mode 100644 index 00000000..e1d2713c --- /dev/null +++ b/doc/html/api/lxml.etree.SerialisationError-class.html @@ -0,0 +1,274 @@ + + + + + lxml.etree.SerialisationError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SerialisationError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SerialisationError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      SerialisationError
+
+ +
Known Subclasses:
+
+ +
+ +
+A libxml2 error that occurred during serialisation. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.SiblingsIterator-class.html b/doc/html/api/lxml.etree.SiblingsIterator-class.html new file mode 100644 index 00000000..d50717e3 --- /dev/null +++ b/doc/html/api/lxml.etree.SiblingsIterator-class.html @@ -0,0 +1,257 @@ + + + + + lxml.etree.SiblingsIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SiblingsIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SiblingsIterator

+
+           object --+    
+                    |    
+_ElementMatchIterator --+
+                        |
+                       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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

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

+
+ + + + + + + + + +
+ + + + + +
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.TreeBuilder-class.html b/doc/html/api/lxml.etree.TreeBuilder-class.html new file mode 100644 index 00000000..0e3a2c7e --- /dev/null +++ b/doc/html/api/lxml.etree.TreeBuilder-class.html @@ -0,0 +1,425 @@ + + + + + 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,
+
comment_factory=None, pi_factory=None, +insert_comments=True, insert_pis=True)
+
+

Parser target that builds a tree from parse event callbacks.

+

The factory arguments can be used to influence the creation of +elements, comments and processing instructions.

+

By default, comments and processing instructions are inserted into +the tree, but they can be ignored by passing the respective flags.

+

The final tree is returned by the close() method.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_factory=None, + parser=None, + comment_factory=None, + pi_factory=None, + insert_comments=True, + insert_pis=True)
+ x.__init__(...) initializes x; see help(type(x)) 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)
+ Creates a comment using the factory, appends it (unless disabled) +and returns it.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+   + + + + + + +
end(self, + tag)
+ Closes the current element.
+ + +
+ +
+   + + + + + + +
pi(self, + target, + data=None)
+ Creates a processing instruction using the factory, appends it +(unless disabled) and returns it.
+ + +
+ +
+   + + + + + + +
start(self, + tag, + attrs, + nsmap=None)
+ Opens a new element.
+ + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + element_factory=None, + parser=None, + comment_factory=None, + pi_factory=None, + insert_comments=True, + insert_pis=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.XInclude-class.html b/doc/html/api/lxml.etree.XInclude-class.html new file mode 100644 index 00000000..9f8d0084 --- /dev/null +++ b/doc/html/api/lxml.etree.XInclude-class.html @@ -0,0 +1,314 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..c85fd52b --- /dev/null +++ b/doc/html/api/lxml.etree.XIncludeError-class.html @@ -0,0 +1,268 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XMLParser-class.html b/doc/html/api/lxml.etree.XMLParser-class.html new file mode 100644 index 00000000..66789622 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLParser-class.html @@ -0,0 +1,391 @@ + + + + + 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, schema: XMLSchema =None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, collect_ids=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:

+ +

Other keyword arguments:

+ +

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, + schema: XMLSchema=None, + huge_tree=False, + remove_blank_text=False, + resolve_entities=True, + remove_comments=False, + remove_pis=False, + strip_cdata=True, + collect_ids=True, + target=None, + compact=True)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

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

+

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

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

Inherited from _FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + 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: XMLSchema=None, + huge_tree=False, + remove_blank_text=False, + resolve_entities=True, + remove_comments=False, + remove_pis=False, + strip_cdata=True, + collect_ids=True, + target=None, + compact=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.XMLPullParser-class.html b/doc/html/api/lxml.etree.XMLPullParser-class.html new file mode 100644 index 00000000..be757ee1 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLPullParser-class.html @@ -0,0 +1,347 @@ + + + + + lxml.etree.XMLPullParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLPullParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLPullParser

+
+    object --+            
+             |            
+??._BaseParser --+        
+                 |        
+       _FeedParser --+    
+                     |    
+             XMLParser --+
+                         |
+                        XMLPullParser
+
+ +
+

XMLPullParser(self, events=None, *, tag=None, **kwargs)

+

XML parser that collects parse events in an iterator.

+

The collected events are the same as for iterparse(), but the +parser itself is non-blocking in the sense that it receives +data chunks incrementally through its .feed() method, instead +of reading them directly from a file(-like) object all by itself.

+

By default, it collects Element end events. To change that, +pass any subset of the available events into the events +argument: 'start', 'end', 'start-ns', +'end-ns', 'comment', 'pi'.

+

To support loading external dependencies relative to the input +source, you can pass the base_url.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + events=None, + tag=None, + *, + **kwargs)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
read_events(...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

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

+

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

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

Inherited from _FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + version +

+

Inherited from object: + __class__ +

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

__init__(self, + events=None, + tag=None, + *, + **kwargs) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..0f72cd19 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchema-class.html @@ -0,0 +1,350 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+

Inherited from _Validator (private): + _append_log_message, + _clear_error_log +

+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..3a4b7a61 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XMLSchemaParseError-class.html b/doc/html/api/lxml.etree.XMLSchemaParseError-class.html new file mode 100644 index 00000000..32ec0f3d --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaParseError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XMLSchemaValidateError-class.html b/doc/html/api/lxml.etree.XMLSchemaValidateError-class.html new file mode 100644 index 00000000..420d8a40 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaValidateError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XMLSyntaxError-class.html b/doc/html/api/lxml.etree.XMLSyntaxError-class.html new file mode 100644 index 00000000..55791169 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSyntaxError-class.html @@ -0,0 +1,261 @@ + + + + + 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]
+
+

Inherited from ParseError: + __init__ +

+

Inherited from LxmlError: + __new__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'XMLSyntaxError' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from ParseError: + position +

+

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

+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..8d44d6a6 --- /dev/null +++ b/doc/html/api/lxml.etree.XPath-class.html @@ -0,0 +1,384 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+

Inherited from _XPathEvaluatorBase: + evaluate +

+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + path
+ The literal XPath expression. +
+

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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9a3c6638 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathDocumentEvaluator-class.html @@ -0,0 +1,363 @@ + + + + + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..01176a1a --- /dev/null +++ b/doc/html/api/lxml.etree.XPathElementEvaluator-class.html @@ -0,0 +1,398 @@ + + + + + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..a8d4e168 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XPathEvalError-class.html b/doc/html/api/lxml.etree.XPathEvalError-class.html new file mode 100644 index 00000000..94dba8a2 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathEvalError-class.html @@ -0,0 +1,276 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XPathFunctionError-class.html b/doc/html/api/lxml.etree.XPathFunctionError-class.html new file mode 100644 index 00000000..e3ce452a --- /dev/null +++ b/doc/html/api/lxml.etree.XPathFunctionError-class.html @@ -0,0 +1,272 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XPathResultError-class.html b/doc/html/api/lxml.etree.XPathResultError-class.html new file mode 100644 index 00000000..90690f51 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathResultError-class.html @@ -0,0 +1,272 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XPathSyntaxError-class.html b/doc/html/api/lxml.etree.XPathSyntaxError-class.html new file mode 100644 index 00000000..1562da48 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathSyntaxError-class.html @@ -0,0 +1,266 @@ + + + + + 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 XPathError: + __new__ +

+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.SyntaxError: + __str__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'XPathSyntaxError' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

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

+

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

+

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 00000000..cf743fd9 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLT-class.html @@ -0,0 +1,598 @@ + + + + + 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:

+ +

Keyword arguments of the XSLT call:

+ +

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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
apply(self, + _input, + profile_run=False, + **kw) + + +
+ +
+   + + + + + + +
tostring(self, + result_tree)
+ Save result doc to string based on stylesheet output method.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+   + + + + + + +
set_global_max_depth(max_depth)
+ The maximum traversal depth that the stylesheet engine will allow. +This does not only count the template recursion depth but also takes +the number of variables/parameters into account. The required setting +for a run depends on both the stylesheet and the input data.
+ + +
+ +
+   + + + + + + +
strparam(strval)
+ Mark an XSLT string parameter that requires quote escaping +before passing it into the transformation. Use it like this:
+ + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) 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. +

+
+
+ +
+ +
+ + +
+

set_global_max_depth(max_depth) +
Static Method +

+
  +
+ +

The maximum traversal depth that the stylesheet engine will allow. +This does not only count the template recursion depth but also takes +the number of variables/parameters into account. The required setting +for a run depends on both the stylesheet and the input data.

+

Example:

+
+XSLT.set_global_max_depth(5000)
+
+

Note that this is currently a global, module-wide setting because +libxslt does not support it at a per-stylesheet level.

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

strparam(strval) +
Static Method +

+
  +
+ +

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 00000000..52698acf --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTAccessControl-class.html @@ -0,0 +1,451 @@ + + + + + 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.

+ +

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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+

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

+
+ + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+
+ + + + + + +
+ + + + + +
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 00000000..8aacfce9 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTApplyError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XSLTError-class.html b/doc/html/api/lxml.etree.XSLTError-class.html new file mode 100644 index 00000000..18d72c66 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTError-class.html @@ -0,0 +1,274 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XSLTExtension-class.html b/doc/html/api/lxml.etree.XSLTExtension-class.html new file mode 100644 index 00000000..4da11ad4 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTExtension-class.html @@ -0,0 +1,420 @@ + + + + + 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, + output_parent=None, + elements_only=False, + remove_blank_text=False)
+ 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.
+ + +
+ +
+   + + + + + + +
process_children(self, + context, + output_parent=None, + elements_only=False, + remove_blank_text=False)
+ Call this method to process the XSLT content of the extension +element itself.
+ + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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, + output_parent=None, + elements_only=False, + remove_blank_text=False) +

+
  +
+ +

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. If you pass +elements_only=True, strings will be discarded from the result +list. The option remove_blank_text=True will only discard +strings that consist entirely of whitespace (e.g. formatting). +These options do not apply to Elements, only to bare string results.

+

If you pass an Element as output_parent parameter, the result +will instead be appended to the element (including attributes +etc.) and the return value will be None. This is a safe way +to generate content into the output document directly, without +having to take care of special values like text or attributes. +Note that the string discarding options will be ignored in this +case.

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

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.

+

Note that the output_parent parameter may be None if there +is no parent element in the current context (e.g. no content +was added to the output tree yet).

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

process_children(self, + context, + output_parent=None, + elements_only=False, + remove_blank_text=False) +

+
  +
+ +

Call this method to process the XSLT content of the extension +element itself.

+

The return value is a list of elements or text strings that +were generated by the XSLT processor. If you pass +elements_only=True, strings will be discarded from the result +list. The option remove_blank_text=True will only discard +strings that consist entirely of whitespace (e.g. formatting). +These options do not apply to Elements, only to bare string results.

+

If you pass an Element as output_parent parameter, the result +will instead be appended to the element (including attributes +etc.) and the return value will be None. This is a safe way +to generate content into the output document directly, without +having to take care of special values like text or attributes. +Note that the string discarding options will be ignored in this +case.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..1cb6ed96 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTExtensionError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XSLTParseError-class.html b/doc/html/api/lxml.etree.XSLTParseError-class.html new file mode 100644 index 00000000..60d5713b --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTParseError-class.html @@ -0,0 +1,270 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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.XSLTSaveError-class.html b/doc/html/api/lxml.etree.XSLTSaveError-class.html new file mode 100644 index 00000000..6fd6c7f3 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTSaveError-class.html @@ -0,0 +1,248 @@ + + + + + lxml.etree.XSLTSaveError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTSaveError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTSaveError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                               XSLTError --+
+                                           |
+              object --+                   |
+                       |                   |
+exceptions.BaseException --+               |
+                           |               |
+        exceptions.Exception --+           |
+                               |           |
+                           Error --+       |
+                                   |       |
+                           LxmlError --+   |
+                                       |   |
+                      SerialisationError --+
+                                           |
+                                          XSLTSaveError
+
+ +
+Error serialising an XSLT result. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from XSLTError: + __new__ +

+

Inherited from LxmlError: + __init__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'XSLTSaveError' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..2838c011 --- /dev/null +++ b/doc/html/api/lxml.etree._Attrib-class.html @@ -0,0 +1,727 @@ + + + + + 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
+ + +
+ +
+   + + + + + + +
__copy__(...) + + +
+ +
+   + + + + + + +
__deepcopy__(...) + + +
+ +
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__getitem__(x, + y)
+ x[y]
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+   + + + + + + +
__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__(x)
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..542a06c2 --- /dev/null +++ b/doc/html/api/lxml.etree._BaseErrorLog-class.html @@ -0,0 +1,369 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...) + + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0a0e6b4a --- /dev/null +++ b/doc/html/api/lxml.etree._Comment-class.html @@ -0,0 +1,364 @@ + + + + + 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__(x)
+ repr(x)
+ + +
+ +
+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + tag
+ Element tag +
+

Inherited from unreachable.__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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..8b900705 --- /dev/null +++ b/doc/html/api/lxml.etree._Document-class.html @@ -0,0 +1,250 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..a2e3f854 --- /dev/null +++ b/doc/html/api/lxml.etree._DomainErrorLog-class.html @@ -0,0 +1,351 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

Inherited from _ErrorLog: + __exit__, + __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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

receive(...) +

+
  +
+ + +
+
Overrides: + _BaseErrorLog.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 00000000..3b938e7c --- /dev/null +++ b/doc/html/api/lxml.etree._Element-class.html @@ -0,0 +1,1688 @@ + + + + + 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__(self, + element) + + +
+ +
+   + + + + + + +
__copy__(self) + + +
+ +
+   + + + + + + +
__deepcopy__(self, + memo) + + +
+ +
+   + + + + + + +
__delitem__(self, + x)
+ Deletes the given subelement or a slice.
+ + +
+ +
+   + + + + + + +
__getitem__(...)
+ Returns the subelement at the given position or the requested +slice.
+ + +
+ +
+   + + + + + + +
__iter__(self) + + +
+ +
+   + + + + + + +
__len__(self)
+ Returns the number of subelements.
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__reversed__(self) + + +
+ +
+   + + + + + + +
__setitem__(self, + x, + value)
+ Replaces the given subelement index or slice.
+ + +
+ +
+   + + + + + + +
_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.
+ + +
+ +
+   + + + + + + +
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, + keep_tail=False)
+ Resets an element. This function removes all subelements, clears +all attributes and sets the text and tail properties to None.
+ + +
+ +
+   + + + + + + +
cssselect(...)
+ Run the CSS expression on this element and its children, +returning a list of the results.
+ + +
+ +
+   + + + + + + +
extend(self, + elements)
+ Extends the current children by the elements in the iterable.
+ + +
+ +
+   + + + + + + +
find(self, + path, + namespaces=None)
+ Finds the first matching subelement, by tag name or path.
+ + +
+ +
+   + + + + + + +
findall(self, + path, + namespaces=None)
+ Finds all matching subelements, by tag name or path.
+ + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None, + namespaces=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. The elements are returned in document +order.
+ + +
+ +
+   + + + + + + +
getiterator(self, + tag=None, + *tags)
+ 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. The attributes are returned in +an arbitrary order.
+ + +
+ +
+   + + + + + + +
iter(self, + tag=None, + *tags)
+ Iterate over all elements in the subtree in document order (depth +first pre-order), starting with this element.
+ + +
+ +
+   + + + + + + +
iterancestors(self, + tag=None, + *tags)
+ Iterate over the ancestors of this element (from parent to parent).
+ + +
+ +
+   + + + + + + +
iterchildren(self, + tag=None, + reversed=False, + *tags)
+ Iterate over the children of this element.
+ + +
+ +
+   + + + + + + +
iterdescendants(self, + tag=None, + *tags)
+ Iterate over the descendants of this element in document order.
+ + +
+ +
+   + + + + + + +
iterfind(self, + path, + namespaces=None)
+ Iterates over all matching subelements, by tag name or path.
+ + +
+ +
+   + + + + + + +
itersiblings(self, + tag=None, + preceding=False, + *tags)
+ Iterate over the following or preceding siblings of this element.
+ + +
+ +
+   + + + + + + +
itertext(self, + tag=None, + with_tail=True, + *tags)
+ Iterates over the text content of a subtree.
+ + +
+ +
+   + + + + + + +
keys(self)
+ Gets a list of attribute names. The names are returned in an +arbitrary order (just like for an ordinary Python dictionary).
+ + +
+ +
+   + + + + + + +
makeelement(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with the same document.
+ + +
+ +
+   + + + + + + +
remove(self, + element)
+ Removes a matching subelement. Unlike the find methods, this +method compares elements based on identity, not on tag value +or contents.
+ + +
+ +
+   + + + + + + +
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. The +attributes are returned in an arbitrary order.
+ + +
+ +
+   + + + + + + +
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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[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. +
+   + + nsmap
+ Namespace prefix->URI mapping known in the context of this +Element. This includes all namespace declarations of the +parents. +
+   + + 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. 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. +
+

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__ +
+
+
+
+ +
+ +
+ + +
+

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, + keep_tail=False) +

+
  +
+ +

Resets an element. This function removes all subelements, clears +all attributes and sets the text and tail properties to None.

+

Pass keep_tail=True to leave the tail text untouched.

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

cssselect(...) +

+
  +
+ +

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.

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

find(self, + path, + namespaces=None) +

+
  +
+ +

Finds the first matching subelement, by tag name or path.

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

findall(self, + path, + namespaces=None) +

+
  +
+ +

Finds all matching subelements, by tag name or path.

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

findtext(self, + path, + default=None, + namespaces=None) +

+
  +
+ +

Finds text for the first matching subelement, by tag name or path.

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

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, + *tags) +

+
  +
+ +

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 specific tags, +see iter.

+
+
+

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.

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

iter(self, + tag=None, + *tags) +

+
  +
+ +

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 specific tags: +pass "{ns}localname" as tag. Either or both of ns and +localname can be * for a wildcard; ns can be empty +for no namespace. "localname" is equivalent to "{}localname" +(i.e. no namespace) but "*" is "{*}*" (any or no namespace), +not "{}*".

+

You can also pass the Element, Comment, ProcessingInstruction and +Entity factory functions to look only for the specific element type.

+

Passing multiple tags (or a sequence of tags) instead of a single tag +will let the iterator return all elements matching any of these tags, +in document order.

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

iterancestors(self, + tag=None, + *tags) +

+
  +
+ +

Iterate over the ancestors of this element (from parent to parent).

+

Can be restricted to find only elements with specific tags, +see iter.

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

iterchildren(self, + tag=None, + reversed=False, + *tags) +

+
  +
+ +

Iterate over the children of this element.

+

As opposed to using normal iteration on this element, the returned +elements can be reversed with the 'reversed' keyword and restricted +to find only elements with specific tags, see iter.

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

iterdescendants(self, + tag=None, + *tags) +

+
  +
+ +

Iterate over the descendants of this element in document order.

+

As opposed to el.iter(), this iterator does not yield the element +itself. The returned elements can be restricted to find only elements +with specific tags, see iter.

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

iterfind(self, + path, + namespaces=None) +

+
  +
+ +

Iterates over all matching subelements, by tag name or path.

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

itersiblings(self, + tag=None, + preceding=False, + *tags) +

+
  +
+ +

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. When True, the iterator yields the preceding +siblings in reverse document order, i.e. starting right before +the current element and going backwards.

+

Can be restricted to find only elements with specific tags, +see iter.

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

itertext(self, + tag=None, + with_tail=True, + *tags) +

+
  +
+ +

Iterates over the text content of a subtree.

+

You can pass tag names to restrict text content to specific elements, +see iter.

+

You can set the with_tail keyword argument to False to skip +over tail text.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

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).

+
+
+
+
+ +
+ +
+

nsmap

+

Namespace prefix->URI mapping known in the context of this +Element. This includes all namespace declarations of the +parents.

+

Note that changing the returned dict has no effect on the Element.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..49b79aa8 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementIterator-class.html @@ -0,0 +1,299 @@ + + + + + lxml.etree._ElementIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementIterator

+
+        object --+    
+                 |    
+_ElementTagMatcher --+
+                     |
+                    _ElementIterator
+
+ +
+Dead but public. :) + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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._ElementMatchIterator-class.html b/doc/html/api/lxml.etree._ElementMatchIterator-class.html new file mode 100644 index 00000000..d3dd242b --- /dev/null +++ b/doc/html/api/lxml.etree._ElementMatchIterator-class.html @@ -0,0 +1,301 @@ + + + + + lxml.etree._ElementMatchIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementMatchIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementMatchIterator

+
+object --+
+         |
+        _ElementMatchIterator
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..ceda6638 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementStringResult-class.html @@ -0,0 +1,290 @@ + + + + + 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__, + __format__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __new__, + __repr__, + __rmod__, + __rmul__, + __sizeof__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + format, + 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 str (private): + _formatter_field_name_split, + _formatter_parser +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = '_ElementStringResult' +
+ + + + + + + + + +
+ + + + + +
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 00000000..2a590df2 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementTagMatcher-class.html @@ -0,0 +1,254 @@ + + + + + lxml.etree._ElementTagMatcher + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementTagMatcher + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementTagMatcher

+
+object --+
+         |
+        _ElementTagMatcher
+
+ +
Known Subclasses:
+
+ +
+ +
+Dead but public. :) + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 00000000..3f620010 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementTree-class.html @@ -0,0 +1,1108 @@ + + + + + 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, + namespaces=None)
+ Finds the first toplevel element with given tag. Same as +tree.getroot().find(path).
+ + +
+ +
+   + + + + + + +
findall(self, + path, + namespaces=None)
+ Finds all elements matching the ElementPath expression. Same as +getroot().findall(path).
+ + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None, + namespaces=None)
+ Finds the text for the first element matching the ElementPath +expression. Same as getroot().findtext(path)
+ + +
+ +
+   + + + + + + +
getelementpath(self, + element)
+ Returns a structural, absolute ElementPath expression to find the +element. This path can be used in the .find() method to look up +the element, provided that the elements along the path and their +list of immediate children were not modified in between.
+ + +
+ +
+   + + + + + + +
getiterator(self, + tag=None, + *tags)
+ 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 the element.
+ + +
+ +
+   + + + + + + +
getroot(self)
+ Gets the root element for this tree.
+ + +
+ +
+   + + + + + + +
iter(self, + tag=None, + *tags)
+ Creates an iterator for the root element. The iterator loops over +all elements in this tree, in document order. Note that siblings +of the root element (comments or processing instructions) are not +returned by the iterator.
+ + +
+ +
+   + + + + + + +
iterfind(self, + path, + namespaces=None)
+ Iterates over all elements matching the ElementPath expression. +Same as getroot().iterfind(path).
+ + +
+ +
+   + + + + + + +
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, + doctype=None, + compression=0, + exclusive=False, + inclusive_ns_prefixes=None, + with_comments=True, + strip_text=False)
+ Write the tree to a filename, file or file-like object.
+ + +
+ +
+   + + + + + + +
write_c14n(self, + file, + exclusive=False, + with_comments=True, + compression=0, + inclusive_ns_prefixes=None)
+ C14N write of document. Always writes UTF-8.
+ + +
+ +
+   + + + + + + +
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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
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, + namespaces=None) +

+
  +
+ +

Finds the first toplevel element with given tag. Same as +tree.getroot().find(path).

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

findall(self, + path, + namespaces=None) +

+
  +
+ +

Finds all elements matching the ElementPath expression. Same as +getroot().findall(path).

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

findtext(self, + path, + default=None, + namespaces=None) +

+
  +
+ +

Finds the text for the first element matching the ElementPath +expression. Same as getroot().findtext(path)

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

getelementpath(self, + element) +

+
  +
+ +

Returns a structural, absolute ElementPath expression to find the +element. This path can be used in the .find() method to look up +the element, provided that the elements along the path and their +list of immediate children were not modified in between.

+

ElementPath has the advantage over an XPath expression (as returned +by the .getpath() method) that it does not require additional prefix +declarations. It is always self-contained.

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

getiterator(self, + tag=None, + *tags) +

+
  +
+ +

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 specific tags, +see _Element.iter.

+
+
+

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. +

+
+
+ +
+ +
+ + +
+

getpath(self, + element) +

+
  +
+ +

Returns a structural, absolute XPath expression to find the element.

+

For namespaced elements, the expression uses prefixes from the +document, which therefore need to be provided in order to make any +use of the expression in XPath.

+

Also see the method getelementpath(self, element), which returns a +self-contained ElementPath expression.

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

iter(self, + tag=None, + *tags) +

+
  +
+ +

Creates an iterator for the root element. The iterator loops over +all elements in this tree, in document order. Note that siblings +of the root element (comments or processing instructions) are not +returned by the iterator.

+

Can be restricted to find only elements with specific tags, +see _Element.iter.

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

iterfind(self, + path, + namespaces=None) +

+
  +
+ +

Iterates over all elements matching the ElementPath expression. +Same as getroot().iterfind(path).

+

The optional namespaces argument accepts a +prefix-to-namespace mapping that allows the usage of XPath +prefixes in the path expression.

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

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, + doctype=None, + compression=0, + exclusive=False, + inclusive_ns_prefixes=None, + with_comments=True, + strip_text=False) +

+
  +
+ +

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', 'html', 'text' or 'c14n'. Default is 'xml'.

+

With method="c14n" (C14N version 1), the options exclusive, +with_comments and inclusive_ns_prefixes request exclusive +C14N, include comments, and list the inclusive prefixes respectively.

+

With method="c14n2" (C14N version 2), the with_comments and +strip_text options control the output of comments and text space +according to C14N 2.0.

+

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

+

The doctype option allows passing in a plain string that will +be serialised before the XML tree. Note that passing in non +well-formed content here will make the XML output non well-formed. +Also, an existing doctype in the document tree will not be removed +when serialising an ElementTree instance.

+

The compression option enables GZip compression level 1-9.

+

The inclusive_ns_prefixes should be a list of namespace strings +(i.e. ['xs', 'xsi']) that will be promoted to the top-level element +during exclusive C14N serialisation. This parameter is ignored if +exclusive mode=False.

+

If exclusive=True and no list is provided, a namespace will only be +rendered if it is used by the immediate parent or one of its attributes +and its prefix and values have not already been rendered by an ancestor +of the namespace node's parent element.

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

write_c14n(self, + file, + exclusive=False, + with_comments=True, + compression=0, + inclusive_ns_prefixes=None) +

+
  +
+ +

C14N write of document. Always writes UTF-8.

+

The compression option enables GZip compression level 1-9.

+

The inclusive_ns_prefixes should be a list of namespace strings +(i.e. ['xs', 'xsi']) that will be promoted to the top-level element +during exclusive C14N serialisation. This parameter is ignored if +exclusive mode=False.

+

If exclusive=True and no list is provided, a namespace will only be +rendered if it is used by the immediate parent or one of its attributes +and its prefix and values have not already been rendered by an ancestor +of the namespace node's parent element.

+

NOTE: This method is deprecated as of lxml 4.4 and will be removed in a +future release. Use .write(f, method="c14n") instead.

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

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.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..58ac3fe2 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementUnicodeResult-class.html @@ -0,0 +1,356 @@ + + + + + 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__, + __format__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __repr__, + __rmod__, + __rmul__, + __sizeof__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + format, + 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 unicode (private): + _formatter_field_name_split, + _formatter_parser +

+

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

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + attrname +
+   + + 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 00000000..d3b08d13 --- /dev/null +++ b/doc/html/api/lxml.etree._Entity-class.html @@ -0,0 +1,379 @@ + + + + + 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__(x)
+ repr(x)
+ + +
+ +
+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + name +
+   + + tag
+ Element tag +
+   + + text
+ Text before the first subelement. This is either a string or +the value None, if there was no text. +
+

Inherited from unreachable.__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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..66699e00 --- /dev/null +++ b/doc/html/api/lxml.etree._ErrorLog-class.html @@ -0,0 +1,459 @@ + + + + + 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]
+
+   + + + + + + +
__exit__(...) + + +
+ +
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__iter__(x) +

+
  +
+ + iter(x) +
+
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 +
+
+
+
+ +
+ +
+ + +
+

receive(...) +

+
  +
+ + +
+
Overrides: + _BaseErrorLog.receive +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7ff2ac64 --- /dev/null +++ b/doc/html/api/lxml.etree._FeedParser-class.html @@ -0,0 +1,400 @@ + + + + + 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. 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.
+ + +
+ +
+   + + + + + + +
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.
+ + +
+ +
+

Inherited from unreachable._BaseParser: + __init__, + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + feed_error_log
+ The error log of the last (or current) run of the feed parser. +
+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + 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._IDDict-class.html b/doc/html/api/lxml.etree._IDDict-class.html new file mode 100644 index 00000000..cd273814 --- /dev/null +++ b/doc/html/api/lxml.etree._IDDict-class.html @@ -0,0 +1,505 @@ + + + + + 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__(x, + y)
+ x[y]
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...) + + +
+ +
+   + + + + + + +
get(...) + + +
+ +
+   + + + + + + +
has_key(...) + + +
+ +
+   + + + + + + +
items(...) + + +
+ +
+   + + + + + + +
iteritems(...) + + +
+ +
+   + + + + + + +
iterkeys(...) + + +
+ +
+   + + + + + + +
itervalues(...) + + +
+ +
+   + + + + + + +
keys(...) + + +
+ +
+   + + + + + + +
values(...) + + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..c6507eb1 --- /dev/null +++ b/doc/html/api/lxml.etree._ListErrorLog-class.html @@ -0,0 +1,593 @@ + + + + + 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__(x, + y)
+ x[y]
+ + +
+ +
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...)
+ Creates a shallow copy of this error log. Reuses the list of +entries.
+ + +
+ +
+   + + + + + + +
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 _BaseErrorLog: + receive +

+

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

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

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

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 00000000..921db23d --- /dev/null +++ b/doc/html/api/lxml.etree._LogEntry-class.html @@ -0,0 +1,381 @@ + + + + + lxml.etree._LogEntry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _LogEntry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _LogEntry

+
+object --+
+         |
+        _LogEntry
+
+ +
+

A log message entry from an error log.

+

Attributes:

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

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + column +
+   + + domain +
+   + + domain_name
+ The name of the error domain. See lxml.etree.ErrorDomains +
+   + + filename
+ The file path where the report originated, if any. +
+   + + level +
+   + + level_name
+ The name of the error level. See lxml.etree.ErrorLevels +
+   + + line +
+   + + message
+ The log message string. +
+   + + path
+ The XPath for the node where the error was detected. +
+   + + type +
+   + + type_name
+ The name of the error type. See lxml.etree.ErrorTypes +
+

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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..806a7d9d --- /dev/null +++ b/doc/html/api/lxml.etree._ProcessingInstruction-class.html @@ -0,0 +1,431 @@ + + + + + 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__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
get(self, + key, + default=None)
+ Try to parse pseudo-attributes from the text content of the +processing instruction, search for one with the given key as +name and return its associated value.
+ + +
+ +
+

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

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + attrib
+ Returns a dict containing all pseudo-attributes that can be +parsed from the text content of this processing instruction. +Note that modifying the dict currently has no effect on the +XML node, although this is not guaranteed to stay this way. +
+   + + tag
+ Element tag +
+   + + target +
+

Inherited from unreachable.__ContentOnlyElement: + 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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

get(self, + key, + default=None) +

+
  +
+ +

Try to parse pseudo-attributes from the text content of the +processing instruction, search for one with the given key as +name and return its associated value.

+

Note that this is only a convenience method for the most +common case that all text content is structured in +attribute-like name-value pairs with properly quoted values. +It is not guaranteed to work for all possible text content.

+
+
Overrides: + _Element.get +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..39206d86 --- /dev/null +++ b/doc/html/api/lxml.etree._RotatingErrorLog-class.html @@ -0,0 +1,351 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

Inherited from _ErrorLog: + __exit__, + __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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

receive(...) +

+
  +
+ + +
+
Overrides: + _BaseErrorLog.receive +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7423f01d --- /dev/null +++ b/doc/html/api/lxml.etree._SaxParserTarget-class.html @@ -0,0 +1,252 @@ + + + + + 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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..67148d06 --- /dev/null +++ b/doc/html/api/lxml.etree._TargetParserResult-class.html @@ -0,0 +1,285 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+

Inherited from exceptions.Exception: + __new__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = '_TargetParserResult' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

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

+

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..b7917055 --- /dev/null +++ b/doc/html/api/lxml.etree._Validator-class.html @@ -0,0 +1,369 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_append_log_message(...) + + +
+ +
+   + + + + + + +
_clear_error_log(...) + + +
+ +
+   + + + + + + +
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__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The log of validation errors and warnings. +
+

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__ +
+
+
+
+ +
+ +
+ + +
+

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._XPathEvaluatorBase-class.html b/doc/html/api/lxml.etree._XPathEvaluatorBase-class.html new file mode 100644 index 00000000..73cb5426 --- /dev/null +++ b/doc/html/api/lxml.etree._XPathEvaluatorBase-class.html @@ -0,0 +1,345 @@ + + + + + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from object: + __class__ +

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

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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._XSLTProcessingInstruction-class.html b/doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html new file mode 100644 index 00000000..9adc9eac --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html @@ -0,0 +1,413 @@ + + + + + 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, + ...) + + +
+ +
+   + + + + + + +
parseXSL(self, + parser=None)
+ 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.
+ + +
+ +
+   + + + + + + +
set(self, + key, + value)
+ Supports setting the 'href' pseudo-attribute in the text of +the processing instruction.
+ + +
+ +
+

Inherited from PIBase: + __init__ +

+

Inherited from _ProcessingInstruction: + __repr__, + get +

+

Inherited from unreachable.__ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + insert, + items, + keys, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from _ProcessingInstruction: + attrib, + tag, + target +

+

Inherited from unreachable.__ContentOnlyElement: + 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__ +
+
+
+
+ +
+ +
+ + +
+

parseXSL(self, + parser=None) +

+
  +
+ +

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) +

+
  +
+ + Supports setting the 'href' pseudo-attribute in the text of +the processing instruction. +
+
Overrides: + _Element.set +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f5d98e89 --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTResultTree-class.html @@ -0,0 +1,382 @@ + + + + + lxml.etree._XSLTResultTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTResultTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTResultTree

+
+  object --+    
+           |    
+_ElementTree --+
+               |
+              _XSLTResultTree
+
+ +
+

The result of an XSLT evaluation.

+

Use str() or bytes() (or unicode() in Python 2.x) to serialise to a string, +and the .write_output() method to write serialise to a file.

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+   + + + + + + +
__unicode__(...) + + +
+ +
+   + + + + + + +
write_output(...)
+ write_output(self, file, *, compression=0)
+ + +
+ +
+

Inherited from _ElementTree: + __copy__, + __deepcopy__, + find, + findall, + findtext, + getelementpath, + getiterator, + getpath, + getroot, + iter, + iterfind, + parse, + relaxng, + write, + write_c14n, + xinclude, + xmlschema, + xpath, + xslt +

+

Inherited from _ElementTree (private): + _setroot +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

write_output(...) +

+
  +
+ +

write_output(self, file, *, compression=0)

+

Serialise the XSLT output to a file or file-like object.

+

As opposed to the generic .write() method, .write_output() serialises +the result as defined by the <xsl:output> tag.

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

Class htmlfile

+
+object --+    
+         |    
+   xmlfile --+
+             |
+            htmlfile
+
+ +
+

htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)

+

A simple mechanism for incremental HTML serialisation. Works the same as +xmlfile.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + output_file, + encoding=None, + compression=None, + close=False, + buffered=True)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from xmlfile: + __aenter__, + __aexit__, + __enter__, + __exit__ +

+

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

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

Inherited from object: + __class__ +

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

__init__(self, + output_file, + encoding=None, + compression=None, + close=False, + buffered=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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.iterparse-class.html b/doc/html/api/lxml.etree.iterparse-class.html new file mode 100644 index 00000000..e4251b2c --- /dev/null +++ b/doc/html/api/lxml.etree.iterparse-class.html @@ -0,0 +1,511 @@ + + + + + lxml.etree.iterparse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class iterparse + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class iterparse

+
+object --+
+         |
+        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, recover=None, 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. The tag argument can also be +a sequence of tags to allow matching more than one 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+)
    +
    +
  • +
  • html: parse input as HTML (default: XML)
  • +
  • +
    recover: try hard to parse through broken input (default: True for HTML,
    +
    False otherwise)
    +
    +
  • +
+
+
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, + recover=None, + huge_tree=False, + schema=None)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+   + + + + + + +
makeelement(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with this parser.
+ + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+   + + + + + + +
set_element_class_lookup(self, + lookup= None)
+ Set a lookup scheme for element classes generated from this parser.
+ + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The error log of the last (or current) parser run. +
+   + + resolvers
+ The custom resolver registry of the last (or current) parser run. +
+   + + root +
+   + + version
+ The version of the underlying XML parser. +
+

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, + recover=None, + huge_tree=False, + schema=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

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.iterwalk-class.html b/doc/html/api/lxml.etree.iterwalk-class.html new file mode 100644 index 00000000..2e622767 --- /dev/null +++ b/doc/html/api/lxml.etree.iterwalk-class.html @@ -0,0 +1,392 @@ + + + + + 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().

+

Just as for iterparse(), the tag argument can be a single tag or a +sequence of tags.

+

After receiving a 'start' or 'start-ns' event, the children and +descendants of the current element can be excluded from iteration +by calling the skip_subtree() method.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_or_tree, + events=("end", + ), + tag=None)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+   + + + + + + +
__iter__(x)
+ iter(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+   + + + + + + +
skip_subtree(...)
+ Prevent descending into the current subtree. +Instead, the next returned event will be the 'end' event of the current element +(if included), ignoring any children or descendants.
+ + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

skip_subtree(...) +

+
  +
+ +

Prevent descending into the current subtree. +Instead, the next returned event will be the 'end' event of the current element +(if included), ignoring any children or descendants.

+

This has no effect right after an 'end' or 'end-ns' event.

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

Class xmlfile

+
+object --+
+         |
+        xmlfile
+
+ +
Known Subclasses:
+
+ +
+ +
+

xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)

+

A simple mechanism for incremental XML serialisation.

+

Usage example:

+
+with xmlfile("somefile.xml", encoding='utf-8') as xf:
+    xf.write_declaration(standalone=True)
+    xf.write_doctype('<!DOCTYPE root SYSTEM "some.dtd">')
+
+    # generate an element (the root element)
+    with xf.element('root'):
+         # write a complete Element into the open root element
+         xf.write(etree.Element('test'))
+
+         # generate and write more Elements, e.g. through iterparse
+         for element in generate_some_elements():
+             # serialise generated elements into the XML file
+             xf.write(element)
+
+         # or write multiple Elements or strings at once
+         xf.write(etree.Element('start'), "text", etree.Element('end'))
+
+

If 'output_file' is a file(-like) object, passing close=True will +close it when exiting the context manager. By default, it is left +to the owner to do that. When a file path is used, lxml will take care +of opening and closing the file itself. Also, when a compression level +is set, lxml will deliberately close the file to make sure all data gets +compressed and written.

+

Setting buffered=False will flush the output after each operation, +such as opening or closing an xf.element() block or calling +xf.write(). Alternatively, calling xf.flush() can be used to +explicitly flush any pending output when buffering is enabled.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__aenter__(...) + + +
+ +
+   + + + + + + +
__aexit__(...) + + +
+ +
+   + + + + + + +
__enter__(...) + + +
+ +
+   + + + + + + +
__exit__(...) + + +
+ +
+   + + + + + + +
__init__(self, + output_file, + encoding=None, + compression=None, + close=False, + buffered=True)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + output_file, + encoding=None, + compression=None, + close=False, + buffered=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..cdfb6fc5 --- /dev/null +++ b/doc/html/api/lxml.html-module.html @@ -0,0 +1,1344 @@ + + + + + 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]
+
+   + + 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. +
+   + + Classes
+ Provides access to an element's class attribute as a set-like collection. +Usage: +
+   + + FieldsDict +
+   + + FormElement
+ Represents a <form> element. +
+   + + HTMLParser
+ An HTML parser that is configured to return lxml.html Element +objects. +
+   + + HtmlComment +
+   + + HtmlElement +
+   + + HtmlElementClassLookup
+ A lookup scheme for HTML Element classes. +
+   + + HtmlEntity +
+   + + HtmlMixin +
+   + + HtmlProcessingInstruction +
+   + + InputElement
+ Represents an <input> element. +
+   + + InputGetter
+ An accessor that represents all the input fields in a form. +
+   + + InputMixin
+ Mix-in for all input elements (input, select, and textarea) +
+   + + LabelElement
+ Represents a <label> 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. +
+   + + SelectElement
+ <select> element. You can get the name with .name. +
+   + + TextareaElement
+ <textarea> element. You can get the name with .name and +get/set the value with .value +
+   + + XHTMLParser
+ An XML parser that is configured to return lxml.html Element +objects. +
+   + + _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. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
Element(*args, + **kw)
+ Create a new HTML Element.
+ 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 + +
+ +
+   + + + + + + +
__fix_docstring(s) + 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 + +
+ +
+   + + + + + + +
_contains_block_level_tag(el) + source code + +
+ +
+   + + + + + + +
_element_name(el) + source code + +
+ +
+   + + + + + + +
_iter_css_imports(...)
+ finditer(string[, pos[, endpos]]) --> iterator. +Return an iterator over all non-overlapping matches for the +RE pattern in string. For each match, the iterator returns a +match object.
+ source code + +
+ +
+   + + + + + + +
_iter_css_urls(...)
+ finditer(string[, pos[, endpos]]) --> iterator. +Return an iterator over all non-overlapping matches for the +RE pattern in string. For each match, the iterator returns a +match object.
+ source code + +
+ +
+   + + + + + + +
_looks_like_full_html_bytes(...)
+ match(string[, pos[, endpos]]) --> match object or None. +Matches zero or more characters at the beginning of the string
+ source code + +
+ +
+   + + + + + + +
_looks_like_full_html_unicode(...)
+ match(string[, pos[, endpos]]) --> match object or None. +Matches zero or more characters at the beginning of the string
+ source code + +
+ +
+   + + + + + + +
_nons(tag) + source code + +
+ +
+   + + + + + + +
_parse_meta_refresh_url(...)
+ search(string[, pos[, endpos]]) --> match object or None. +Scan through string looking for a match, and return a corresponding +match object instance. Return None if no position in the string matches.
+ source code + +
+ +
+   + + + + + + +
_transform_result(typ, + result)
+ Convert the result back into the input type.
+ source code + +
+ +
+   + + + + + + +
_unquote_match(s, + pos) + source code + +
+ +
+   + + + + + + +
document_fromstring(html, + parser=None, + ensure_head_body=False, + **kw) + 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 + +
+ +
+   + + + + + + +
fragments_fromstring(html, + no_leading_text=False, + base_url=None, + parser=None, + **kw)
+ Parses several HTML elements, returning a list of elements.
+ source code + +
+ +
+   + + + + + + +
fromstring(html, + base_url=None, + parser=None, + **kw)
+ Parse the html, returning a single element/document.
+ source code + +
+ +
+   + + + + + + +
html_to_xhtml(html)
+ Convert all tags in an HTML tree to XHTML by moving them to the +XHTML namespace.
+ source code + +
+ +
+   + + + + + + +
open_http_urllib(method, + url, + values) + source code + +
+ +
+   + + + + + + +
open_in_browser(doc, + encoding=None)
+ Open the HTML document in a web browser, saving it to a temporary +file to open it. Note that this does not delete the file after +use. This is mainly meant for debugging.
+ 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. Note: this returns a tree, not an element. Use +parse(...).getroot() to get the document root.
+ source code + +
+ +
+   + + + + + + +
submit_form(form, + extra_values=None, + open_http=None)
+ 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.
+ source code + +
+ +
+   + + + + + + +
tostring(doc, + pretty_print=False, + include_meta_content_type=False, + encoding=None, + method='html', + with_tail=True, + doctype=None)
+ Return an HTML string representation of the document.
+ source code + +
+ +
+   + + + + + + +
xhtml_to_html(xhtml)
+ Convert all tags in an XHTML tree to HTML by removing their +XHTML namespace.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml' +
+   + + __package__ = 'lxml.html' +
+   + + _archive_re = re.compile(r'[^ ]+') +
+   + + _class_xpath = descendant-or-self::*[@class and contains(conca... +
+   + + _collect_string_content = string() +
+   + + _forms_xpath = descendant-or-self::form|descendant-or-self::x:... +
+   + + _id_xpath = descendant-or-self::*[@id=$id] +
+   + + _label_xpath = //label[@for=$id]|//x:label[@for=$id] +
+   + + _options_xpath = descendant-or-self::option|descendant-or-self... +
+   + + _rel_links_xpath = descendant-or-self::a[@rel]|descendant-or-s... +
+   + + find_class = <lxml.html._MethodFunc object> +
+   + + find_rel_links = <lxml.html._MethodFunc object> +
+   + + html_parser = <lxml.html.HTMLParser object> +
+   + + iterlinks = <lxml.html._MethodFunc object> +
+   + + make_links_absolute = <lxml.html._MethodFunc object> +
+   + + resolve_base_href = <lxml.html._MethodFunc object> +
+   + + rewrite_links = <lxml.html._MethodFunc object> +
+   + + xhtml_parser = <lxml.html.XHTMLParser object> +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

Element(*args, + **kw) +

+
source code  +
+ +

Create a new HTML Element.

+

This can also be used for XHTML documents.

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

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. In this +case, leading or trailing text is also allowed, as are multiple elements +as result of the parsing.

+

Passing a base_url will set the document's base_url attribute +(and the tree's docinfo.URL).

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

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. +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).

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

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', + with_tail=True, + doctype=None) +

+
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 (defaults to +ASCII, with &#...; character references for any characters outside +of ASCII). Note that you can pass the name 'unicode' as +encoding argument to serialise to a Unicode string.

+

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.

+

To leave out the tail text of the top-level element that is being +serialised, pass with_tail=False.

+

The doctype option allows passing in a plain string that will +be serialised before the XML tree. Note that passing in non +well-formed content here will make the XML output non well-formed. +Also, an existing doctype in the document tree will not be removed +when serialising an ElementTree instance.

+

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!'
+
+>>> root = html.fragment_fromstring('<div><p>Hello<br>world!</p>TAIL</div>')
+>>> html.tostring(root[0], method='text', encoding='unicode')
+u'Helloworld!TAIL'
+
+>>> html.tostring(root[0], method='text', encoding='unicode', with_tail=False)
+u'Helloworld!'
+
+>>> doc = html.document_fromstring('<p>Hello<br>world!</p>')
+>>> html.tostring(doc, method='html', encoding='unicode')
+u'<html><body><p>Hello<br>world!</p></body></html>'
+
+>>> print(html.tostring(doc, method='html', encoding='unicode',
+...          doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'
+...                  ' "http://www.w3.org/TR/html4/strict.dtd">'))
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html><body><p>Hello<br>world!</p></body></html>
+
+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

_class_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::*[@class and contains(concat(' ', normalize-space(\
+@class), ' '), concat(' ', $class_name, ' '))]
+
+
+
+
+
+ +
+ +
+

_forms_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::form|descendant-or-self::x:form
+
+
+
+
+
+ +
+ +
+

_options_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::option|descendant-or-self::x:option
+
+
+
+
+
+ +
+ +
+

_rel_links_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html-pysrc.html b/doc/html/api/lxml.html-pysrc.html new file mode 100644 index 00000000..2292611a --- /dev/null +++ b/doc/html/api/lxml.html-pysrc.html @@ -0,0 +1,4176 @@ + + + + + lxml.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml.html

+
+   1  # Copyright (c) 2004 Ian Bicking. All rights reserved. 
+   2  # 
+   3  # Redistribution and use in source and binary forms, with or without 
+   4  # modification, are permitted provided that the following conditions are 
+   5  # met: 
+   6  # 
+   7  # 1. Redistributions of source code must retain the above copyright 
+   8  # notice, this list of conditions and the following disclaimer. 
+   9  # 
+  10  # 2. Redistributions in binary form must reproduce the above copyright 
+  11  # notice, this list of conditions and the following disclaimer in 
+  12  # the documentation and/or other materials provided with the 
+  13  # distribution. 
+  14  # 
+  15  # 3. Neither the name of Ian Bicking nor the names of its contributors may 
+  16  # be used to endorse or promote products derived from this software 
+  17  # without specific prior written permission. 
+  18  # 
+  19  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+  20  # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+  21  # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
+  22  # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR 
+  23  # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+  24  # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+  25  # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+  26  # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+  27  # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+  28  # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+  29  # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+  30   
+  31  """The ``lxml.html`` tool set for HTML handling. 
+  32  """ 
+  33   
+  34  from __future__ import absolute_import 
+  35   
+  36  __all__ = [ 
+  37      'document_fromstring', 'fragment_fromstring', 'fragments_fromstring', 'fromstring', 
+  38      'tostring', 'Element', 'defs', 'open_in_browser', 'submit_form', 
+  39      'find_rel_links', 'find_class', 'make_links_absolute', 
+  40      'resolve_base_href', 'iterlinks', 'rewrite_links', 'open_in_browser', 'parse'] 
+  41   
+  42   
+  43  import copy 
+  44  import sys 
+  45  import re 
+  46  from functools import partial 
+  47   
+  48  try: 
+  49      from collections.abc import MutableMapping, MutableSet 
+  50  except ImportError: 
+  51      from collections import MutableMapping, MutableSet 
+  52   
+  53  from .. import etree 
+  54  from . import defs 
+  55  from ._setmixin import SetMixin 
+  56   
+  57  try: 
+  58      from urlparse import urljoin 
+  59  except ImportError: 
+  60      # Python 3 
+  61      from urllib.parse import urljoin 
+  62   
+  63  try: 
+  64      unicode 
+  65  except NameError: 
+  66      # Python 3 
+  67      unicode = str 
+  68  try: 
+  69      basestring 
+  70  except NameError: 
+  71      # Python 3 
+  72      basestring = (str, bytes) 
+
73 + 74 + 75 -def __fix_docstring(s): +
76 if not s: + 77 return s + 78 if sys.version_info[0] >= 3: + 79 sub = re.compile(r"^(\s*)u'", re.M).sub + 80 else: + 81 sub = re.compile(r"^(\s*)b'", re.M).sub + 82 return sub(r"\1'", s) +
83 + 84 + 85 XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" + 86 + 87 _rel_links_xpath = etree.XPath("descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]", + 88 namespaces={'x':XHTML_NAMESPACE}) + 89 _options_xpath = etree.XPath("descendant-or-self::option|descendant-or-self::x:option", + 90 namespaces={'x':XHTML_NAMESPACE}) + 91 _forms_xpath = etree.XPath("descendant-or-self::form|descendant-or-self::x:form", + 92 namespaces={'x':XHTML_NAMESPACE}) + 93 #_class_xpath = etree.XPath(r"descendant-or-self::*[regexp:match(@class, concat('\b', $class_name, '\b'))]", {'regexp': 'http://exslt.org/regular-expressions'}) + 94 _class_xpath = etree.XPath("descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), concat(' ', $class_name, ' '))]") + 95 _id_xpath = etree.XPath("descendant-or-self::*[@id=$id]") + 96 _collect_string_content = etree.XPath("string()") + 97 _iter_css_urls = re.compile(r'url\(('+'["][^"]*["]|'+"['][^']*[']|"+r'[^)]*)\)', re.I).finditer + 98 _iter_css_imports = re.compile(r'@import "(.*?)"').finditer + 99 _label_xpath = etree.XPath("//label[@for=$id]|//x:label[@for=$id]", + 100 namespaces={'x':XHTML_NAMESPACE}) + 101 _archive_re = re.compile(r'[^ ]+') + 102 _parse_meta_refresh_url = re.compile( + 103 r'[^;=]*;\s*(?:url\s*=\s*)?(?P<url>.*)$', re.I).search +
104 + 105 + 106 -def _unquote_match(s, pos): +
107 if s[:1] == '"' and s[-1:] == '"' or s[:1] == "'" and s[-1:] == "'": + 108 return s[1:-1], pos+1 + 109 else: + 110 return s,pos +
111 +
112 + 113 -def _transform_result(typ, result): +
114 """Convert the result back into the input type. + 115 """ + 116 if issubclass(typ, bytes): + 117 return tostring(result, encoding='utf-8') + 118 elif issubclass(typ, unicode): + 119 return tostring(result, encoding='unicode') + 120 else: + 121 return result +
122 +
123 + 124 -def _nons(tag): +
125 if isinstance(tag, basestring): + 126 if tag[0] == '{' and tag[1:len(XHTML_NAMESPACE)+1] == XHTML_NAMESPACE: + 127 return tag.split('}')[-1] + 128 return tag +
129 +
130 + 131 -class Classes(MutableSet): +
132 """Provides access to an element's class attribute as a set-like collection. + 133 Usage:: + 134 + 135 >>> el = fromstring('<p class="hidden large">Text</p>') + 136 >>> classes = el.classes # or: classes = Classes(el.attrib) + 137 >>> classes |= ['block', 'paragraph'] + 138 >>> el.get('class') + 139 'hidden large block paragraph' + 140 >>> classes.toggle('hidden') + 141 False + 142 >>> el.get('class') + 143 'large block paragraph' + 144 >>> classes -= ('some', 'classes', 'block') + 145 >>> el.get('class') + 146 'large paragraph' + 147 """ +
148 - def __init__(self, attributes): +
149 self._attributes = attributes + 150 self._get_class_value = partial(attributes.get, 'class', '') +
151 +
152 - def add(self, value): +
153 """ + 154 Add a class. + 155 + 156 This has no effect if the class is already present. + 157 """ + 158 if not value or re.search(r'\s', value): + 159 raise ValueError("Invalid class name: %r" % value) + 160 classes = self._get_class_value().split() + 161 if value in classes: + 162 return + 163 classes.append(value) + 164 self._attributes['class'] = ' '.join(classes) +
165 +
166 - def discard(self, value): +
167 """ + 168 Remove a class if it is currently present. + 169 + 170 If the class is not present, do nothing. + 171 """ + 172 if not value or re.search(r'\s', value): + 173 raise ValueError("Invalid class name: %r" % value) + 174 classes = [name for name in self._get_class_value().split() + 175 if name != value] + 176 if classes: + 177 self._attributes['class'] = ' '.join(classes) + 178 elif 'class' in self._attributes: + 179 del self._attributes['class'] +
180 +
181 - def remove(self, value): +
182 """ + 183 Remove a class; it must currently be present. + 184 + 185 If the class is not present, raise a KeyError. + 186 """ + 187 if not value or re.search(r'\s', value): + 188 raise ValueError("Invalid class name: %r" % value) + 189 super(Classes, self).remove(value) +
190 +
191 - def __contains__(self, name): +
192 classes = self._get_class_value() + 193 return name in classes and name in classes.split() +
194 +
195 - def __iter__(self): +
196 return iter(self._get_class_value().split()) +
197 +
198 - def __len__(self): +
199 return len(self._get_class_value().split()) +
200 + 201 # non-standard methods + 202 +
203 - def update(self, values): +
204 """ + 205 Add all names from 'values'. + 206 """ + 207 classes = self._get_class_value().split() + 208 extended = False + 209 for value in values: + 210 if value not in classes: + 211 classes.append(value) + 212 extended = True + 213 if extended: + 214 self._attributes['class'] = ' '.join(classes) +
215 +
216 - def toggle(self, value): +
217 """ + 218 Add a class name if it isn't there yet, or remove it if it exists. + 219 + 220 Returns true if the class was added (and is now enabled) and + 221 false if it was removed (and is now disabled). + 222 """ + 223 if not value or re.search(r'\s', value): + 224 raise ValueError("Invalid class name: %r" % value) + 225 classes = self._get_class_value().split() + 226 try: + 227 classes.remove(value) + 228 enabled = False + 229 except ValueError: + 230 classes.append(value) + 231 enabled = True + 232 if classes: + 233 self._attributes['class'] = ' '.join(classes) + 234 else: + 235 del self._attributes['class'] + 236 return enabled +
237 +
238 + 239 -class HtmlMixin(object): +
240 +
241 - def set(self, key, value=None): +
242 """set(self, key, value=None) + 243 + 244 Sets an element attribute. If no value is provided, or if the value is None, + 245 creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" + 246 for ``form.set('novalidate')``. + 247 """ + 248 super(HtmlElement, self).set(key, value) +
249 + 250 @property +
251 - def classes(self): +
252 """ + 253 A set-like wrapper around the 'class' attribute. + 254 """ + 255 return Classes(self.attrib) +
256 + 257 @classes.setter +
258 - def classes(self, classes): +
259 assert isinstance(classes, Classes) # only allow "el.classes |= ..." etc. + 260 value = classes._get_class_value() + 261 if value: + 262 self.set('class', value) + 263 elif self.get('class') is not None: + 264 del self.attrib['class'] +
265 + 266 @property +
267 - def base_url(self): +
268 """ + 269 Returns the base URL, given when the page was parsed. + 270 + 271 Use with ``urlparse.urljoin(el.base_url, href)`` to get + 272 absolute URLs. + 273 """ + 274 return self.getroottree().docinfo.URL +
275 + 276 @property +
277 - def forms(self): +
278 """ + 279 Return a list of all the forms + 280 """ + 281 return _forms_xpath(self) +
282 + 283 @property +
284 - def body(self): +
285 """ + 286 Return the <body> element. Can be called from a child element + 287 to get the document's head. + 288 """ + 289 return self.xpath('//body|//x:body', namespaces={'x':XHTML_NAMESPACE})[0] +
290 + 291 @property +
292 - def head(self): +
293 """ + 294 Returns the <head> element. Can be called from a child + 295 element to get the document's head. + 296 """ + 297 return self.xpath('//head|//x:head', namespaces={'x':XHTML_NAMESPACE})[0] +
298 + 299 @property +
300 - def label(self): +
301 """ + 302 Get or set any <label> element associated with this element. + 303 """ + 304 id = self.get('id') + 305 if not id: + 306 return None + 307 result = _label_xpath(self, id=id) + 308 if not result: + 309 return None + 310 else: + 311 return result[0] +
312 + 313 @label.setter +
314 - def label(self, label): +
315 id = self.get('id') + 316 if not id: + 317 raise TypeError( + 318 "You cannot set a label for an element (%r) that has no id" + 319 % self) + 320 if _nons(label.tag) != 'label': + 321 raise TypeError( + 322 "You can only assign label to a label element (not %r)" + 323 % label) + 324 label.set('for', id) +
325 + 326 @label.deleter +
327 - def label(self): +
328 label = self.label + 329 if label is not None: + 330 del label.attrib['for'] +
331 +
332 - def drop_tree(self): +
333 """ + 334 Removes this element from the tree, including its children and + 335 text. The tail text is joined to the previous element or + 336 parent. + 337 """ + 338 parent = self.getparent() + 339 assert parent is not None + 340 if self.tail: + 341 previous = self.getprevious() + 342 if previous is None: + 343 parent.text = (parent.text or '') + self.tail + 344 else: + 345 previous.tail = (previous.tail or '') + self.tail + 346 parent.remove(self) +
347 +
348 - def drop_tag(self): +
349 """ + 350 Remove the tag, but not its children or text. The children and text + 351 are merged into the parent. + 352 + 353 Example:: + 354 + 355 >>> h = fragment_fromstring('<div>Hello <b>World!</b></div>') + 356 >>> h.find('.//b').drop_tag() + 357 >>> print(tostring(h, encoding='unicode')) + 358 <div>Hello World!</div> + 359 """ + 360 parent = self.getparent() + 361 assert parent is not None + 362 previous = self.getprevious() + 363 if self.text and isinstance(self.tag, basestring): + 364 # not a Comment, etc. + 365 if previous is None: + 366 parent.text = (parent.text or '') + self.text + 367 else: + 368 previous.tail = (previous.tail or '') + self.text + 369 if self.tail: + 370 if len(self): + 371 last = self[-1] + 372 last.tail = (last.tail or '') + self.tail + 373 elif previous is None: + 374 parent.text = (parent.text or '') + self.tail + 375 else: + 376 previous.tail = (previous.tail or '') + self.tail + 377 index = parent.index(self) + 378 parent[index:index+1] = self[:] +
379 + 387 +
388 - def find_class(self, class_name): +
389 """ + 390 Find any elements with the given class name. + 391 """ + 392 return _class_xpath(self, class_name=class_name) +
393 +
394 - def get_element_by_id(self, id, *default): +
395 """ + 396 Get the first element in a document with the given id. If none is + 397 found, return the default argument if provided or raise KeyError + 398 otherwise. + 399 + 400 Note that there can be more than one element with the same id, + 401 and this isn't uncommon in HTML documents found in the wild. + 402 Browsers return only the first match, and this function does + 403 the same. + 404 """ + 405 try: + 406 # FIXME: should this check for multiple matches? + 407 # browsers just return the first one + 408 return _id_xpath(self, id=id)[0] + 409 except IndexError: + 410 if default: + 411 return default[0] + 412 else: + 413 raise KeyError(id) +
414 +
415 - def text_content(self): +
416 """ + 417 Return the text content of the tag (and the text in any children). + 418 """ + 419 return _collect_string_content(self) +
420 +
421 - def cssselect(self, expr, translator='html'): +
422 """ + 423 Run the CSS expression on this element and its children, + 424 returning a list of the results. + 425 + 426 Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self) + 427 -- note that pre-compiling the expression can provide a substantial + 428 speedup. + 429 """ + 430 # Do the import here to make the dependency optional. + 431 from lxml.cssselect import CSSSelector + 432 return CSSSelector(expr, translator=translator)(self) +
433 + 434 ######################################## + 435 ## Link functions + 436 ######################################## + 437 + 468 elif handle_failures == 'discard': + 469 def link_repl(href): + 470 try: + 471 return urljoin(base_url, href) + 472 except ValueError: + 473 return None +
474 elif handle_failures is None: + 475 def link_repl(href): + 476 return urljoin(base_url, href) + 477 else: + 478 raise ValueError( + 479 "unexpected value for handle_failures: %r" % handle_failures) + 480 + 481 self.rewrite_links(link_repl) + 482 +
483 - def resolve_base_href(self, handle_failures=None): +
484 """ + 485 Find any ``<base href>`` tag in the document, and apply its + 486 values to all links found in the document. Also remove the + 487 tag once it has been applied. + 488 + 489 If ``handle_failures`` is None (default), a failure to process + 490 a URL will abort the processing. If set to 'ignore', errors + 491 are ignored. If set to 'discard', failing URLs will be removed. + 492 """ + 493 base_href = None + 494 basetags = self.xpath('//base[@href]|//x:base[@href]', + 495 namespaces={'x': XHTML_NAMESPACE}) + 496 for b in basetags: + 497 base_href = b.get('href') + 498 b.drop_tree() + 499 if not base_href: + 500 return + 501 self.make_links_absolute(base_href, resolve_base_href=False, + 502 handle_failures=handle_failures) +
503 + 593 + 642 +
643 + 644 -class _MethodFunc(object): +
645 """ + 646 An object that represents a method on an element as a function; + 647 the function takes either an element or an HTML string. It + 648 returns whatever the function normally returns, or if the function + 649 works in-place (and so returns None) it returns a serialized form + 650 of the resulting document. + 651 """ +
652 - def __init__(self, name, copy=False, source_class=HtmlMixin): +
653 self.name = name + 654 self.copy = copy + 655 self.__doc__ = getattr(source_class, self.name).__doc__ +
656 - def __call__(self, doc, *args, **kw): +
657 result_type = type(doc) + 658 if isinstance(doc, basestring): + 659 if 'copy' in kw: + 660 raise TypeError( + 661 "The keyword 'copy' can only be used with element inputs to %s, not a string input" % self.name) + 662 doc = fromstring(doc, **kw) + 663 else: + 664 if 'copy' in kw: + 665 make_a_copy = kw.pop('copy') + 666 else: + 667 make_a_copy = self.copy + 668 if make_a_copy: + 669 doc = copy.deepcopy(doc) + 670 meth = getattr(doc, self.name) + 671 result = meth(*args, **kw) + 672 # FIXME: this None test is a bit sloppy + 673 if result is None: + 674 # Then return what we got in + 675 return _transform_result(result_type, doc) + 676 else: + 677 return result +
678 + 679 + 680 find_rel_links = _MethodFunc('find_rel_links', copy=False) + 681 find_class = _MethodFunc('find_class', copy=False) + 682 make_links_absolute = _MethodFunc('make_links_absolute', copy=True) + 683 resolve_base_href = _MethodFunc('resolve_base_href', copy=True) + 684 iterlinks = _MethodFunc('iterlinks', copy=False) + 685 rewrite_links = _MethodFunc('rewrite_links', copy=True) +
686 + 687 + 688 -class HtmlComment(etree.CommentBase, HtmlMixin): +
689 pass +
690 +
691 + 692 -class HtmlElement(etree.ElementBase, HtmlMixin): +
693 # Override etree.ElementBase.cssselect() and set(), despite the MRO (FIXME: change base order?) + 694 cssselect = HtmlMixin.cssselect + 695 set = HtmlMixin.set +
696 +
697 + 698 -class HtmlProcessingInstruction(etree.PIBase, HtmlMixin): +
699 pass +
700 +
701 + 702 -class HtmlEntity(etree.EntityBase, HtmlMixin): +
703 pass +
704 +
705 + 706 -class HtmlElementClassLookup(etree.CustomElementClassLookup): +
707 """A lookup scheme for HTML Element classes. + 708 + 709 To create a lookup instance with different Element classes, pass a tag + 710 name mapping of Element classes in the ``classes`` keyword argument and/or + 711 a tag name mapping of Mixin classes in the ``mixins`` keyword argument. + 712 The special key '*' denotes a Mixin class that should be mixed into all + 713 Element classes. + 714 """ + 715 _default_element_classes = {} + 716 +
717 - def __init__(self, classes=None, mixins=None): +
718 etree.CustomElementClassLookup.__init__(self) + 719 if classes is None: + 720 classes = self._default_element_classes.copy() + 721 if mixins: + 722 mixers = {} + 723 for name, value in mixins: + 724 if name == '*': + 725 for n in classes.keys(): + 726 mixers.setdefault(n, []).append(value) + 727 else: + 728 mixers.setdefault(name, []).append(value) + 729 for name, mix_bases in mixers.items(): + 730 cur = classes.get(name, HtmlElement) + 731 bases = tuple(mix_bases + [cur]) + 732 classes[name] = type(cur.__name__, bases, {}) + 733 self._element_classes = classes +
734 +
735 - def lookup(self, node_type, document, namespace, name): +
736 if node_type == 'element': + 737 return self._element_classes.get(name.lower(), HtmlElement) + 738 elif node_type == 'comment': + 739 return HtmlComment + 740 elif node_type == 'PI': + 741 return HtmlProcessingInstruction + 742 elif node_type == 'entity': + 743 return HtmlEntity + 744 # Otherwise normal lookup + 745 return None +
746 + 747 + 748 ################################################################################ + 749 # parsing + 750 ################################################################################ + 751 + 752 _looks_like_full_html_unicode = re.compile( + 753 unicode(r'^\s*<(?:html|!doctype)'), re.I).match + 754 _looks_like_full_html_bytes = re.compile( + 755 r'^\s*<(?:html|!doctype)'.encode('ascii'), re.I).match +
756 + 757 + 758 -def document_fromstring(html, parser=None, ensure_head_body=False, **kw): +
759 if parser is None: + 760 parser = html_parser + 761 value = etree.fromstring(html, parser, **kw) + 762 if value is None: + 763 raise etree.ParserError( + 764 "Document is empty") + 765 if ensure_head_body and value.find('head') is None: + 766 value.insert(0, Element('head')) + 767 if ensure_head_body and value.find('body') is None: + 768 value.append(Element('body')) + 769 return value +
770 +
771 + 772 -def fragments_fromstring(html, no_leading_text=False, base_url=None, + 773 parser=None, **kw): +
774 """Parses several HTML elements, returning a list of elements. + 775 + 776 The first item in the list may be a string. + 777 If no_leading_text is true, then it will be an error if there is + 778 leading text, and it will always be a list of only elements. + 779 + 780 base_url will set the document's base_url attribute + 781 (and the tree's docinfo.URL). + 782 """ + 783 if parser is None: + 784 parser = html_parser + 785 # FIXME: check what happens when you give html with a body, head, etc. + 786 if isinstance(html, bytes): + 787 if not _looks_like_full_html_bytes(html): + 788 # can't use %-formatting in early Py3 versions + 789 html = ('<html><body>'.encode('ascii') + html + + 790 '</body></html>'.encode('ascii')) + 791 else: + 792 if not _looks_like_full_html_unicode(html): + 793 html = '<html><body>%s</body></html>' % html + 794 doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) + 795 assert _nons(doc.tag) == 'html' + 796 bodies = [e for e in doc if _nons(e.tag) == 'body'] + 797 assert len(bodies) == 1, ("too many bodies: %r in %r" % (bodies, html)) + 798 body = bodies[0] + 799 elements = [] + 800 if no_leading_text and body.text and body.text.strip(): + 801 raise etree.ParserError( + 802 "There is leading text: %r" % body.text) + 803 if body.text and body.text.strip(): + 804 elements.append(body.text) + 805 elements.extend(body) + 806 # FIXME: removing the reference to the parent artificial document + 807 # would be nice + 808 return elements +
809 +
810 + 811 -def fragment_fromstring(html, create_parent=False, base_url=None, + 812 parser=None, **kw): +
813 """ + 814 Parses a single HTML element; it is an error if there is more than + 815 one element, or if anything but whitespace precedes or follows the + 816 element. + 817 + 818 If ``create_parent`` is true (or is a tag name) then a parent node + 819 will be created to encapsulate the HTML in a single element. In this + 820 case, leading or trailing text is also allowed, as are multiple elements + 821 as result of the parsing. + 822 + 823 Passing a ``base_url`` will set the document's ``base_url`` attribute + 824 (and the tree's docinfo.URL). + 825 """ + 826 if parser is None: + 827 parser = html_parser + 828 + 829 accept_leading_text = bool(create_parent) + 830 + 831 elements = fragments_fromstring( + 832 html, parser=parser, no_leading_text=not accept_leading_text, + 833 base_url=base_url, **kw) + 834 + 835 if create_parent: + 836 if not isinstance(create_parent, basestring): + 837 create_parent = 'div' + 838 new_root = Element(create_parent) + 839 if elements: + 840 if isinstance(elements[0], basestring): + 841 new_root.text = elements[0] + 842 del elements[0] + 843 new_root.extend(elements) + 844 return new_root + 845 + 846 if not elements: + 847 raise etree.ParserError('No elements found') + 848 if len(elements) > 1: + 849 raise etree.ParserError( + 850 "Multiple elements found (%s)" + 851 % ', '.join([_element_name(e) for e in elements])) + 852 el = elements[0] + 853 if el.tail and el.tail.strip(): + 854 raise etree.ParserError( + 855 "Element followed by text: %r" % el.tail) + 856 el.tail = None + 857 return el +
858 +
859 + 860 -def fromstring(html, base_url=None, parser=None, **kw): +
861 """ + 862 Parse the html, returning a single element/document. + 863 + 864 This tries to minimally parse the chunk of text, without knowing if it + 865 is a fragment or a document. + 866 + 867 base_url will set the document's base_url attribute (and the tree's docinfo.URL) + 868 """ + 869 if parser is None: + 870 parser = html_parser + 871 if isinstance(html, bytes): + 872 is_full_html = _looks_like_full_html_bytes(html) + 873 else: + 874 is_full_html = _looks_like_full_html_unicode(html) + 875 doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) + 876 if is_full_html: + 877 return doc + 878 # otherwise, lets parse it out... + 879 bodies = doc.findall('body') + 880 if not bodies: + 881 bodies = doc.findall('{%s}body' % XHTML_NAMESPACE) + 882 if bodies: + 883 body = bodies[0] + 884 if len(bodies) > 1: + 885 # Somehow there are multiple bodies, which is bad, but just + 886 # smash them into one body + 887 for other_body in bodies[1:]: + 888 if other_body.text: + 889 if len(body): + 890 body[-1].tail = (body[-1].tail or '') + other_body.text + 891 else: + 892 body.text = (body.text or '') + other_body.text + 893 body.extend(other_body) + 894 # We'll ignore tail + 895 # I guess we are ignoring attributes too + 896 other_body.drop_tree() + 897 else: + 898 body = None + 899 heads = doc.findall('head') + 900 if not heads: + 901 heads = doc.findall('{%s}head' % XHTML_NAMESPACE) + 902 if heads: + 903 # Well, we have some sort of structure, so lets keep it all + 904 head = heads[0] + 905 if len(heads) > 1: + 906 for other_head in heads[1:]: + 907 head.extend(other_head) + 908 # We don't care about text or tail in a head + 909 other_head.drop_tree() + 910 return doc + 911 if body is None: + 912 return doc + 913 if (len(body) == 1 and (not body.text or not body.text.strip()) + 914 and (not body[-1].tail or not body[-1].tail.strip())): + 915 # The body has just one element, so it was probably a single + 916 # element passed in + 917 return body[0] + 918 # Now we have a body which represents a bunch of tags which have the + 919 # content that was passed in. We will create a fake container, which + 920 # is the body tag, except <body> implies too much structure. + 921 if _contains_block_level_tag(body): + 922 body.tag = 'div' + 923 else: + 924 body.tag = 'span' + 925 return body +
926 +
927 + 928 -def parse(filename_or_url, parser=None, base_url=None, **kw): +
929 """ + 930 Parse a filename, URL, or file-like object into an HTML document + 931 tree. Note: this returns a tree, not an element. Use + 932 ``parse(...).getroot()`` to get the document root. + 933 + 934 You can override the base URL with the ``base_url`` keyword. This + 935 is most useful when parsing from a file-like object. + 936 """ + 937 if parser is None: + 938 parser = html_parser + 939 return etree.parse(filename_or_url, parser, base_url=base_url, **kw) +
940 +
941 + 942 -def _contains_block_level_tag(el): +
943 # FIXME: I could do this with XPath, but would that just be + 944 # unnecessarily slow? + 945 for el in el.iter(etree.Element): + 946 if _nons(el.tag) in defs.block_tags: + 947 return True + 948 return False +
949 +
950 + 951 -def _element_name(el): +
952 if isinstance(el, etree.CommentBase): + 953 return 'comment' + 954 elif isinstance(el, basestring): + 955 return 'string' + 956 else: + 957 return _nons(el.tag) +
958 +
959 + 960 ################################################################################ + 961 # form handling + 962 ################################################################################ + 963 + 964 -class FormElement(HtmlElement): +
965 """ + 966 Represents a <form> element. + 967 """ + 968 + 969 @property +
970 - def inputs(self): +
971 """ + 972 Returns an accessor for all the input elements in the form. + 973 + 974 See `InputGetter` for more information about the object. + 975 """ + 976 return InputGetter(self) +
977 + 978 @property +
979 - def fields(self): +
980 """ + 981 Dictionary-like object that represents all the fields in this + 982 form. You can set values in this dictionary to effect the + 983 form. + 984 """ + 985 return FieldsDict(self.inputs) +
986 + 987 @fields.setter +
988 - def fields(self, value): +
989 fields = self.fields + 990 prev_keys = fields.keys() + 991 for key, value in value.items(): + 992 if key in prev_keys: + 993 prev_keys.remove(key) + 994 fields[key] = value + 995 for key in prev_keys: + 996 if key is None: + 997 # Case of an unnamed input; these aren't really + 998 # expressed in form_values() anyway. + 999 continue +1000 fields[key] = None +
1001 +
1002 - def _name(self): +
1003 if self.get('name'): +1004 return self.get('name') +1005 elif self.get('id'): +1006 return '#' + self.get('id') +1007 iter_tags = self.body.iter +1008 forms = list(iter_tags('form')) +1009 if not forms: +1010 forms = list(iter_tags('{%s}form' % XHTML_NAMESPACE)) +1011 return str(forms.index(self)) +
1012 +
1013 - def form_values(self): +
1014 """ +1015 Return a list of tuples of the field values for the form. +1016 This is suitable to be passed to ``urllib.urlencode()``. +1017 """ +1018 results = [] +1019 for el in self.inputs: +1020 name = el.name +1021 if not name or 'disabled' in el.attrib: +1022 continue +1023 tag = _nons(el.tag) +1024 if tag == 'textarea': +1025 results.append((name, el.value)) +1026 elif tag == 'select': +1027 value = el.value +1028 if el.multiple: +1029 for v in value: +1030 results.append((name, v)) +1031 elif value is not None: +1032 results.append((name, el.value)) +1033 else: +1034 assert tag == 'input', ( +1035 "Unexpected tag: %r" % el) +1036 if el.checkable and not el.checked: +1037 continue +1038 if el.type in ('submit', 'image', 'reset', 'file'): +1039 continue +1040 value = el.value +1041 if value is not None: +1042 results.append((name, el.value)) +1043 return results +
1044 +1045 @property +
1046 - def action(self): +
1047 """ +1048 Get/set the form's ``action`` attribute. +1049 """ +1050 base_url = self.base_url +1051 action = self.get('action') +1052 if base_url and action is not None: +1053 return urljoin(base_url, action) +1054 else: +1055 return action +
1056 +1057 @action.setter +
1058 - def action(self, value): +
1059 self.set('action', value) +
1060 +1061 @action.deleter +
1062 - def action(self): +
1063 attrib = self.attrib +1064 if 'action' in attrib: +1065 del attrib['action'] +
1066 +1067 @property +
1068 - def method(self): +
1069 """ +1070 Get/set the form's method. Always returns a capitalized +1071 string, and defaults to ``'GET'`` +1072 """ +1073 return self.get('method', 'GET').upper() +
1074 +1075 @method.setter +
1076 - def method(self, value): +
1077 self.set('method', value.upper()) +
1078 +1079 +1080 HtmlElementClassLookup._default_element_classes['form'] = FormElement +
1081 +1082 +1083 -def submit_form(form, extra_values=None, open_http=None): +
1084 """ +1085 Helper function to submit a form. Returns a file-like object, as from +1086 ``urllib.urlopen()``. This object also has a ``.geturl()`` function, +1087 which shows the URL if there were any redirects. +1088 +1089 You can use this like:: +1090 +1091 form = doc.forms[0] +1092 form.inputs['foo'].value = 'bar' # etc +1093 response = form.submit() +1094 doc = parse(response) +1095 doc.make_links_absolute(response.geturl()) +1096 +1097 To change the HTTP requester, pass a function as ``open_http`` keyword +1098 argument that opens the URL for you. The function must have the following +1099 signature:: +1100 +1101 open_http(method, URL, values) +1102 +1103 The action is one of 'GET' or 'POST', the URL is the target URL as a +1104 string, and the values are a sequence of ``(name, value)`` tuples with the +1105 form data. +1106 """ +1107 values = form.form_values() +1108 if extra_values: +1109 if hasattr(extra_values, 'items'): +1110 extra_values = extra_values.items() +1111 values.extend(extra_values) +1112 if open_http is None: +1113 open_http = open_http_urllib +1114 if form.action: +1115 url = form.action +1116 else: +1117 url = form.base_url +1118 return open_http(form.method, url, values) +
1119 +
1120 +1121 -def open_http_urllib(method, url, values): +
1122 if not url: +1123 raise ValueError("cannot submit, no URL provided") +1124 ## FIXME: should test that it's not a relative URL or something +1125 try: +1126 from urllib import urlencode, urlopen +1127 except ImportError: # Python 3 +1128 from urllib.request import urlopen +1129 from urllib.parse import urlencode +1130 if method == 'GET': +1131 if '?' in url: +1132 url += '&' +1133 else: +1134 url += '?' +1135 url += urlencode(values) +1136 data = None +1137 else: +1138 data = urlencode(values) +1139 if not isinstance(data, bytes): +1140 data = data.encode('ASCII') +1141 return urlopen(url, data) +
1142 +
1143 +1144 -class FieldsDict(MutableMapping): +
1145 +
1146 - def __init__(self, inputs): +
1147 self.inputs = inputs +
1148 - def __getitem__(self, item): +
1149 return self.inputs[item].value +
1150 - def __setitem__(self, item, value): +
1151 self.inputs[item].value = value +
1152 - def __delitem__(self, item): +
1153 raise KeyError( +1154 "You cannot remove keys from ElementDict") +
1155 - def keys(self): +
1156 return self.inputs.keys() +
1157 - def __contains__(self, item): +
1158 return item in self.inputs +
1159 - def __iter__(self): +
1160 return iter(self.inputs.keys()) +
1161 - def __len__(self): +
1162 return len(self.inputs) +
1163 +
1164 - def __repr__(self): +
1165 return '<%s for form %s>' % ( +1166 self.__class__.__name__, +1167 self.inputs.form._name()) +
1168 +
1169 +1170 -class InputGetter(object): +
1171 +1172 """ +1173 An accessor that represents all the input fields in a form. +1174 +1175 You can get fields by name from this, with +1176 ``form.inputs['field_name']``. If there are a set of checkboxes +1177 with the same name, they are returned as a list (a `CheckboxGroup` +1178 which also allows value setting). Radio inputs are handled +1179 similarly. +1180 +1181 You can also iterate over this to get all input elements. This +1182 won't return the same thing as if you get all the names, as +1183 checkboxes and radio elements are returned individually. +1184 """ +1185 +1186 _name_xpath = etree.XPath(".//*[@name = $name and (local-name(.) = 'select' or local-name(.) = 'input' or local-name(.) = 'textarea')]") +1187 _all_xpath = etree.XPath(".//*[local-name() = 'select' or local-name() = 'input' or local-name() = 'textarea']") +1188 +
1189 - def __init__(self, form): +
1190 self.form = form +
1191 +
1192 - def __repr__(self): +
1193 return '<%s for form %s>' % ( +1194 self.__class__.__name__, +1195 self.form._name()) +
1196 +1197 ## FIXME: there should be more methods, and it's unclear if this is +1198 ## a dictionary-like object or list-like object +1199 +
1200 - def __getitem__(self, name): +
1201 results = self._name_xpath(self.form, name=name) +1202 if results: +1203 type = results[0].get('type') +1204 if type == 'radio' and len(results) > 1: +1205 group = RadioGroup(results) +1206 group.name = name +1207 return group +1208 elif type == 'checkbox' and len(results) > 1: +1209 group = CheckboxGroup(results) +1210 group.name = name +1211 return group +1212 else: +1213 # I don't like throwing away elements like this +1214 return results[0] +1215 else: +1216 raise KeyError( +1217 "No input element with the name %r" % name) +
1218 +
1219 - def __contains__(self, name): +
1220 results = self._name_xpath(self.form, name=name) +1221 return bool(results) +
1222 +
1223 - def keys(self): +
1224 names = set() +1225 for el in self: +1226 names.add(el.name) +1227 if None in names: +1228 names.remove(None) +1229 return list(names) +
1230 +
1231 - def __iter__(self): +
1232 ## FIXME: kind of dumb to turn a list into an iterator, only +1233 ## to have it likely turned back into a list again :( +1234 return iter(self._all_xpath(self.form)) +
1235 +
1236 +1237 -class InputMixin(object): +
1238 """ +1239 Mix-in for all input elements (input, select, and textarea) +1240 """ +1241 @property +
1242 - def name(self): +
1243 """ +1244 Get/set the name of the element +1245 """ +1246 return self.get('name') +
1247 +1248 @name.setter +
1249 - def name(self, value): +
1250 self.set('name', value) +
1251 +1252 @name.deleter +
1253 - def name(self): +
1254 attrib = self.attrib +1255 if 'name' in attrib: +1256 del attrib['name'] +
1257 +
1258 - def __repr__(self): +
1259 type_name = getattr(self, 'type', None) +1260 if type_name: +1261 type_name = ' type=%r' % type_name +1262 else: +1263 type_name = '' +1264 return '<%s %x name=%r%s>' % ( +1265 self.__class__.__name__, id(self), self.name, type_name) +
1266 +
1267 +1268 -class TextareaElement(InputMixin, HtmlElement): +
1269 """ +1270 ``<textarea>`` element. You can get the name with ``.name`` and +1271 get/set the value with ``.value`` +1272 """ +1273 @property +
1274 - def value(self): +
1275 """ +1276 Get/set the value (which is the contents of this element) +1277 """ +1278 content = self.text or '' +1279 if self.tag.startswith("{%s}" % XHTML_NAMESPACE): +1280 serialisation_method = 'xml' +1281 else: +1282 serialisation_method = 'html' +1283 for el in self: +1284 # it's rare that we actually get here, so let's not use ''.join() +1285 content += etree.tostring( +1286 el, method=serialisation_method, encoding='unicode') +1287 return content +
1288 +1289 @value.setter +
1290 - def value(self, value): +
1291 del self[:] +1292 self.text = value +
1293 +1294 @value.deleter +
1295 - def value(self): +
1296 self.text = '' +1297 del self[:] +
1298 +1299 +1300 HtmlElementClassLookup._default_element_classes['textarea'] = TextareaElement +
1301 +1302 +1303 -class SelectElement(InputMixin, HtmlElement): +
1304 """ +1305 ``<select>`` element. You can get the name with ``.name``. +1306 +1307 ``.value`` will be the value of the selected option, unless this +1308 is a multi-select element (``<select multiple>``), in which case +1309 it will be a set-like object. In either case ``.value_options`` +1310 gives the possible values. +1311 +1312 The boolean attribute ``.multiple`` shows if this is a +1313 multi-select. +1314 """ +1315 @property +
1316 - def value(self): +
1317 """ +1318 Get/set the value of this select (the selected option). +1319 +1320 If this is a multi-select, this is a set-like object that +1321 represents all the selected options. +1322 """ +1323 if self.multiple: +1324 return MultipleSelectOptions(self) +1325 options = _options_xpath(self) +1326 +1327 try: +1328 selected_option = next(el for el in reversed(options) if el.get('selected') is not None) +1329 except StopIteration: +1330 try: +1331 selected_option = next(el for el in options if el.get('disabled') is None) +1332 except StopIteration: +1333 return None +1334 value = selected_option.get('value') +1335 if value is None: +1336 value = (selected_option.text or '').strip() +1337 return value +
1338 +1339 @value.setter +
1340 - def value(self, value): +
1341 if self.multiple: +1342 if isinstance(value, basestring): +1343 raise TypeError("You must pass in a sequence") +1344 values = self.value +1345 values.clear() +1346 values.update(value) +1347 return +1348 checked_option = None +1349 if value is not None: +1350 for el in _options_xpath(self): +1351 opt_value = el.get('value') +1352 if opt_value is None: +1353 opt_value = (el.text or '').strip() +1354 if opt_value == value: +1355 checked_option = el +1356 break +1357 else: +1358 raise ValueError( +1359 "There is no option with the value of %r" % value) +1360 for el in _options_xpath(self): +1361 if 'selected' in el.attrib: +1362 del el.attrib['selected'] +1363 if checked_option is not None: +1364 checked_option.set('selected', '') +
1365 +1366 @value.deleter +
1367 - def value(self): +
1368 # FIXME: should del be allowed at all? +1369 if self.multiple: +1370 self.value.clear() +1371 else: +1372 self.value = None +
1373 +1374 @property +
1375 - def value_options(self): +
1376 """ +1377 All the possible values this select can have (the ``value`` +1378 attribute of all the ``<option>`` elements. +1379 """ +1380 options = [] +1381 for el in _options_xpath(self): +1382 value = el.get('value') +1383 if value is None: +1384 value = (el.text or '').strip() +1385 options.append(value) +1386 return options +
1387 +1388 @property +
1389 - def multiple(self): +
1390 """ +1391 Boolean attribute: is there a ``multiple`` attribute on this element. +1392 """ +1393 return 'multiple' in self.attrib +
1394 +1395 @multiple.setter +
1396 - def multiple(self, value): +
1397 if value: +1398 self.set('multiple', '') +1399 elif 'multiple' in self.attrib: +1400 del self.attrib['multiple'] +
1401 +1402 +1403 HtmlElementClassLookup._default_element_classes['select'] = SelectElement +
1404 +1405 +1406 -class MultipleSelectOptions(SetMixin): +
1407 """ +1408 Represents all the selected options in a ``<select multiple>`` element. +1409 +1410 You can add to this set-like option to select an option, or remove +1411 to unselect the option. +1412 """ +1413 +
1414 - def __init__(self, select): +
1415 self.select = select +
1416 +1417 @property +
1418 - def options(self): +
1419 """ +1420 Iterator of all the ``<option>`` elements. +1421 """ +1422 return iter(_options_xpath(self.select)) +
1423 +
1424 - def __iter__(self): +
1425 for option in self.options: +1426 if 'selected' in option.attrib: +1427 opt_value = option.get('value') +1428 if opt_value is None: +1429 opt_value = (option.text or '').strip() +1430 yield opt_value +
1431 +
1432 - def add(self, item): +
1433 for option in self.options: +1434 opt_value = option.get('value') +1435 if opt_value is None: +1436 opt_value = (option.text or '').strip() +1437 if opt_value == item: +1438 option.set('selected', '') +1439 break +1440 else: +1441 raise ValueError( +1442 "There is no option with the value %r" % item) +
1443 +
1444 - def remove(self, item): +
1445 for option in self.options: +1446 opt_value = option.get('value') +1447 if opt_value is None: +1448 opt_value = (option.text or '').strip() +1449 if opt_value == item: +1450 if 'selected' in option.attrib: +1451 del option.attrib['selected'] +1452 else: +1453 raise ValueError( +1454 "The option %r is not currently selected" % item) +1455 break +1456 else: +1457 raise ValueError( +1458 "There is not option with the value %r" % item) +
1459 +
1460 - def __repr__(self): +
1461 return '<%s {%s} for select name=%r>' % ( +1462 self.__class__.__name__, +1463 ', '.join([repr(v) for v in self]), +1464 self.select.name) +
1465 +
1466 +1467 -class RadioGroup(list): +
1468 """ +1469 This object represents several ``<input type=radio>`` elements +1470 that have the same name. +1471 +1472 You can use this like a list, but also use the property +1473 ``.value`` to check/uncheck inputs. Also you can use +1474 ``.value_options`` to get the possible values. +1475 """ +1476 @property +
1477 - def value(self): +
1478 """ +1479 Get/set the value, which checks the radio with that value (and +1480 unchecks any other value). +1481 """ +1482 for el in self: +1483 if 'checked' in el.attrib: +1484 return el.get('value') +1485 return None +
1486 +1487 @value.setter +
1488 - def value(self, value): +
1489 checked_option = None +1490 if value is not None: +1491 for el in self: +1492 if el.get('value') == value: +1493 checked_option = el +1494 break +1495 else: +1496 raise ValueError("There is no radio input with the value %r" % value) +1497 for el in self: +1498 if 'checked' in el.attrib: +1499 del el.attrib['checked'] +1500 if checked_option is not None: +1501 checked_option.set('checked', '') +
1502 +1503 @value.deleter +
1504 - def value(self): +
1505 self.value = None +
1506 +1507 @property +
1508 - def value_options(self): +
1509 """ +1510 Returns a list of all the possible values. +1511 """ +1512 return [el.get('value') for el in self] +
1513 +
1514 - def __repr__(self): +
1515 return '%s(%s)' % ( +1516 self.__class__.__name__, +1517 list.__repr__(self)) +
1518 +
1519 +1520 -class CheckboxGroup(list): +
1521 """ +1522 Represents a group of checkboxes (``<input type=checkbox>``) that +1523 have the same name. +1524 +1525 In addition to using this like a list, the ``.value`` attribute +1526 returns a set-like object that you can add to or remove from to +1527 check and uncheck checkboxes. You can also use ``.value_options`` +1528 to get the possible values. +1529 """ +1530 @property +
1531 - def value(self): +
1532 """ +1533 Return a set-like object that can be modified to check or +1534 uncheck individual checkboxes according to their value. +1535 """ +1536 return CheckboxValues(self) +
1537 +1538 @value.setter +
1539 - def value(self, value): +
1540 values = self.value +1541 values.clear() +1542 if not hasattr(value, '__iter__'): +1543 raise ValueError( +1544 "A CheckboxGroup (name=%r) must be set to a sequence (not %r)" +1545 % (self[0].name, value)) +1546 values.update(value) +
1547 +1548 @value.deleter +
1549 - def value(self): +
1550 self.value.clear() +
1551 +1552 @property +
1553 - def value_options(self): +
1554 """ +1555 Returns a list of all the possible values. +1556 """ +1557 return [el.get('value') for el in self] +
1558 +
1559 - def __repr__(self): +
1560 return '%s(%s)' % ( +1561 self.__class__.__name__, list.__repr__(self)) +
1562 +
1563 +1564 -class CheckboxValues(SetMixin): +
1565 """ +1566 Represents the values of the checked checkboxes in a group of +1567 checkboxes with the same name. +1568 """ +1569 +
1570 - def __init__(self, group): +
1571 self.group = group +
1572 +
1573 - def __iter__(self): +
1574 return iter([ +1575 el.get('value') +1576 for el in self.group +1577 if 'checked' in el.attrib]) +
1578 +
1579 - def add(self, value): +
1580 for el in self.group: +1581 if el.get('value') == value: +1582 el.set('checked', '') +1583 break +1584 else: +1585 raise KeyError("No checkbox with value %r" % value) +
1586 +
1587 - def remove(self, value): +
1588 for el in self.group: +1589 if el.get('value') == value: +1590 if 'checked' in el.attrib: +1591 del el.attrib['checked'] +1592 else: +1593 raise KeyError( +1594 "The checkbox with value %r was already unchecked" % value) +1595 break +1596 else: +1597 raise KeyError( +1598 "No checkbox with value %r" % value) +
1599 +
1600 - def __repr__(self): +
1601 return '<%s {%s} for checkboxes name=%r>' % ( +1602 self.__class__.__name__, +1603 ', '.join([repr(v) for v in self]), +1604 self.group.name) +
1605 +
1606 +1607 -class InputElement(InputMixin, HtmlElement): +
1608 """ +1609 Represents an ``<input>`` element. +1610 +1611 You can get the type with ``.type`` (which is lower-cased and +1612 defaults to ``'text'``). +1613 +1614 Also you can get and set the value with ``.value`` +1615 +1616 Checkboxes and radios have the attribute ``input.checkable == +1617 True`` (for all others it is false) and a boolean attribute +1618 ``.checked``. +1619 +1620 """ +1621 +1622 ## FIXME: I'm a little uncomfortable with the use of .checked +1623 @property +
1624 - def value(self): +
1625 """ +1626 Get/set the value of this element, using the ``value`` attribute. +1627 +1628 Also, if this is a checkbox and it has no value, this defaults +1629 to ``'on'``. If it is a checkbox or radio that is not +1630 checked, this returns None. +1631 """ +1632 if self.checkable: +1633 if self.checked: +1634 return self.get('value') or 'on' +1635 else: +1636 return None +1637 return self.get('value') +
1638 +1639 @value.setter +
1640 - def value(self, value): +
1641 if self.checkable: +1642 if not value: +1643 self.checked = False +1644 else: +1645 self.checked = True +1646 if isinstance(value, basestring): +1647 self.set('value', value) +1648 else: +1649 self.set('value', value) +
1650 +1651 @value.deleter +
1652 - def value(self): +
1653 if self.checkable: +1654 self.checked = False +1655 else: +1656 if 'value' in self.attrib: +1657 del self.attrib['value'] +
1658 +1659 @property +
1660 - def type(self): +
1661 """ +1662 Return the type of this element (using the type attribute). +1663 """ +1664 return self.get('type', 'text').lower() +
1665 +1666 @type.setter +
1667 - def type(self, value): +
1668 self.set('type', value) +
1669 +1670 @property +
1671 - def checkable(self): +
1672 """ +1673 Boolean: can this element be checked? +1674 """ +1675 return self.type in ('checkbox', 'radio') +
1676 +1677 @property +
1678 - def checked(self): +
1679 """ +1680 Boolean attribute to get/set the presence of the ``checked`` +1681 attribute. +1682 +1683 You can only use this on checkable input types. +1684 """ +1685 if not self.checkable: +1686 raise AttributeError('Not a checkable input type') +1687 return 'checked' in self.attrib +
1688 +1689 @checked.setter +
1690 - def checked(self, value): +
1691 if not self.checkable: +1692 raise AttributeError('Not a checkable input type') +1693 if value: +1694 self.set('checked', '') +1695 else: +1696 attrib = self.attrib +1697 if 'checked' in attrib: +1698 del attrib['checked'] +
1699 +1700 +1701 HtmlElementClassLookup._default_element_classes['input'] = InputElement +
1702 +1703 +1704 -class LabelElement(HtmlElement): +
1705 """ +1706 Represents a ``<label>`` element. +1707 +1708 Label elements are linked to other elements with their ``for`` +1709 attribute. You can access this element with ``label.for_element``. +1710 """ +1711 @property +
1712 - def for_element(self): +
1713 """ +1714 Get/set the element this label points to. Return None if it +1715 can't be found. +1716 """ +1717 id = self.get('for') +1718 if not id: +1719 return None +1720 return self.body.get_element_by_id(id) +
1721 +1722 @for_element.setter +
1723 - def for_element(self, other): +
1724 id = other.get('id') +1725 if not id: +1726 raise TypeError( +1727 "Element %r has no id attribute" % other) +1728 self.set('for', id) +
1729 +1730 @for_element.deleter +
1731 - def for_element(self): +
1732 attrib = self.attrib +1733 if 'id' in attrib: +1734 del attrib['id'] +
1735 +1736 +1737 HtmlElementClassLookup._default_element_classes['label'] = LabelElement +
1738 +1739 +1740 ############################################################ +1741 ## Serialization +1742 ############################################################ +1743 +1744 -def html_to_xhtml(html): +
1745 """Convert all tags in an HTML tree to XHTML by moving them to the +1746 XHTML namespace. +1747 """ +1748 try: +1749 html = html.getroot() +1750 except AttributeError: +1751 pass +1752 prefix = "{%s}" % XHTML_NAMESPACE +1753 for el in html.iter(etree.Element): +1754 tag = el.tag +1755 if tag[0] != '{': +1756 el.tag = prefix + tag +
1757 +
1758 +1759 -def xhtml_to_html(xhtml): +
1760 """Convert all tags in an XHTML tree to HTML by removing their +1761 XHTML namespace. +1762 """ +1763 try: +1764 xhtml = xhtml.getroot() +1765 except AttributeError: +1766 pass +1767 prefix = "{%s}" % XHTML_NAMESPACE +1768 prefix_len = len(prefix) +1769 for el in xhtml.iter(prefix + "*"): +1770 el.tag = el.tag[prefix_len:] +
1771 +1772 +1773 # This isn't a general match, but it's a match for what libxml2 +1774 # specifically serialises: +1775 __str_replace_meta_content_type = re.compile( +1776 r'<meta http-equiv="Content-Type"[^>]*>').sub +1777 __bytes_replace_meta_content_type = re.compile( +1778 r'<meta http-equiv="Content-Type"[^>]*>'.encode('ASCII')).sub +
1779 +1780 +1781 -def tostring(doc, pretty_print=False, include_meta_content_type=False, +1782 encoding=None, method="html", with_tail=True, doctype=None): +
1783 """Return an HTML string representation of the document. +1784 +1785 Note: if include_meta_content_type is true this will create a +1786 ``<meta http-equiv="Content-Type" ...>`` tag in the head; +1787 regardless of the value of include_meta_content_type any existing +1788 ``<meta http-equiv="Content-Type" ...>`` tag will be removed +1789 +1790 The ``encoding`` argument controls the output encoding (defaults to +1791 ASCII, with &#...; character references for any characters outside +1792 of ASCII). Note that you can pass the name ``'unicode'`` as +1793 ``encoding`` argument to serialise to a Unicode string. +1794 +1795 The ``method`` argument defines the output method. It defaults to +1796 'html', but can also be 'xml' for xhtml output, or 'text' to +1797 serialise to plain text without markup. +1798 +1799 To leave out the tail text of the top-level element that is being +1800 serialised, pass ``with_tail=False``. +1801 +1802 The ``doctype`` option allows passing in a plain string that will +1803 be serialised before the XML tree. Note that passing in non +1804 well-formed content here will make the XML output non well-formed. +1805 Also, an existing doctype in the document tree will not be removed +1806 when serialising an ElementTree instance. +1807 +1808 Example:: +1809 +1810 >>> from lxml import html +1811 >>> root = html.fragment_fromstring('<p>Hello<br>world!</p>') +1812 +1813 >>> html.tostring(root) +1814 b'<p>Hello<br>world!</p>' +1815 >>> html.tostring(root, method='html') +1816 b'<p>Hello<br>world!</p>' +1817 +1818 >>> html.tostring(root, method='xml') +1819 b'<p>Hello<br/>world!</p>' +1820 +1821 >>> html.tostring(root, method='text') +1822 b'Helloworld!' +1823 +1824 >>> html.tostring(root, method='text', encoding='unicode') +1825 u'Helloworld!' +1826 +1827 >>> root = html.fragment_fromstring('<div><p>Hello<br>world!</p>TAIL</div>') +1828 >>> html.tostring(root[0], method='text', encoding='unicode') +1829 u'Helloworld!TAIL' +1830 +1831 >>> html.tostring(root[0], method='text', encoding='unicode', with_tail=False) +1832 u'Helloworld!' +1833 +1834 >>> doc = html.document_fromstring('<p>Hello<br>world!</p>') +1835 >>> html.tostring(doc, method='html', encoding='unicode') +1836 u'<html><body><p>Hello<br>world!</p></body></html>' +1837 +1838 >>> print(html.tostring(doc, method='html', encoding='unicode', +1839 ... doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"' +1840 ... ' "http://www.w3.org/TR/html4/strict.dtd">')) +1841 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +1842 <html><body><p>Hello<br>world!</p></body></html> +1843 """ +1844 html = etree.tostring(doc, method=method, pretty_print=pretty_print, +1845 encoding=encoding, with_tail=with_tail, +1846 doctype=doctype) +1847 if method == 'html' and not include_meta_content_type: +1848 if isinstance(html, str): +1849 html = __str_replace_meta_content_type('', html) +1850 else: +1851 html = __bytes_replace_meta_content_type(bytes(), html) +1852 return html +
1853 +1854 +1855 tostring.__doc__ = __fix_docstring(tostring.__doc__) +
1856 +1857 +1858 -def open_in_browser(doc, encoding=None): +
1859 """ +1860 Open the HTML document in a web browser, saving it to a temporary +1861 file to open it. Note that this does not delete the file after +1862 use. This is mainly meant for debugging. +1863 """ +1864 import os +1865 import webbrowser +1866 import tempfile +1867 if not isinstance(doc, etree._ElementTree): +1868 doc = etree.ElementTree(doc) +1869 handle, fn = tempfile.mkstemp(suffix='.html') +1870 f = os.fdopen(handle, 'wb') +1871 try: +1872 doc.write(f, method="html", encoding=encoding or doc.docinfo.encoding or "UTF-8") +1873 finally: +1874 # we leak the file itself here, but we should at least close it +1875 f.close() +1876 url = 'file://' + fn.replace(os.path.sep, '/') +1877 print(url) +1878 webbrowser.open(url) +
1879 +
1880 +1881 ################################################################################ +1882 # configure Element class lookup +1883 ################################################################################ +1884 +1885 -class HTMLParser(etree.HTMLParser): +
1886 """An HTML parser that is configured to return lxml.html Element +1887 objects. +1888 """ +
1889 - def __init__(self, **kwargs): +
1890 super(HTMLParser, self).__init__(**kwargs) +1891 self.set_element_class_lookup(HtmlElementClassLookup()) +
1892 +
1893 +1894 -class XHTMLParser(etree.XMLParser): +
1895 """An XML parser that is configured to return lxml.html Element +1896 objects. +1897 +1898 Note that this parser is not really XHTML aware unless you let it +1899 load a DTD that declares the HTML entities. To do this, make sure +1900 you have the XHTML DTDs installed in your catalogs, and create the +1901 parser like this:: +1902 +1903 >>> parser = XHTMLParser(load_dtd=True) +1904 +1905 If you additionally want to validate the document, use this:: +1906 +1907 >>> parser = XHTMLParser(dtd_validation=True) +1908 +1909 For catalog support, see http://www.xmlsoft.org/catalog.html. +1910 """ +
1911 - def __init__(self, **kwargs): +
1912 super(XHTMLParser, self).__init__(**kwargs) +1913 self.set_element_class_lookup(HtmlElementClassLookup()) +
1914 +
1915 +1916 -def Element(*args, **kw): +
1917 """Create a new HTML Element. +1918 +1919 This can also be used for XHTML documents. +1920 """ +1921 v = html_parser.makeelement(*args, **kw) +1922 return v +
1923 +1924 +1925 html_parser = HTMLParser() +1926 xhtml_parser = XHTMLParser() +1927 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9c2d19da --- /dev/null +++ b/doc/html/api/lxml.html.CheckboxGroup-class.html @@ -0,0 +1,385 @@ + + + + + lxml.html.CheckboxGroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + CheckboxGroup :: + 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]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from list: + __add__, + __contains__, + __delitem__, + __delslice__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getslice__, + __gt__, + __iadd__, + __imul__, + __init__, + __iter__, + __le__, + __len__, + __lt__, + __mul__, + __ne__, + __new__, + __reversed__, + __rmul__, + __setitem__, + __setslice__, + __sizeof__, + append, + count, + extend, + index, + insert, + pop, + remove, + reverse, + sort +

+

Inherited from object: + __delattr__, + __format__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__, + __subclasshook__ +

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

Inherited from list: + __hash__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their 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

+ Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value. +
+
Get Method:
+
unreachable.value(self) + - Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value. +
+
Set Method:
+
unreachable.value(self, + value) +
+
Delete Method:
+
unreachable.value(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.CheckboxValues-class.html b/doc/html/api/lxml.html.CheckboxValues-class.html new file mode 100644 index 00000000..cef1a5e2 --- /dev/null +++ b/doc/html/api/lxml.html.CheckboxValues-class.html @@ -0,0 +1,563 @@ + + + + + lxml.html.CheckboxValues + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + CheckboxValues :: + Class CheckboxValues + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CheckboxValues

source code

+
+       object --+                
+                |                
+    _abcoll.Sized --+            
+                    |            
+       object --+   |            
+                |   |            
+ _abcoll.Iterable --+            
+                    |            
+       object --+   |            
+                |   |            
+_abcoll.Container --+            
+                    |            
+          _abcoll.Set --+        
+                        |        
+       _abcoll.MutableSet --+    
+                            |    
+           _setmixin.SetMixin --+
+                                |
+                               CheckboxValues
+
+ +
+Represents the values of the checked checkboxes in a group of +checkboxes with the same name. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from _abcoll.Sized: + __metaclass__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + group)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
add(self, + value)
+ Add an element.
+ source code + +
+ +
+   + + + + + + +
remove(self, + value)
+ Remove an element. If not a member, raise a KeyError.
+ source code + +
+ +
+

Inherited from _setmixin.SetMixin: + __contains__, + __len__, + copy, + difference, + difference_update, + discard, + intersection, + intersection_update, + issubset, + issuperset, + symmetric_difference, + symmetric_difference_update, + union, + update +

+

Inherited from _abcoll.MutableSet: + __iand__, + __ior__, + __isub__, + __ixor__, + clear, + pop +

+

Inherited from _abcoll.Set: + __and__, + __eq__, + __ge__, + __gt__, + __le__, + __lt__, + __ne__, + __or__, + __rand__, + __ror__, + __rsub__, + __rxor__, + __sub__, + __xor__, + isdisjoint +

+

Inherited from _abcoll.Set (private): + _hash +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from _setmixin.SetMixin (private): + _from_iterable +

+

Inherited from _abcoll.Sized: + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __abstractmethods__ = frozenset([]) +
+

Inherited from _setmixin.SetMixin (private): + _abc_negative_cache, + _abc_negative_cache_version, + _abc_registry +

+

Inherited from _abcoll.Set: + __hash__ +

+

Inherited from _abcoll.Sized (private): + _abc_cache +

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

Inherited from object: + __class__ +

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

__init__(self, + group) +
(Constructor) +

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

__iter__(self) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Iterable.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

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

add(self, + value) +

+
source code  +
+ + Add an element. +
+
Overrides: + _abcoll.MutableSet.add +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

remove(self, + value) +

+
source code  +
+ + Remove an element. If not a member, raise a KeyError. +
+
Overrides: + _abcoll.MutableSet.remove +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.Classes-class.html b/doc/html/api/lxml.html.Classes-class.html new file mode 100644 index 00000000..21a49564 --- /dev/null +++ b/doc/html/api/lxml.html.Classes-class.html @@ -0,0 +1,715 @@ + + + + + lxml.html.Classes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + Classes :: + Class Classes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Classes

source code

+
+       object --+            
+                |            
+    _abcoll.Sized --+        
+                    |        
+       object --+   |        
+                |   |        
+ _abcoll.Iterable --+        
+                    |        
+       object --+   |        
+                |   |        
+_abcoll.Container --+        
+                    |        
+          _abcoll.Set --+    
+                        |    
+       _abcoll.MutableSet --+
+                            |
+                           Classes
+
+ +
+

Provides access to an element's class attribute as a set-like collection. +Usage:

+
+>>> el = fromstring('<p class="hidden large">Text</p>')
+>>> classes = el.classes  # or: classes = Classes(el.attrib)
+>>> classes |= ['block', 'paragraph']
+>>> el.get('class')
+'hidden large block paragraph'
+>>> classes.toggle('hidden')
+False
+>>> el.get('class')
+'large block paragraph'
+>>> classes -= ('some', 'classes', 'block')
+>>> el.get('class')
+'large paragraph'
+
+ + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from _abcoll.Sized: + __metaclass__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(self, + name) + source code + +
+ +
+   + + + + + + +
__init__(self, + attributes)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
__len__(self) + source code + +
+ +
+   + + + + + + +
add(self, + value)
+ Add a class.
+ source code + +
+ +
+   + + + + + + +
discard(self, + value)
+ Remove a class if it is currently present.
+ source code + +
+ +
+   + + + + + + +
remove(self, + value)
+ Remove a class; it must currently be present.
+ source code + +
+ +
+   + + + + + + +
toggle(self, + value)
+ Add a class name if it isn't there yet, or remove it if it exists.
+ source code + +
+ +
+   + + + + + + +
update(self, + values)
+ Add all names from 'values'.
+ source code + +
+ +
+

Inherited from _abcoll.MutableSet: + __iand__, + __ior__, + __isub__, + __ixor__, + clear, + pop +

+

Inherited from _abcoll.Set: + __and__, + __eq__, + __ge__, + __gt__, + __le__, + __lt__, + __ne__, + __or__, + __rand__, + __ror__, + __rsub__, + __rxor__, + __sub__, + __xor__, + isdisjoint +

+

Inherited from _abcoll.Set (private): + _hash +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from _abcoll.Set (private): + _from_iterable +

+

Inherited from _abcoll.Sized: + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __abstractmethods__ = frozenset([]) +
+   + + _abc_negative_cache = 'WeakSet' +
+   + + _abc_negative_cache_version = 21 +
+   + + _abc_registry = 'WeakSet' +
+

Inherited from _abcoll.Set: + __hash__ +

+

Inherited from _abcoll.Sized (private): + _abc_cache +

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

Inherited from object: + __class__ +

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

__contains__(self, + name) +
(In operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Container.__contains__ +
+
+
+
+ +
+ +
+ + +
+

__init__(self, + attributes) +
(Constructor) +

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

__iter__(self) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Iterable.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__len__(self) +
(Length operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Sized.__len__ +
+
+
+
+ +
+ +
+ + +
+

add(self, + value) +

+
source code  +
+ +

Add a class.

+

This has no effect if the class is already present.

+
+
Overrides: + _abcoll.MutableSet.add +
+
+
+
+ +
+ +
+ + +
+

discard(self, + value) +

+
source code  +
+ +

Remove a class if it is currently present.

+

If the class is not present, do nothing.

+
+
Overrides: + _abcoll.MutableSet.discard +
+
+
+
+ +
+ +
+ + +
+

remove(self, + value) +

+
source code  +
+ +

Remove a class; it must currently be present.

+

If the class is not present, raise a KeyError.

+
+
Overrides: + _abcoll.MutableSet.remove +
+
+
+
+ +
+ +
+ + +
+

toggle(self, + value) +

+
source code  +
+ +

Add a class name if it isn't there yet, or remove it if it exists.

+

Returns true if the class was added (and is now enabled) and +false if it was removed (and is now disabled).

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..c1d1def4 --- /dev/null +++ b/doc/html/api/lxml.html.ElementSoup-module.html @@ -0,0 +1,286 @@ + + + + + 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... +
+   + + __package__ = 'lxml.html' +
+ + + + + + +
+ + + + + +
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 00000000..9d2e8950 --- /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 00000000..184bcb3b --- /dev/null +++ b/doc/html/api/lxml.html.FieldsDict-class.html @@ -0,0 +1,705 @@ + + + + + lxml.html.FieldsDict + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + FieldsDict :: + Class FieldsDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FieldsDict

source code

+
+       object --+            
+                |            
+    _abcoll.Sized --+        
+                    |        
+       object --+   |        
+                |   |        
+ _abcoll.Iterable --+        
+                    |        
+       object --+   |        
+                |   |        
+_abcoll.Container --+        
+                    |        
+      _abcoll.Mapping --+    
+                        |    
+   _abcoll.MutableMapping --+
+                            |
+                           FieldsDict
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from _abcoll.Sized: + __metaclass__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(self, + item) + source code + +
+ +
+   + + + + + + +
__delitem__(self, + item) + source code + +
+ +
+   + + + + + + +
__getitem__(self, + item) + source code + +
+ +
+   + + + + + + +
__init__(self, + inputs)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
__len__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
__setitem__(self, + item, + value) + source code + +
+ +
+ list of D's keys + + + + + + +
keys(self) + source code + +
+ +
+

Inherited from _abcoll.MutableMapping: + clear, + pop, + popitem, + setdefault, + update +

+

Inherited from _abcoll.Mapping: + __eq__, + __ne__, + get, + items, + iteritems, + iterkeys, + itervalues, + values +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from _abcoll.Sized: + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __abstractmethods__ = frozenset([]) +
+   + + _abc_negative_cache = 'WeakSet' +
+   + + _abc_negative_cache_version = 21 +
+   + + _abc_registry = 'WeakSet' +
+

Inherited from _abcoll.Mapping: + __hash__ +

+

Inherited from _abcoll.Sized (private): + _abc_cache +

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

Inherited from object: + __class__ +

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

__contains__(self, + item) +
(In operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Container.__contains__ +
+
+
+
+ +
+ +
+ + +
+

__delitem__(self, + item) +
(Index deletion operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.MutableMapping.__delitem__ +
+
+
+
+ +
+ +
+ + +
+

__getitem__(self, + item) +
(Indexing operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Mapping.__getitem__ +
+
+
+
+ +
+ +
+ + +
+

__init__(self, + inputs) +
(Constructor) +

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

__iter__(self) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Iterable.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__len__(self) +
(Length operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Sized.__len__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

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

__setitem__(self, + item, + value) +
(Index assignment operator) +

+
source code  +
+ + +
+
Overrides: + _abcoll.MutableMapping.__setitem__ +
+
+
+
+ +
+ +
+ + +
+

keys(self) +

+
source code  +
+ + +
+
Returns: list of D's keys
+
Overrides: + _abcoll.Mapping.keys +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..5141028c --- /dev/null +++ b/doc/html/api/lxml.html.FormElement-class.html @@ -0,0 +1,450 @@ + + + + + lxml.html.FormElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + FormElement :: + 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]
+
+   + + + + + + +
_name(self) + source code + +
+ +
+   + + + + + + +
form_values(self)
+ Return a list of tuples of the field values for the form. +This is suitable to be passed to urllib.urlencode().
+ source code + +
+ +
+

Inherited from HtmlElement: + cssselect, + set +

+

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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + action
+ Get/set the form's action attribute. +
+   + + fields
+ Dictionary-like object that represents all the fields in this +form. You can set values in this dictionary to effect the +form. +
+   + + inputs
+ Returns an accessor for all the input elements in the form. +
+   + + method
+ Get/set the form's method. Always returns a capitalized +string, and defaults to 'GET' +
+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

action

+ Get/set the form's action attribute. +
+
Get Method:
+
unreachable.action(self) + - Get/set the form's action attribute. +
+
Set Method:
+
unreachable.action(self, + value) +
+
Delete Method:
+
unreachable.action(self) +
+
+
+
+ +
+ +
+

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:
+
unreachable.fields(self) + - Dictionary-like object that represents all the fields in this +form. You can set values in this dictionary to effect the +form. +
+
Set Method:
+
unreachable.fields(self, + value) +
+
+
+
+ +
+ +
+

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. +
+
+
+
+ +
+ +
+

method

+ Get/set the form's method. Always returns a capitalized +string, and defaults to 'GET' +
+
Get Method:
+
unreachable.method(self) + - Get/set the form's method. Always returns a capitalized +string, and defaults to 'GET' +
+
Set Method:
+
unreachable.method(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 00000000..0cc49793 --- /dev/null +++ b/doc/html/api/lxml.html.HTMLParser-class.html @@ -0,0 +1,277 @@ + + + + + lxml.html.HTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HTMLParser :: + Class HTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTMLParser

source code

+
+    object --+            
+             |            
+??._BaseParser --+        
+                 |        
+ etree._FeedParser --+    
+                     |    
+      etree.HTMLParser --+
+                         |
+                        HTMLParser
+
+ +
+An HTML parser that is configured to return lxml.html Element +objects. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kwargs)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+

Inherited from etree.HTMLParser: + __new__ +

+

Inherited from etree._FeedParser: + close, + feed +

+

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

+

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

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

Inherited from etree._FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + version +

+

Inherited from object: + __class__ +

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

__init__(self, + **kwargs) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..dca4c51f --- /dev/null +++ b/doc/html/api/lxml.html.HtmlComment-class.html @@ -0,0 +1,286 @@ + + + + + lxml.html.HtmlComment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlComment :: + Class HtmlComment + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlComment

source code

+
+         object --+                
+                  |                
+     etree._Element --+            
+                      |            
+??.__ContentOnlyElement --+        
+                          |        
+             etree._Comment --+    
+                              |    
+              etree.CommentBase --+
+                                  |
+                     object --+   |
+                              |   |
+                      HtmlMixin --+
+                                  |
+                                 HtmlComment
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.CommentBase: + __init__, + __new__ +

+

Inherited from etree._Comment: + __repr__ +

+

Inherited from unreachable.__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, + cssselect, + 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: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from etree._Comment: + tag +

+

Inherited from unreachable.__ContentOnlyElement: + attrib, + text +

+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + 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 00000000..20957cfb --- /dev/null +++ b/doc/html/api/lxml.html.HtmlElement-class.html @@ -0,0 +1,392 @@ + + + + + lxml.html.HtmlElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlElement :: + 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]
+
+   + + + + + + +
cssselect(self, + expr, + translator='html')
+ Run the CSS expression on this element and its children, +returning a list of the results.
+ source code + +
+ +
+   + + + + + + +
set(self, + key, + value=None)
+ Sets an element attribute. If no value is provided, or if the value is None, +creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" +for form.set('novalidate').
+ 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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + forms, + head, + label +

+

Inherited from object: + __class__ +

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

cssselect(self, + expr, + translator='html') +

+
source code  +
+ +

Run the CSS expression on this element and its children, +returning a list of the results.

+

Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self) +-- note that pre-compiling the expression can provide a substantial +speedup.

+
+
Overrides: + HtmlMixin.cssselect +
+
+
+
+ +
+ +
+ + +
+

set(self, + key, + value=None) +

+
source code  +
+ + Sets an element attribute. If no value is provided, or if the value is None, +creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" +for form.set('novalidate'). +
+
Overrides: + HtmlMixin.set +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..ed1d81f3 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlElementClassLookup-class.html @@ -0,0 +1,387 @@ + + + + + lxml.html.HtmlElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlElementClassLookup :: + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..c76ab64c --- /dev/null +++ b/doc/html/api/lxml.html.HtmlEntity-class.html @@ -0,0 +1,287 @@ + + + + + lxml.html.HtmlEntity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlEntity :: + Class HtmlEntity + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlEntity

source code

+
+         object --+                
+                  |                
+     etree._Element --+            
+                      |            
+??.__ContentOnlyElement --+        
+                          |        
+              etree._Entity --+    
+                              |    
+               etree.EntityBase --+
+                                  |
+                     object --+   |
+                              |   |
+                      HtmlMixin --+
+                                  |
+                                 HtmlEntity
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.EntityBase: + __init__, + __new__ +

+

Inherited from etree._Entity: + __repr__ +

+

Inherited from unreachable.__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, + cssselect, + 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: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from etree._Entity: + name, + tag, + text +

+

Inherited from unreachable.__ContentOnlyElement: + attrib +

+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + 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 00000000..31f2a3b6 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlMixin-class.html @@ -0,0 +1,821 @@ + + + + + lxml.html.HtmlMixin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlMixin :: + Class HtmlMixin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlMixin

source code

+
+object --+
+         |
+        HtmlMixin
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
cssselect(self, + expr, + translator='html')
+ Run the CSS expression on this element and its children, +returning a list of the results.
+ source code + +
+ +
+   + + + + + + +
drop_tag(self)
+ Remove the tag, but not its children or text. The children and text +are merged into the parent.
+ source code + +
+ +
+   + + + + + + +
drop_tree(self)
+ Removes this element from the tree, including its children and +text. The tail text is joined to the previous element or +parent.
+ source code + +
+ +
+   + + + + + + +
find_class(self, + class_name)
+ Find any elements with the given class name.
+ source code + +
+ +
+   + + + + + + +
find_rel_links(self, + rel)
+ Find any links like <a rel="{rel}">...</a>; returns a list of elements.
+ source code + +
+ +
+   + + + + + + +
get_element_by_id(self, + id, + *default)
+ 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.
+ source code + +
+ +
+   + + + + + + +
iterlinks(self)
+ 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.
+ source code + +
+ +
+   + + + + + + +
make_links_absolute(self, + base_url=None, + resolve_base_href=True, + handle_failures=None)
+ 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, + handle_failures=None)
+ 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.
+ source code + +
+ +
+   + + + + + + +
rewrite_links(self, + link_repl_func, + resolve_base_href=True, + base_href=None)
+ 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.
+ source code + +
+ +
+   + + + + + + +
set(self, + key, + value=None)
+ Sets an element attribute. If no value is provided, or if the value is None, +creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" +for form.set('novalidate').
+ source code + +
+ +
+   + + + + + + +
text_content(self)
+ Return the text content of the tag (and the text in any children).
+ source code + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + base_url
+ Returns the base URL, given when the page was parsed. +
+   + + body
+ Return the <body> element. Can be called from a child element +to get the document's head. +
+   + + classes
+ A set-like wrapper around the 'class' attribute. +
+   + + forms
+ Return a list of all the forms +
+   + + head
+ Returns the <head> element. Can be called from a child +element to get the document's head. +
+   + + label
+ Get or set any <label> element associated with this element. +
+

Inherited from object: + __class__ +

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

cssselect(self, + expr, + translator='html') +

+
source code  +
+ +

Run the CSS expression on this element and its children, +returning a list of the results.

+

Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self) +-- note that pre-compiling the expression can provide a substantial +speedup.

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

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.

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

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.

+

Note: multiple links inside of a single text string or +attribute value are returned in reversed order. This makes it +possible to replace or delete them from the text string value +based on their reported text positions. Otherwise, a +modification at one text position can change the positions of +links reported later on.

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

make_links_absolute(self, + base_url=None, + resolve_base_href=True, + handle_failures=None) +

+
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.

+

If handle_failures is None (default), a failure to process +a URL will abort the processing. If set to 'ignore', errors +are ignored. If set to 'discard', failing URLs will be removed.

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

resolve_base_href(self, + handle_failures=None) +

+
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.

+

If handle_failures is None (default), a failure to process +a URL will abort the processing. If set to 'ignore', errors +are ignored. If set to 'discard', failing URLs will be removed.

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

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. +
+
+
+
+ +
+ +
+

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. Can be called from a child element +to get the document's head. +
+
+
+
+ +
+ +
+

classes

+ A set-like wrapper around the 'class' attribute. +
+
Get Method:
+
unreachable.classes(self) + - A set-like wrapper around the 'class' attribute. +
+
Set Method:
+
unreachable.classes(self, + classes) +
+
+
+
+ +
+ +
+

forms

+ Return a list of all the forms +
+
Get Method:
+
unreachable.forms(self) + - Return a list of all the forms +
+
+
+
+ +
+ +
+

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. Can be called from a child +element to get the document's head. +
+
+
+
+ +
+ +
+

label

+ Get or set any <label> element associated with this element. +
+
Get Method:
+
unreachable.label(self) + - Get or set any <label> element associated with this element. +
+
Set Method:
+
unreachable.label(self, + label) +
+
Delete Method:
+
unreachable.label(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 00000000..260265ff --- /dev/null +++ b/doc/html/api/lxml.html.HtmlProcessingInstruction-class.html @@ -0,0 +1,287 @@ + + + + + lxml.html.HtmlProcessingInstruction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + HtmlProcessingInstruction :: + Class HtmlProcessingInstruction + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlProcessingInstruction

source code

+
+          object --+                
+                   |                
+      etree._Element --+            
+                       |            
+ ??.__ContentOnlyElement --+        
+                           |        
+etree._ProcessingInstruction --+    
+                               |    
+                    etree.PIBase --+
+                                   |
+                      object --+   |
+                               |   |
+                       HtmlMixin --+
+                                   |
+                                  HtmlProcessingInstruction
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.PIBase: + __init__, + __new__ +

+

Inherited from etree._ProcessingInstruction: + __repr__, + get +

+

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

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + cssselect, + 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: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from etree._ProcessingInstruction: + attrib, + tag, + target +

+

Inherited from unreachable.__ContentOnlyElement: + text +

+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + 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 00000000..4fbee661 --- /dev/null +++ b/doc/html/api/lxml.html.InputElement-class.html @@ -0,0 +1,428 @@ + + + + + lxml.html.InputElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + InputElement :: + 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]
+
+

Inherited from InputMixin: + __repr__ +

+

Inherited from HtmlElement: + cssselect, + 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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + checkable
+ Boolean: can this element be checked? +
+   + + checked
+ Boolean attribute to get/set the presence of the checked +attribute. +
+   + + type
+ Return the type of this element (using the type attribute). +
+   + + value
+ Get/set the value of this element, using the value attribute. +
+

Inherited from InputMixin: + name +

+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

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:
+
unreachable.checked(self) + - Boolean attribute to get/set the presence of the checked +attribute. +
+
Set Method:
+
unreachable.checked(self, + value) +
+
+
+
+ +
+ +
+

type

+ Return the type of this element (using the type attribute). +
+
Get Method:
+
unreachable.type(self) + - Return the type of this element (using the type attribute). +
+
Set Method:
+
unreachable.type(self, + value) +
+
+
+
+ +
+ +
+

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:
+
unreachable.value(self) + - Get/set the value of this element, using the value attribute. +
+
Set Method:
+
unreachable.value(self, + value) +
+
Delete Method:
+
unreachable.value(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9fe541eb --- /dev/null +++ b/doc/html/api/lxml.html.InputGetter-class.html @@ -0,0 +1,454 @@ + + + + + lxml.html.InputGetter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + InputGetter :: + 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]
+
+   + + + + + + +
__contains__(self, + name) + source code + +
+ +
+   + + + + + + +
__getitem__(self, + name) + source code + +
+ +
+   + + + + + + +
__init__(self, + form)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
keys(self) + source code + +
+ +
+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _all_xpath = .//*[local-name() = 'select' or local-name() = 'i... +
+   + + _name_xpath = .//*[@name = $name and (local-name(.) = 'select'... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

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

__init__(self, + form) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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]
+
+ +
+ +
+

_all_xpath

+ +
+
+
+
Value:
+
+.//*[local-name() = 'select' or local-name() = 'input' or local-name()\
+ = 'textarea']
+
+
+
+
+
+ +
+ +
+

_name_xpath

+ +
+
+
+
Value:
+
+.//*[@name = $name and (local-name(.) = 'select' or local-name(.) = 'i\
+nput' 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 00000000..baf05569 --- /dev/null +++ b/doc/html/api/lxml.html.InputMixin-class.html @@ -0,0 +1,302 @@ + + + + + lxml.html.InputMixin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + InputMixin :: + 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]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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:
+
unreachable.name(self) + - Get/set the name of the element +
+
Set Method:
+
unreachable.name(self, + value) +
+
Delete Method:
+
unreachable.name(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 00000000..55bd27ad --- /dev/null +++ b/doc/html/api/lxml.html.LabelElement-class.html @@ -0,0 +1,334 @@ + + + + + lxml.html.LabelElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + LabelElement :: + 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]
+
+

Inherited from HtmlElement: + cssselect, + set +

+

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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + for_element
+ Get/set the element this label points to. Return None if it +can't be found. +
+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

for_element

+ Get/set the element this label points to. Return None if it +can't be found. +
+
Get Method:
+
unreachable.for_element(self) + - Get/set the element this label points to. Return None if it +can't be found. +
+
Set Method:
+
unreachable.for_element(self, + other) +
+
Delete Method:
+
unreachable.for_element(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 00000000..2510136d --- /dev/null +++ b/doc/html/api/lxml.html.MultipleSelectOptions-class.html @@ -0,0 +1,606 @@ + + + + + lxml.html.MultipleSelectOptions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + MultipleSelectOptions :: + Class MultipleSelectOptions + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class MultipleSelectOptions

source code

+
+       object --+                
+                |                
+    _abcoll.Sized --+            
+                    |            
+       object --+   |            
+                |   |            
+ _abcoll.Iterable --+            
+                    |            
+       object --+   |            
+                |   |            
+_abcoll.Container --+            
+                    |            
+          _abcoll.Set --+        
+                        |        
+       _abcoll.MutableSet --+    
+                            |    
+           _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.

+ + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from _abcoll.Sized: + __metaclass__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + select)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
add(self, + item)
+ Add an element.
+ source code + +
+ +
+   + + + + + + +
remove(self, + item)
+ Remove an element. If not a member, raise a KeyError.
+ source code + +
+ +
+

Inherited from _setmixin.SetMixin: + __contains__, + __len__, + copy, + difference, + difference_update, + discard, + intersection, + intersection_update, + issubset, + issuperset, + symmetric_difference, + symmetric_difference_update, + union, + update +

+

Inherited from _abcoll.MutableSet: + __iand__, + __ior__, + __isub__, + __ixor__, + clear, + pop +

+

Inherited from _abcoll.Set: + __and__, + __eq__, + __ge__, + __gt__, + __le__, + __lt__, + __ne__, + __or__, + __rand__, + __ror__, + __rsub__, + __rxor__, + __sub__, + __xor__, + isdisjoint +

+

Inherited from _abcoll.Set (private): + _hash +

+

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

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from _setmixin.SetMixin (private): + _from_iterable +

+

Inherited from _abcoll.Sized: + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __abstractmethods__ = frozenset([]) +
+

Inherited from _setmixin.SetMixin (private): + _abc_negative_cache, + _abc_negative_cache_version, + _abc_registry +

+

Inherited from _abcoll.Set: + __hash__ +

+

Inherited from _abcoll.Sized (private): + _abc_cache +

+
+ + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__iter__(self) +

+
source code  +
+ + +
+
Overrides: + _abcoll.Iterable.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

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

add(self, + item) +

+
source code  +
+ + Add an element. +
+
Overrides: + _abcoll.MutableSet.add +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

remove(self, + item) +

+
source code  +
+ + Remove an element. If not a member, raise a KeyError. +
+
Overrides: + _abcoll.MutableSet.remove +
(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 00000000..0f356749 --- /dev/null +++ b/doc/html/api/lxml.html.RadioGroup-class.html @@ -0,0 +1,384 @@ + + + + + lxml.html.RadioGroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + RadioGroup :: + 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]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from list: + __add__, + __contains__, + __delitem__, + __delslice__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getslice__, + __gt__, + __iadd__, + __imul__, + __init__, + __iter__, + __le__, + __len__, + __lt__, + __mul__, + __ne__, + __new__, + __reversed__, + __rmul__, + __setitem__, + __setslice__, + __sizeof__, + append, + count, + extend, + index, + insert, + pop, + remove, + reverse, + sort +

+

Inherited from object: + __delattr__, + __format__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__, + __subclasshook__ +

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

Inherited from list: + __hash__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
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:
+
unreachable.value(self) + - Get/set the value, which checks the radio with that value (and +unchecks any other value). +
+
Set Method:
+
unreachable.value(self, + value) +
+
Delete Method:
+
unreachable.value(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 00000000..129a8265 --- /dev/null +++ b/doc/html/api/lxml.html.SelectElement-class.html @@ -0,0 +1,399 @@ + + + + + lxml.html.SelectElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + SelectElement :: + 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]
+
+

Inherited from InputMixin: + __repr__ +

+

Inherited from HtmlElement: + cssselect, + 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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + multiple
+ Boolean attribute: is there a multiple attribute on this element. +
+   + + 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. +
+

Inherited from InputMixin: + name +

+

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

+

Inherited from HtmlMixin: + base_url, + body, + classes, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

multiple

+ Boolean attribute: is there a multiple attribute on this element. +
+
Get Method:
+
unreachable.multiple(self) + - Boolean attribute: is there a multiple attribute on this element. +
+
Set Method:
+
unreachable.multiple(self, + value) +
+
+
+
+ +
+ +
+

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:
+
unreachable.value(self) + - Get/set the value of this select (the selected option). +
+
Set Method:
+
unreachable.value(self, + value) +
+
Delete Method:
+
unreachable.value(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. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..fbb51a0d --- /dev/null +++ b/doc/html/api/lxml.html.TextareaElement-class.html @@ -0,0 +1,339 @@ + + + + + lxml.html.TextareaElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + TextareaElement :: + 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]
+
+

Inherited from InputMixin: + __repr__ +

+

Inherited from HtmlElement: + cssselect, + 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, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + 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 object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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, + classes, + 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:
+
unreachable.value(self) + - Get/set the value (which is the contents of this element) +
+
Set Method:
+
unreachable.value(self, + value) +
+
Delete Method:
+
unreachable.value(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 00000000..3ad40c9a --- /dev/null +++ b/doc/html/api/lxml.html.XHTMLParser-class.html @@ -0,0 +1,289 @@ + + + + + lxml.html.XHTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + XHTMLParser :: + Class XHTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XHTMLParser

source code

+
+    object --+            
+             |            
+??._BaseParser --+        
+                 |        
+ etree._FeedParser --+    
+                     |    
+       etree.XMLParser --+
+                         |
+                        XHTMLParser
+
+ +
+

An XML parser that is configured to return lxml.html Element +objects.

+

Note that this parser is not really XHTML aware unless you let it +load a DTD that declares the HTML entities. To do this, make sure +you have the XHTML DTDs installed in your catalogs, and create the +parser like this:

+
+>>> parser = XHTMLParser(load_dtd=True)
+
+

If you additionally want to validate the document, use this:

+
+>>> parser = XHTMLParser(dtd_validation=True)
+
+

For catalog support, see http://www.xmlsoft.org/catalog.html.

+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kwargs)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+

Inherited from etree.XMLParser: + __new__ +

+

Inherited from etree._FeedParser: + close, + feed +

+

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

+

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

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

Inherited from etree._FeedParser: + feed_error_log +

+

Inherited from unreachable._BaseParser: + error_log, + resolvers, + target, + version +

+

Inherited from object: + __class__ +

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

__init__(self, + **kwargs) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..fa7c1176 --- /dev/null +++ b/doc/html/api/lxml.html._MethodFunc-class.html @@ -0,0 +1,276 @@ + + + + + lxml.html._MethodFunc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + lxml :: + html :: + _MethodFunc :: + 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]
+
+   + + + + + + +
__call__(self, + doc, + *args, + **kw) + source code + +
+ +
+   + + + + + + +
__init__(self, + name, + copy=False, + source_class=<class 'lxml.html.HtmlMixin'>)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..8ec0be90 --- /dev/null +++ b/doc/html/api/lxml.html.builder-module.html @@ -0,0 +1,858 @@ + + + + + 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 = <lxml.builder.ElementMaker object> +
+   + + A = <functools.partial object> +
+   + + ABBR = <functools.partial object> +
+   + + ACRONYM = <functools.partial object> +
+   + + ADDRESS = <functools.partial object> +
+   + + APPLET = <functools.partial object> +
+   + + AREA = <functools.partial object> +
+   + + B = <functools.partial object> +
+   + + BASE = <functools.partial object> +
+   + + BASEFONT = <functools.partial object> +
+   + + BDO = <functools.partial object> +
+   + + BIG = <functools.partial object> +
+   + + BLOCKQUOTE = <functools.partial object> +
+   + + BODY = <functools.partial object> +
+   + + BR = <functools.partial object> +
+   + + BUTTON = <functools.partial object> +
+   + + CAPTION = <functools.partial object> +
+   + + CENTER = <functools.partial object> +
+   + + CITE = <functools.partial object> +
+   + + CODE = <functools.partial object> +
+   + + COL = <functools.partial object> +
+   + + COLGROUP = <functools.partial object> +
+   + + DD = <functools.partial object> +
+   + + DEL = <functools.partial object> +
+   + + DFN = <functools.partial object> +
+   + + DIR = <functools.partial object> +
+   + + DIV = <functools.partial object> +
+   + + DL = <functools.partial object> +
+   + + DT = <functools.partial object> +
+   + + EM = <functools.partial object> +
+   + + FIELDSET = <functools.partial object> +
+   + + FONT = <functools.partial object> +
+   + + FORM = <functools.partial object> +
+   + + FRAME = <functools.partial object> +
+   + + FRAMESET = <functools.partial object> +
+   + + H1 = <functools.partial object> +
+   + + H2 = <functools.partial object> +
+   + + H3 = <functools.partial object> +
+   + + H4 = <functools.partial object> +
+   + + H5 = <functools.partial object> +
+   + + H6 = <functools.partial object> +
+   + + HEAD = <functools.partial object> +
+   + + HR = <functools.partial object> +
+   + + HTML = <functools.partial object> +
+   + + I = <functools.partial object> +
+   + + IFRAME = <functools.partial object> +
+   + + IMG = <functools.partial object> +
+   + + INPUT = <functools.partial object> +
+   + + INS = <functools.partial object> +
+   + + ISINDEX = <functools.partial object> +
+   + + KBD = <functools.partial object> +
+   + + LABEL = <functools.partial object> +
+   + + LEGEND = <functools.partial object> +
+   + + LI = <functools.partial object> +
+   + + LINK = <functools.partial object> +
+   + + MAP = <functools.partial object> +
+   + + MENU = <functools.partial object> +
+   + + META = <functools.partial object> +
+   + + NOFRAMES = <functools.partial object> +
+   + + NOSCRIPT = <functools.partial object> +
+   + + OBJECT = <functools.partial object> +
+   + + OL = <functools.partial object> +
+   + + OPTGROUP = <functools.partial object> +
+   + + OPTION = <functools.partial object> +
+   + + P = <functools.partial object> +
+   + + PARAM = <functools.partial object> +
+   + + PRE = <functools.partial object> +
+   + + Q = <functools.partial object> +
+   + + S = <functools.partial object> +
+   + + SAMP = <functools.partial object> +
+   + + SCRIPT = <functools.partial object> +
+   + + SELECT = <functools.partial object> +
+   + + SMALL = <functools.partial object> +
+   + + SPAN = <functools.partial object> +
+   + + STRIKE = <functools.partial object> +
+   + + STRONG = <functools.partial object> +
+   + + STYLE = <functools.partial object> +
+   + + SUB = <functools.partial object> +
+   + + SUP = <functools.partial object> +
+   + + TABLE = <functools.partial object> +
+   + + TBODY = <functools.partial object> +
+   + + TD = <functools.partial object> +
+   + + TEXTAREA = <functools.partial object> +
+   + + TFOOT = <functools.partial object> +
+   + + TH = <functools.partial object> +
+   + + THEAD = <functools.partial object> +
+   + + TITLE = <functools.partial object> +
+   + + TR = <functools.partial object> +
+   + + TT = <functools.partial object> +
+   + + U = <functools.partial object> +
+   + + UL = <functools.partial object> +
+   + + VAR = <functools.partial object> +
+   + + __package__ = 'lxml.html' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0dc11234 --- /dev/null +++ b/doc/html/api/lxml.html.builder-pysrc.html @@ -0,0 +1,458 @@ + + + + + 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 00000000..8271b8b5 --- /dev/null +++ b/doc/html/api/lxml.html.clean-module.html @@ -0,0 +1,771 @@ + + + + + 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]
+
+   + + unicode
+ str(object='') -> string +
+   + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ character + + + + + + +
unichr(i)
+ Return a string of one character with ordinal i; 0 <= i < 256.
+ + +
+ +
+   + + + + + + +
_is_image_dataurl(...)
+ search(string[, pos[, endpos]]) --> match object or None. +Scan through string looking for a match, and return a corresponding +match object instance. Return None if no position in the string matches.
+ source code + +
+ +
+   + + + + + + +
_is_possibly_malicious_scheme(...)
+ search(string[, pos[, endpos]]) --> match object or None. +Scan through string looking for a match, and return a corresponding +match object instance. Return None if no position in the string matches.
+ source code + +
+ +
+   + + + + + + +
_is_javascript_scheme(s) + source code + +
+ +
+   + + + + + + +
_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(...) + source code + +
+ +
+   + + + + + + +
autolink(el, + link_regexes=_link_regexes, + avoid_elements=_avoid_elements, + avoid_hosts=_avoid_hosts, + avoid_classes=_avoid_classes)
+ Turn any URLs into links.
+ source code + +
+ +
+   + + + + + + +
_link_text(text, + link_regexes, + avoid_hosts, + factory) + source code + +
+ +
+   + + + + + + +
autolink_html(html)
+ Turn any URLs into links.
+ source code + +
+ +
+   + + + + + + +
word_break(el, + max_width=40, + avoid_elements=_avoid_word_break_elements, + avoid_classes=_avoid_word_break_classes, + break_character=unichr(0x200b))
+ Breaks any long words found in the body of the text (not attributes).
+ source code + +
+ +
+   + + + + + + +
word_break_html(html) + source code + +
+ +
+   + + + + + + +
_break_text(text, + max_width, + break_character) + source code + +
+ +
+   + + + + + + +
_insert_break(word, + width, + break_character) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + basestring = str, bytes +
+   + + _css_javascript_re = re.compile(r'(?is)expression\s*\(.*?\)') +
+   + + _css_import_re = re.compile(r'(?i)@\s*import') +
+   + + _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 = <lxml.html.clean.Cleaner object> +
+   + + _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]') +
+   + + __package__ = None
+ hash(x) +
+   + + __test__ = {} +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

autolink(el, + link_regexes=_link_regexes, + avoid_elements=_avoid_elements, + avoid_hosts=_avoid_hosts, + avoid_classes=_avoid_classes) +

+
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) +

+
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=_avoid_word_break_elements, + avoid_classes=_avoid_word_break_classes, + break_character=unichr(0x200b)) +

+
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]
+
+ +
+ +
+

_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 00000000..482679b3 --- /dev/null +++ b/doc/html/api/lxml.html.clean-pysrc.html @@ -0,0 +1,1401 @@ + + + + + lxml.html.clean + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module clean + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.clean

+
+  1  # cython: language_level=2 
+  2   
+  3  """A cleanup tool for HTML. 
+  4   
+  5  Removes unwanted tags and content.  See the `Cleaner` class for 
+  6  details. 
+  7  """ 
+  8   
+  9  from __future__ import absolute_import 
+ 10   
+ 11  import re 
+ 12  import copy 
+ 13  try: 
+ 14      from urlparse import urlsplit 
+ 15      from urllib import unquote_plus 
+ 16  except ImportError: 
+ 17      # Python 3 
+ 18      from urllib.parse import urlsplit, unquote_plus 
+ 19  from lxml import etree 
+ 20  from lxml.html import defs 
+ 21  from lxml.html import fromstring, XHTML_NAMESPACE 
+ 22  from lxml.html import xhtml_to_html, _transform_result 
+ 23   
+ 24  try: 
+ 25      unichr 
+ 26  except NameError: 
+ 27      # Python 3 
+ 28      unichr = chr 
+ 29  try: 
+ 30      unicode 
+ 31  except NameError: 
+ 32      # Python 3 
+ 33      unicode = str 
+ 34  try: 
+ 35      basestring 
+ 36  except NameError: 
+ 37      basestring = (str, bytes) 
+ 38   
+ 39   
+ 40  __all__ = ['clean_html', 'clean', 'Cleaner', 'autolink', 'autolink_html', 
+ 41             'word_break', 'word_break_html'] 
+ 42   
+ 43  # Look at http://code.sixapart.com/trac/livejournal/browser/trunk/cgi-bin/cleanhtml.pl 
+ 44  #   Particularly the CSS cleaning; most of the tag cleaning is integrated now 
+ 45  # I have multiple kinds of schemes searched; but should schemes be 
+ 46  #   whitelisted instead? 
+ 47  # max height? 
+ 48  # remove images?  Also in CSS?  background attribute? 
+ 49  # Some way to whitelist object, iframe, etc (e.g., if you want to 
+ 50  #   allow *just* embedded YouTube movies) 
+ 51  # Log what was deleted and why? 
+ 52  # style="behavior: ..." might be bad in IE? 
+ 53  # Should we have something for just <meta http-equiv>?  That's the worst of the 
+ 54  #   metas. 
+ 55  # UTF-7 detections?  Example: 
+ 56  #     <HEAD><META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-7"> </HEAD>+ADw-SCRIPT+AD4-alert('XSS');+ADw-/SCRIPT+AD4- 
+ 57  #   you don't always have to have the charset set, if the page has no charset 
+ 58  #   and there's UTF7-like code in it. 
+ 59  # Look at these tests: http://htmlpurifier.org/live/smoketests/xssAttacks.php 
+ 60   
+ 61   
+ 62  # This is an IE-specific construct you can have in a stylesheet to 
+ 63  # run some Javascript: 
+ 64  _css_javascript_re = re.compile( 
+ 65      r'expression\s*\(.*?\)', re.S|re.I) 
+ 66   
+ 67  # Do I have to worry about @\nimport? 
+ 68  _css_import_re = re.compile( 
+ 69      r'@\s*import', re.I) 
+ 70   
+ 71  # All kinds of schemes besides just javascript: that can cause 
+ 72  # execution: 
+ 73  _is_image_dataurl = re.compile( 
+ 74      r'^data:image/.+;base64', re.I).search 
+ 75  _is_possibly_malicious_scheme = re.compile( 
+ 76      r'(?:javascript|jscript|livescript|vbscript|data|about|mocha):', 
+ 77      re.I).search 
+
79 if _is_image_dataurl(s): + 80 return None + 81 return _is_possibly_malicious_scheme(s) +
82 + 83 _substitute_whitespace = re.compile(r'[\s\x00-\x08\x0B\x0C\x0E-\x19]+').sub + 84 # FIXME: should data: be blocked? + 85 + 86 # FIXME: check against: http://msdn2.microsoft.com/en-us/library/ms537512.aspx + 87 _conditional_comment_re = re.compile( + 88 r'\[if[\s\n\r]+.*?][\s\n\r]*>', re.I|re.S) + 89 + 90 _find_styled_elements = etree.XPath( + 91 "descendant-or-self::*[@style]") + 92 + 93 _find_external_links = etree.XPath( + 94 ("descendant-or-self::a [normalize-space(@href) and substring(normalize-space(@href),1,1) != '#'] |" + 95 "descendant-or-self::x:a[normalize-space(@href) and substring(normalize-space(@href),1,1) != '#']"), + 96 namespaces={'x':XHTML_NAMESPACE}) + 97 + 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. Also removes stylesheets +110 as they could contain Javascript. +111 +112 ``comments``: +113 Removes any comments. +114 +115 ``style``: +116 Removes any style tags. +117 +118 ``inline_style`` +119 Removes any style attributes. Defaults to the value of the ``style`` option. +120 +121 ``links``: +122 Removes any ``<link>`` tags +123 +124 ``meta``: +125 Removes any ``<meta>`` tags +126 +127 ``page_structure``: +128 Structural parts of a page: ``<head>``, ``<html>``, ``<title>``. +129 +130 ``processing_instructions``: +131 Removes any processing instructions. +132 +133 ``embedded``: +134 Removes any embedded objects (flash, iframes) +135 +136 ``frames``: +137 Removes any frame-related tags +138 +139 ``forms``: +140 Removes any form tags +141 +142 ``annoying_tags``: +143 Tags that aren't *wrong*, but are annoying. ``<blink>`` and ``<marquee>`` +144 +145 ``remove_tags``: +146 A list of tags to remove. Only the tags will be removed, +147 their content will get pulled up into the parent tag. +148 +149 ``kill_tags``: +150 A list of tags to kill. Killing also removes the tag's content, +151 i.e. the whole subtree, not just the tag itself. +152 +153 ``allow_tags``: +154 A list of tags to include (default include all). +155 +156 ``remove_unknown_tags``: +157 Remove any tags that aren't standard parts of HTML. +158 +159 ``safe_attrs_only``: +160 If true, only include 'safe' attributes (specifically the list +161 from the feedparser HTML sanitisation web site). +162 +163 ``safe_attrs``: +164 A set of attribute names to override the default list of attributes +165 considered 'safe' (when safe_attrs_only=True). +166 +167 ``add_nofollow``: +168 If true, then any <a> tags will have ``rel="nofollow"`` added to them. +169 +170 ``host_whitelist``: +171 A list or set of hosts that you can use for embedded content +172 (for content like ``<object>``, ``<link rel="stylesheet">``, etc). +173 You can also implement/override the method +174 ``allow_embedded_url(el, url)`` or ``allow_element(el)`` to +175 implement more complex rules for what can be embedded. +176 Anything that passes this test will be shown, regardless of +177 the value of (for instance) ``embedded``. +178 +179 Note that this parameter might not work as intended if you do not +180 make the links absolute before doing the cleaning. +181 +182 Note that you may also need to set ``whitelist_tags``. +183 +184 ``whitelist_tags``: +185 A set of tags that can be included with ``host_whitelist``. +186 The default is ``iframe`` and ``embed``; you may wish to +187 include other tags like ``script``, or you may want to +188 implement ``allow_embedded_url`` for more control. Set to None to +189 include all tags. +190 +191 This modifies the document *in place*. +192 """ +193 +194 scripts = True +195 javascript = True +196 comments = True +197 style = False +198 inline_style = None +199 links = True +200 meta = True +201 page_structure = True +202 processing_instructions = True +203 embedded = True +204 frames = True +205 forms = True +206 annoying_tags = True +207 remove_tags = None +208 allow_tags = None +209 kill_tags = None +210 remove_unknown_tags = True +211 safe_attrs_only = True +212 safe_attrs = defs.safe_attrs +213 add_nofollow = False +214 host_whitelist = () +215 whitelist_tags = {'iframe', 'embed'} +216 +
217 - def __init__(self, **kw): +
218 for name, value in kw.items(): +219 if not hasattr(self, name): +220 raise TypeError( +221 "Unknown parameter: %s=%r" % (name, value)) +222 setattr(self, name, value) +223 if self.inline_style is None and 'inline_style' not in kw: +224 self.inline_style = self.style +
225 +226 # Used to lookup the primary URL for a given tag that is up for +227 # removal: +228 _tag_link_attrs = dict( +229 script='src', +230 link='href', +231 # From: http://java.sun.com/j2se/1.4.2/docs/guide/misc/applet.html +232 # From what I can tell, both attributes can contain a link: +233 applet=['code', 'object'], +234 iframe='src', +235 embed='src', +236 layer='src', +237 # FIXME: there doesn't really seem like a general way to figure out what +238 # links an <object> tag uses; links often go in <param> tags with values +239 # that we don't really know. You'd have to have knowledge about specific +240 # kinds of plugins (probably keyed off classid), and match against those. +241 ##object=?, +242 # FIXME: not looking at the action currently, because it is more complex +243 # than than -- if you keep the form, you should keep the form controls. +244 ##form='action', +245 a='href', +246 ) +247 +
248 - def __call__(self, doc): +
249 """ +250 Cleans the document. +251 """ +252 if hasattr(doc, 'getroot'): +253 # ElementTree instance, instead of an element +254 doc = doc.getroot() +255 # convert XHTML to HTML +256 xhtml_to_html(doc) +257 # Normalize a case that IE treats <image> like <img>, and that +258 # can confuse either this step or later steps. +259 for el in doc.iter('image'): +260 el.tag = 'img' +261 if not self.comments: +262 # Of course, if we were going to kill comments anyway, we don't +263 # need to worry about this +264 self.kill_conditional_comments(doc) +265 +266 kill_tags = set(self.kill_tags or ()) +267 remove_tags = set(self.remove_tags or ()) +268 allow_tags = set(self.allow_tags or ()) +269 +270 if self.scripts: +271 kill_tags.add('script') +272 if self.safe_attrs_only: +273 safe_attrs = set(self.safe_attrs) +274 for el in doc.iter(etree.Element): +275 attrib = el.attrib +276 for aname in attrib.keys(): +277 if aname not in safe_attrs: +278 del attrib[aname] +279 if self.javascript: +280 if not (self.safe_attrs_only and +281 self.safe_attrs == defs.safe_attrs): +282 # safe_attrs handles events attributes itself +283 for el in doc.iter(etree.Element): +284 attrib = el.attrib +285 for aname in attrib.keys(): +286 if aname.startswith('on'): +287 del attrib[aname] +288 doc.rewrite_links(self._remove_javascript_link, +289 resolve_base_href=False) +290 # If we're deleting style then we don't have to remove JS links +291 # from styles, otherwise... +292 if not self.inline_style: +293 for el in _find_styled_elements(doc): +294 old = el.get('style') +295 new = _css_javascript_re.sub('', old) +296 new = _css_import_re.sub('', new) +297 if self._has_sneaky_javascript(new): +298 # Something tricky is going on... +299 del el.attrib['style'] +300 elif new != old: +301 el.set('style', new) +302 if not self.style: +303 for el in list(doc.iter('style')): +304 if el.get('type', '').lower().strip() == 'text/javascript': +305 el.drop_tree() +306 continue +307 old = el.text or '' +308 new = _css_javascript_re.sub('', old) +309 # The imported CSS can do anything; we just can't allow: +310 new = _css_import_re.sub('', old) +311 if self._has_sneaky_javascript(new): +312 # Something tricky is going on... +313 el.text = '/* deleted */' +314 elif new != old: +315 el.text = new +316 if self.comments or self.processing_instructions: +317 # FIXME: why either? I feel like there's some obscure reason +318 # because you can put PIs in comments...? But I've already +319 # forgotten it +320 kill_tags.add(etree.Comment) +321 if self.processing_instructions: +322 kill_tags.add(etree.ProcessingInstruction) +323 if self.style: +324 kill_tags.add('style') +325 if self.inline_style: +326 etree.strip_attributes(doc, 'style') +327 if self.links: +328 kill_tags.add('link') +329 elif self.style or self.javascript: +330 # We must get rid of included stylesheets if Javascript is not +331 # allowed, as you can put Javascript in them +332 for el in list(doc.iter('link')): +333 if 'stylesheet' in el.get('rel', '').lower(): +334 # Note this kills alternate stylesheets as well +335 if not self.allow_element(el): +336 el.drop_tree() +337 if self.meta: +338 kill_tags.add('meta') +339 if self.page_structure: +340 remove_tags.update(('head', 'html', 'title')) +341 if self.embedded: +342 # FIXME: is <layer> really embedded? +343 # We should get rid of any <param> tags not inside <applet>; +344 # These are not really valid anyway. +345 for el in list(doc.iter('param')): +346 found_parent = False +347 parent = el.getparent() +348 while parent is not None and parent.tag not in ('applet', 'object'): +349 parent = parent.getparent() +350 if parent is None: +351 el.drop_tree() +352 kill_tags.update(('applet',)) +353 # The alternate contents that are in an iframe are a good fallback: +354 remove_tags.update(('iframe', 'embed', 'layer', 'object', 'param')) +355 if self.frames: +356 # FIXME: ideally we should look at the frame links, but +357 # generally frames don't mix properly with an HTML +358 # fragment anyway. +359 kill_tags.update(defs.frame_tags) +360 if self.forms: +361 remove_tags.add('form') +362 kill_tags.update(('button', 'input', 'select', 'textarea')) +363 if self.annoying_tags: +364 remove_tags.update(('blink', 'marquee')) +365 +366 _remove = [] +367 _kill = [] +368 for el in doc.iter(): +369 if el.tag in kill_tags: +370 if self.allow_element(el): +371 continue +372 _kill.append(el) +373 elif el.tag in remove_tags: +374 if self.allow_element(el): +375 continue +376 _remove.append(el) +377 +378 if _remove and _remove[0] == doc: +379 # We have to drop the parent-most tag, which we can't +380 # do. Instead we'll rewrite it: +381 el = _remove.pop(0) +382 el.tag = 'div' +383 el.attrib.clear() +384 elif _kill and _kill[0] == doc: +385 # We have to drop the parent-most element, which we can't +386 # do. Instead we'll clear it: +387 el = _kill.pop(0) +388 if el.tag != 'html': +389 el.tag = 'div' +390 el.clear() +391 +392 _kill.reverse() # start with innermost tags +393 for el in _kill: +394 el.drop_tree() +395 for el in _remove: +396 el.drop_tag() +397 +398 if self.remove_unknown_tags: +399 if allow_tags: +400 raise ValueError( +401 "It does not make sense to pass in both allow_tags and remove_unknown_tags") +402 allow_tags = set(defs.tags) +403 if allow_tags: +404 bad = [] +405 for el in doc.iter(): +406 if el.tag not in allow_tags: +407 bad.append(el) +408 if bad: +409 if bad[0] is doc: +410 el = bad.pop(0) +411 el.tag = 'div' +412 el.attrib.clear() +413 for el in bad: +414 el.drop_tag() +415 if self.add_nofollow: +416 for el in _find_external_links(doc): +417 if not self.allow_follow(el): +418 rel = el.get('rel') +419 if rel: +420 if ('nofollow' in rel +421 and ' nofollow ' in (' %s ' % rel)): +422 continue +423 rel = '%s nofollow' % rel +424 else: +425 rel = 'nofollow' +426 el.set('rel', rel) +
427 +
428 - def allow_follow(self, anchor): +
429 """ +430 Override to suppress rel="nofollow" on some anchors. +431 """ +432 return False +
433 +
434 - def allow_element(self, el): +
435 """ +436 Decide whether an element is configured to be accepted or rejected. +437 +438 :param el: an element. +439 :return: true to accept the element or false to reject/discard it. +440 """ +441 if el.tag not in self._tag_link_attrs: +442 return False +443 attr = self._tag_link_attrs[el.tag] +444 if isinstance(attr, (list, tuple)): +445 for one_attr in attr: +446 url = el.get(one_attr) +447 if not url: +448 return False +449 if not self.allow_embedded_url(el, url): +450 return False +451 return True +452 else: +453 url = el.get(attr) +454 if not url: +455 return False +456 return self.allow_embedded_url(el, url) +
457 +
458 - def allow_embedded_url(self, el, url): +
459 """ +460 Decide whether a URL that was found in an element's attributes or text +461 if configured to be accepted or rejected. +462 +463 :param el: an element. +464 :param url: a URL found on the element. +465 :return: true to accept the URL and false to reject it. +466 """ +467 if self.whitelist_tags is not None and el.tag not in self.whitelist_tags: +468 return False +469 scheme, netloc, path, query, fragment = urlsplit(url) +470 netloc = netloc.lower().split(':', 1)[0] +471 if scheme not in ('http', 'https'): +472 return False +473 if netloc in self.host_whitelist: +474 return True +475 return False +
476 +
477 - def kill_conditional_comments(self, doc): +
478 """ +479 IE conditional comments basically embed HTML that the parser +480 doesn't normally see. We can't allow anything like that, so +481 we'll kill any comments that could be conditional. +482 """ +483 bad = [] +484 self._kill_elements( +485 doc, lambda el: _conditional_comment_re.search(el.text), +486 etree.Comment) +
487 +
488 - def _kill_elements(self, doc, condition, iterate=None): +
489 bad = [] +490 for el in doc.iter(iterate): +491 if condition(el): +492 bad.append(el) +493 for el in bad: +494 el.drop_tree() +
495 +503 +504 _substitute_comments = re.compile(r'/\*.*?\*/', re.S).sub +505 +
506 - def _has_sneaky_javascript(self, style): +
507 """ +508 Depending on the browser, stuff like ``e x p r e s s i o n(...)`` +509 can get interpreted, or ``expre/* stuff */ssion(...)``. This +510 checks for attempt to do stuff like this. +511 +512 Typically the response will be to kill the entire style; if you +513 have just a bit of Javascript in the style another rule will catch +514 that and remove only the Javascript from the style; this catches +515 more sneaky attempts. +516 """ +517 style = self._substitute_comments('', style) +518 style = style.replace('\\', '') +519 style = _substitute_whitespace('', style) +520 style = style.lower() +521 if 'javascript:' in style: +522 return True +523 if 'expression(' in style: +524 return True +525 return False +
526 +
527 - def clean_html(self, html): +
528 result_type = type(html) +529 if isinstance(html, basestring): +530 doc = fromstring(html) +531 else: +532 doc = copy.deepcopy(html) +533 self(doc) +534 return _transform_result(result_type, doc) +
535 +536 clean = Cleaner() +537 clean_html = clean.clean_html +538 +539 ############################################################ +540 ## Autolinking +541 ############################################################ +542 +543 _link_regexes = [ +544 re.compile(r'(?P<body>https?://(?P<host>[a-z0-9._-]+)(?:/[/\-_.,a-z0-9%&?;=~]*)?(?:\([/\-_.,a-z0-9%&?;=~]*\))?)', re.I), +545 # This is conservative, but autolinking can be a bit conservative: +546 re.compile(r'mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_.-]+[a-z]))', re.I), +547 ] +548 +549 _avoid_elements = ['textarea', 'pre', 'code', 'head', 'select', 'a'] +550 +551 _avoid_hosts = [ +552 re.compile(r'^localhost', re.I), +553 re.compile(r'\bexample\.(?:com|org|net)$', re.I), +554 re.compile(r'^127\.0\.0\.1$'), +555 ] +556 +557 _avoid_classes = ['nolink'] +558 +603 +661 +670 +671 autolink_html.__doc__ = autolink.__doc__ +672 +673 ############################################################ +674 ## Word wrapping +675 ############################################################ +676 +677 _avoid_word_break_elements = ['pre', 'textarea', 'code'] +678 _avoid_word_break_classes = ['nobreak'] +679 +
680 -def word_break(el, max_width=40, +681 avoid_elements=_avoid_word_break_elements, +682 avoid_classes=_avoid_word_break_classes, +683 break_character=unichr(0x200b)): +
684 """ +685 Breaks any long words found in the body of the text (not attributes). +686 +687 Doesn't effect any of the tags in avoid_elements, by default +688 ``<textarea>`` and ``<pre>`` +689 +690 Breaks words by inserting &#8203;, which is a unicode character +691 for Zero Width Space character. This generally takes up no space +692 in rendering, but does copy as a space, and in monospace contexts +693 usually takes up space. +694 +695 See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion +696 """ +697 # Character suggestion of &#8203 comes from: +698 # http://www.cs.tut.fi/~jkorpela/html/nobr.html +699 if el.tag in _avoid_word_break_elements: +700 return +701 class_name = el.get('class') +702 if class_name: +703 dont_break = False +704 class_name = class_name.split() +705 for avoid in avoid_classes: +706 if avoid in class_name: +707 dont_break = True +708 break +709 if dont_break: +710 return +711 if el.text: +712 el.text = _break_text(el.text, max_width, break_character) +713 for child in el: +714 word_break(child, max_width=max_width, +715 avoid_elements=avoid_elements, +716 avoid_classes=avoid_classes, +717 break_character=break_character) +718 if child.tail: +719 child.tail = _break_text(child.tail, max_width, break_character) +
720 +
721 -def word_break_html(html, *args, **kw): +
722 result_type = type(html) +723 doc = fromstring(html) +724 word_break(doc, *args, **kw) +725 return _transform_result(result_type, doc) +
726 +
727 -def _break_text(text, max_width, break_character): +
728 words = text.split() +729 for word in words: +730 if len(word) > max_width: +731 replacement = _insert_break(word, max_width, break_character) +732 text = text.replace(word, replacement) +733 return text +
734 +735 _break_prefer_re = re.compile(r'[^a-z]', re.I) +736 +
737 -def _insert_break(word, width, break_character): +
738 orig_word = word +739 result = '' +740 while len(word) > width: +741 start = word[:width] +742 breaks = list(_break_prefer_re.finditer(start)) +743 if breaks: +744 last_break = breaks[-1] +745 # Only walk back up to 10 characters to find a nice break: +746 if last_break.end() > width-10: +747 # FIXME: should the break character be at the end of the +748 # chunk, or the beginning of the next chunk? +749 start = word[:last_break.end()] +750 result += start + break_character +751 word = word[len(start):] +752 result += word +753 return result +
754 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..c4bdea23 --- /dev/null +++ b/doc/html/api/lxml.html.clean.Cleaner-class.html @@ -0,0 +1,855 @@ + + + + + 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. Also removes stylesheets +as they could contain Javascript.
+
comments:
+
Removes any comments.
+
style:
+
Removes any style tags.
+
inline_style
+
Removes any style attributes. Defaults to the value of the style option.
+
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 <marquee>
+
remove_tags:
+
A list of tags to remove. Only the tags will be removed, +their content will get pulled up into the parent tag.
+
kill_tags:
+
A list of tags to kill. Killing also removes the tag's content, +i.e. the whole subtree, not just the tag itself.
+
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 the feedparser HTML sanitisation web site).
+
safe_attrs:
+
A set of attribute names to override the default list of attributes +considered 'safe' (when safe_attrs_only=True).
+
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.

+

Note that you may also need to set whitelist_tags.

+
+
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)
+ x.__init__(...) initializes x; see help(type(x)) 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)
+ Decide whether an element is configured to be accepted or rejected.
+ source code + +
+ +
+   + + + + + + +
allow_embedded_url(self, + el, + url)
+ Decide whether a URL that was found in an element's attributes or text +if configured to be accepted or rejected.
+ source code + +
+ +
+   + + + + + + +
kill_conditional_comments(self, + doc)
+ 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.
+ 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(...). This +checks for attempt to do stuff like this.
+ source code + +
+ +
+   + + + + + + +
clean_html(self, + html) + source code + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + scripts = True +
+   + + javascript = True +
+   + + comments = True +
+   + + style = False +
+   + + inline_style = None
+ hash(x) +
+   + + links = True +
+   + + meta = True +
+   + + page_structure = True +
+   + + processing_instructions = True +
+   + + embedded = True +
+   + + frames = True +
+   + + forms = True +
+   + + annoying_tags = True +
+   + + remove_tags = None
+ hash(x) +
+   + + allow_tags = None
+ hash(x) +
+   + + kill_tags = None
+ hash(x) +
+   + + remove_unknown_tags = True +
+   + + safe_attrs_only = True +
+   + + safe_attrs = frozenset(['abbr', 'accept', 'accept-charset', 'a... +
+   + + add_nofollow = False +
+   + + host_whitelist = () +
+   + + whitelist_tags = set(['embed', 'iframe']) +
+   + + _tag_link_attrs = {'a': 'href', 'applet': ['code', 'object'], ... +
+   + + __qualname__ = 'Cleaner' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

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

__init__(self) +
(Constructor) +

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

allow_element(self, + el) +

+
source code  +
+ + Decide whether an element is configured to be accepted or rejected. +
+
Parameters:
+
    +
  • el - an element.
  • +
+
Returns:
+
true to accept the element or false to reject/discard it.
+
+
+
+ +
+ +
+ + +
+

allow_embedded_url(self, + el, + url) +

+
source code  +
+ + Decide whether a URL that was found in an element's attributes or text +if configured to be accepted or rejected. +
+
Parameters:
+
    +
  • el - an element.
  • +
  • url - a URL found on the element.
  • +
+
Returns:
+
true to accept the URL and false to reject it.
+
+
+
+ +
+ +
+ + +
+

_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]
+
+ +
+ +
+

safe_attrs

+ +
+
+
+
Value:
+
+frozenset(['abbr',
+           'accept',
+           'accept-charset',
+           'accesskey',
+           'action',
+           'align',
+           'alt',
+           'axis',
+...
+
+
+
+
+
+ +
+ +
+

_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 00000000..37be9cad --- /dev/null +++ b/doc/html/api/lxml.html.defs-module.html @@ -0,0 +1,802 @@ + + + + + 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']) +
+   + + html5_tags = frozenset(['article', 'aside', 'audio', 'canvas',... +
+   + + nonstandard_tags = frozenset(['blink', 'marquee']) +
+   + + tags = frozenset(['a', 'abbr', 'acronym', 'address', 'applet',... +
+   + + __package__ = None
+ hash(x) +
+ + + + + + +
+ + + + + +
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'])
+
+
+
+
+
+ +
+ +
+

html5_tags

+ +
+
+
+
Value:
+
+frozenset(['article',
+           'aside',
+           'audio',
+           'canvas',
+           'command',
+           'datalist',
+           'details',
+           'embed',
+...
+
+
+
+
+
+ +
+ +
+

tags

+ +
+
+
+
Value:
+
+frozenset(['a',
+           'abbr',
+           'acronym',
+           'address',
+           'applet',
+           'area',
+           'article',
+           'aside',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0b407666 --- /dev/null +++ b/doc/html/api/lxml.html.defs-pysrc.html @@ -0,0 +1,257 @@ + + + + + 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  # and http://www.w3.org/community/webed/wiki/HTML/New_HTML5_Elements 
+  7  # for html5_tags. 
+  8   
+  9  empty_tags = frozenset([ 
+ 10      'area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 
+ 11      'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track']) 
+ 12   
+ 13  deprecated_tags = frozenset([ 
+ 14      'applet', 'basefont', 'center', 'dir', 'font', 'isindex', 
+ 15      'menu', 's', 'strike', 'u']) 
+ 16   
+ 17  # archive actually takes a space-separated list of URIs 
+ 18  link_attrs = frozenset([ 
+ 19      'action', 'archive', 'background', 'cite', 'classid', 
+ 20      'codebase', 'data', 'href', 'longdesc', 'profile', 'src', 
+ 21      'usemap', 
+ 22      # Not standard: 
+ 23      'dynsrc', 'lowsrc', 
+ 24      ]) 
+ 25   
+ 26  # Not in the HTML 4 spec: 
+ 27  # onerror, onresize 
+ 28  event_attrs = frozenset([ 
+ 29      'onblur', 'onchange', 'onclick', 'ondblclick', 'onerror', 
+ 30      'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 
+ 31      'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 
+ 32      'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit', 
+ 33      'onunload', 
+ 34      ]) 
+ 35   
+ 36  safe_attrs = frozenset([ 
+ 37      'abbr', 'accept', 'accept-charset', 'accesskey', 'action', 'align', 
+ 38      'alt', 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', 
+ 39      'charset', 'checked', 'cite', 'class', 'clear', 'cols', 'colspan', 
+ 40      'color', 'compact', 'coords', 'datetime', 'dir', 'disabled', 'enctype', 
+ 41      'for', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 
+ 42      'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method', 
+ 43      'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly', 
+ 44      'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape', 
+ 45      'size', 'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title', 
+ 46      'type', 'usemap', 'valign', 'value', 'vspace', 'width']) 
+ 47   
+ 48  # From http://htmlhelp.com/reference/html40/olist.html 
+ 49  top_level_tags = frozenset([ 
+ 50      'html', 'head', 'body', 'frameset', 
+ 51      ]) 
+ 52   
+ 53  head_tags = frozenset([ 
+ 54      'base', 'isindex', 'link', 'meta', 'script', 'style', 'title', 
+ 55      ]) 
+ 56   
+ 57  general_block_tags = frozenset([ 
+ 58      'address', 
+ 59      'blockquote', 
+ 60      'center', 
+ 61      'del', 
+ 62      'div', 
+ 63      'h1', 
+ 64      'h2', 
+ 65      'h3', 
+ 66      'h4', 
+ 67      'h5', 
+ 68      'h6', 
+ 69      'hr', 
+ 70      'ins', 
+ 71      'isindex', 
+ 72      'noscript', 
+ 73      'p', 
+ 74      'pre', 
+ 75      ]) 
+ 76   
+ 77  list_tags = frozenset([ 
+ 78      'dir', 'dl', 'dt', 'dd', 'li', 'menu', 'ol', 'ul', 
+ 79      ]) 
+ 80   
+ 81  table_tags = frozenset([ 
+ 82      'table', 'caption', 'colgroup', 'col', 
+ 83      'thead', 'tfoot', 'tbody', 'tr', 'td', 'th', 
+ 84      ]) 
+ 85   
+ 86  # just this one from 
+ 87  # http://www.georgehernandez.com/h/XComputers/HTML/2BlockLevel.htm 
+ 88  block_tags = general_block_tags | list_tags | table_tags | frozenset([ 
+ 89      # Partial form tags 
+ 90      'fieldset', 'form', 'legend', 'optgroup', 'option', 
+ 91      ]) 
+ 92   
+ 93  form_tags = frozenset([ 
+ 94      'form', 'button', 'fieldset', 'legend', 'input', 'label', 
+ 95      'select', 'optgroup', 'option', 'textarea', 
+ 96      ]) 
+ 97   
+ 98  special_inline_tags = frozenset([ 
+ 99      'a', 'applet', 'basefont', 'bdo', 'br', 'embed', 'font', 'iframe', 
+100      'img', 'map', 'area', 'object', 'param', 'q', 'script', 
+101      'span', 'sub', 'sup', 
+102      ]) 
+103   
+104  phrase_tags = frozenset([ 
+105      'abbr', 'acronym', 'cite', 'code', 'del', 'dfn', 'em', 
+106      'ins', 'kbd', 'samp', 'strong', 'var', 
+107      ]) 
+108   
+109  font_style_tags = frozenset([ 
+110      'b', 'big', 'i', 's', 'small', 'strike', 'tt', 'u', 
+111      ]) 
+112   
+113  frame_tags = frozenset([ 
+114      'frameset', 'frame', 'noframes', 
+115      ]) 
+116       
+117  html5_tags = frozenset([ 
+118      'article', 'aside', 'audio', 'canvas', 'command', 'datalist', 
+119      'details', 'embed', 'figcaption', 'figure', 'footer', 'header', 
+120      'hgroup', 'keygen', 'mark', 'math', 'meter', 'nav', 'output', 
+121      'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 
+122      'svg', 'time', 'track', 'video', 'wbr' 
+123      ]) 
+124   
+125  # These tags aren't standard 
+126  nonstandard_tags = frozenset(['blink', 'marquee']) 
+127   
+128   
+129  tags = (top_level_tags | head_tags | general_block_tags | list_tags 
+130          | table_tags | form_tags | special_inline_tags | phrase_tags 
+131          | font_style_tags | nonstandard_tags | html5_tags) 
+132   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f7baa332 --- /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]
+
+   + + basestring
+ str(object='') -> string +
+   + + 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. 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. +
+   + + 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. +
+   + + href_token
+ Represents the href in an anchor tag. Unlike other words, we only +show the href when it changes. +
+   + + 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=default_markup)
+ 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. The documents are HTML +fragments (str/UTF8 or unicode), they are not complete documents +(i.e., no <html> tag).
+ 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. +cleanup_delete later resolves these markers into <del> tags.
+ source code + +
+ +
+   + + + + + + +
cleanup_delete(chunks)
+ 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).
+ 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). 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.
+ 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). 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.
+ 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. Note that the HTML will be +wrapped in a <div> tag that was not in the original document.
+ 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). +Also <ins> and <del> tags are removed.
+ source code + +
+ +
+   + + + + + + +
split_trailing_whitespace(word)
+ This function takes a word, such as 'test
+ 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. Each start tag is a chunk, each word is a chunk, and each +end tag is a chunk.
+ source code + +
+ +
+   + + + + + + +
split_words(text)
+ Splits some text into words. Includes trailing whitespace +on each word when appropriate.
+ 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. Includes +trailing whitespace when appropriate.
+ 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. transform <ins><p>word</p></ins> to +<p><ins>word</ins></p>
+ source code + +
+ +
+   + + + + + + +
serialize_html_fragment(el, + skip_outer=False)
+ Serialize a single lxml element as HTML. The serialized form +includes the elements tail.
+ 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 = (u'param', u'img', u'area', u'br', u'basefont', u... +
+   + + block_level_tags = (u'address', u'blockquote', u'center', u'di... +
+   + + block_level_container_tags = (u'dd', u'dt', u'frameset', u'li'... +
+   + + split_words_re = re.compile(r'(?u)\S+(?:\s+|$)') +
+   + + start_whitespace_re = re.compile(r'^[ \t\n\r]') +
+   + + __package__ = None
+ hash(x) +
+   + + __test__ = {u'html_annotate (line 35)':... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

html_annotate(doclist, + markup=default_markup) +

+
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.

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

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.

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

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.

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

split_trailing_whitespace(word) +

+
source code  +
+ +
+This function takes a word, such as 'test
+

' and returns ('test','

+

')

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

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).

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

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:
+
+(u'param',
+ u'img',
+ u'area',
+ u'br',
+ u'basefont',
+ u'input',
+ u'base',
+ u'meta',
+...
+
+
+
+
+
+ +
+ +
+

block_level_tags

+ +
+
+
+
Value:
+
+(u'address',
+ u'blockquote',
+ u'center',
+ u'dir',
+ u'div',
+ u'dl',
+ u'fieldset',
+ u'form',
+...
+
+
+
+
+
+ +
+ +
+

block_level_container_tags

+ +
+
+
+
Value:
+
+(u'dd',
+ u'dt',
+ u'frameset',
+ u'li',
+ u'tbody',
+ u'td',
+ u'tfoot',
+ u'th',
+...
+
+
+
+
+
+ +
+ +
+

__test__

+ +
+
+
+
Value:
+
+{u'html_annotate (line 35)': u'''
+    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"\
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..da317b3c --- /dev/null +++ b/doc/html/api/lxml.html.diff-pysrc.html @@ -0,0 +1,1866 @@ + + + + + lxml.html.diff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.diff

+
+  1  # cython: language_level=3 
+  2   
+  3  from __future__ import absolute_import 
+  4   
+  5  import difflib 
+  6  from lxml import etree 
+  7  from lxml.html import fragment_fromstring 
+  8  import re 
+  9   
+ 10  __all__ = ['html_annotate', 'htmldiff'] 
+ 11   
+ 12  try: 
+ 13      from html import escape as html_escape 
+ 14  except ImportError: 
+ 15      from cgi import escape as html_escape 
+ 16  try: 
+ 17      _unicode = unicode 
+ 18  except NameError: 
+ 19      # Python 3 
+ 20      _unicode = str 
+ 21  try: 
+ 22      basestring 
+ 23  except NameError: 
+ 24      # Python 3 
+ 25      basestring = str 
+ 26   
+ 27  ############################################################ 
+ 28  ## Annotation 
+ 29  ############################################################ 
+ 30   
+
31 -def default_markup(text, version): +
32 return '<span title="%s">%s</span>' % ( + 33 html_escape(_unicode(version), 1), text) +
34 +
35 -def html_annotate(doclist, markup=default_markup): +
36 """ + 37 doclist should be ordered from oldest to newest, like:: + 38 + 39 >>> version1 = 'Hello World' + 40 >>> version2 = 'Goodbye World' + 41 >>> print(html_annotate([(version1, 'version 1'), + 42 ... (version2, 'version 2')])) + 43 <span title="version 2">Goodbye</span> <span title="version 1">World</span> + 44 + 45 The documents must be *fragments* (str/UTF8 or unicode), not + 46 complete documents + 47 + 48 The markup argument is a function to markup the spans of words. + 49 This function is called like markup('Hello', 'version 2'), and + 50 returns HTML. The first argument is text and never includes any + 51 markup. The default uses a span with a title: + 52 + 53 >>> print(default_markup('Some Text', 'by Joe')) + 54 <span title="by Joe">Some Text</span> + 55 """ + 56 # The basic strategy we have is to split the documents up into + 57 # logical tokens (which are words with attached markup). We then + 58 # do diffs of each of the versions to track when a token first + 59 # appeared in the document; the annotation attached to the token + 60 # is the version where it first appeared. + 61 tokenlist = [tokenize_annotated(doc, version) + 62 for doc, version in doclist] + 63 cur_tokens = tokenlist[0] + 64 for tokens in tokenlist[1:]: + 65 html_annotate_merge_annotations(cur_tokens, tokens) + 66 cur_tokens = tokens + 67 + 68 # After we've tracked all the tokens, we can combine spans of text + 69 # that are adjacent and have the same annotation + 70 cur_tokens = compress_tokens(cur_tokens) + 71 # And finally add markup + 72 result = markup_serialize_tokens(cur_tokens, markup) + 73 return ''.join(result).strip() +
74 +
75 -def tokenize_annotated(doc, annotation): +
76 """Tokenize a document and add an annotation attribute to each token + 77 """ + 78 tokens = tokenize(doc, include_hrefs=False) + 79 for tok in tokens: + 80 tok.annotation = annotation + 81 return tokens + 82 +
83 -def html_annotate_merge_annotations(tokens_old, tokens_new): +
84 """Merge the annotations from tokens_old into tokens_new, when the + 85 tokens in the new document already existed in the old document. + 86 """ + 87 s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new) + 88 commands = s.get_opcodes() + 89 + 90 for command, i1, i2, j1, j2 in commands: + 91 if command == 'equal': + 92 eq_old = tokens_old[i1:i2] + 93 eq_new = tokens_new[j1:j2] + 94 copy_annotations(eq_old, eq_new) + 95 +
96 -def copy_annotations(src, dest): +
97 """ + 98 Copy annotations from the tokens listed in src to the tokens in dest + 99 """ +100 assert len(src) == len(dest) +101 for src_tok, dest_tok in zip(src, dest): +102 dest_tok.annotation = src_tok.annotation +103 +
104 -def compress_tokens(tokens): +
105 """ +106 Combine adjacent tokens when there is no HTML between the tokens, +107 and they share an annotation +108 """ +109 result = [tokens[0]] +110 for tok in tokens[1:]: +111 if (not result[-1].post_tags and +112 not tok.pre_tags and +113 result[-1].annotation == tok.annotation): +114 compress_merge_back(result, tok) +115 else: +116 result.append(tok) +117 return result +
118 +
119 -def compress_merge_back(tokens, tok): +
120 """ Merge tok into the last element of tokens (modifying the list of +121 tokens in-place). """ +122 last = tokens[-1] +123 if type(last) is not token or type(tok) is not token: +124 tokens.append(tok) +125 else: +126 text = _unicode(last) +127 if last.trailing_whitespace: +128 text += last.trailing_whitespace +129 text += tok +130 merged = token(text, +131 pre_tags=last.pre_tags, +132 post_tags=tok.post_tags, +133 trailing_whitespace=tok.trailing_whitespace) +134 merged.annotation = last.annotation +135 tokens[-1] = merged +136 +
137 -def markup_serialize_tokens(tokens, markup_func): +
138 """ +139 Serialize the list of tokens into a list of text chunks, calling +140 markup_func around text to add annotations. +141 """ +142 for token in tokens: +143 for pre in token.pre_tags: +144 yield pre +145 html = token.html() +146 html = markup_func(html, token.annotation) +147 if token.trailing_whitespace: +148 html += token.trailing_whitespace +149 yield html +150 for post in token.post_tags: +151 yield post +
152 +153 +154 ############################################################ +155 ## HTML Diffs +156 ############################################################ +157 +
158 -def htmldiff(old_html, new_html): +
159 ## FIXME: this should take parsed documents too, and use their body +160 ## or other content. +161 """ Do a diff of the old and new document. The documents are HTML +162 *fragments* (str/UTF8 or unicode), they are not complete documents +163 (i.e., no <html> tag). +164 +165 Returns HTML with <ins> and <del> tags added around the +166 appropriate text. +167 +168 Markup is generally ignored, with the markup from new_html +169 preserved, and possibly some markup from old_html (though it is +170 considered acceptable to lose some of the old markup). Only the +171 words in the HTML are diffed. The exception is <img> tags, which +172 are treated like words, and the href attribute of <a> tags, which +173 are noted inside the tag itself when there are changes. +174 """ +175 old_html_tokens = tokenize(old_html) +176 new_html_tokens = tokenize(new_html) +177 result = htmldiff_tokens(old_html_tokens, new_html_tokens) +178 result = ''.join(result).strip() +179 return fixup_ins_del_tags(result) +
180 +
181 -def htmldiff_tokens(html1_tokens, html2_tokens): +
182 """ Does a diff on the tokens themselves, returning a list of text +183 chunks (not tokens). +184 """ +185 # There are several passes as we do the differences. The tokens +186 # isolate the portion of the content we care to diff; difflib does +187 # all the actual hard work at that point. +188 # +189 # Then we must create a valid document from pieces of both the old +190 # document and the new document. We generally prefer to take +191 # markup from the new document, and only do a best effort attempt +192 # to keep markup from the old document; anything that we can't +193 # resolve we throw away. Also we try to put the deletes as close +194 # to the location where we think they would have been -- because +195 # we are only keeping the markup from the new document, it can be +196 # fuzzy where in the new document the old text would have gone. +197 # Again we just do a best effort attempt. +198 s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens) +199 commands = s.get_opcodes() +200 result = [] +201 for command, i1, i2, j1, j2 in commands: +202 if command == 'equal': +203 result.extend(expand_tokens(html2_tokens[j1:j2], equal=True)) +204 continue +205 if command == 'insert' or command == 'replace': +206 ins_tokens = expand_tokens(html2_tokens[j1:j2]) +207 merge_insert(ins_tokens, result) +208 if command == 'delete' or command == 'replace': +209 del_tokens = expand_tokens(html1_tokens[i1:i2]) +210 merge_delete(del_tokens, result) +211 # If deletes were inserted directly as <del> then we'd have an +212 # invalid document at this point. Instead we put in special +213 # markers, and when the complete diffed document has been created +214 # we try to move the deletes around and resolve any problems. +215 result = cleanup_delete(result) +216 +217 return result +
218 +
219 -def expand_tokens(tokens, equal=False): +
220 """Given a list of tokens, return a generator of the chunks of +221 text for the data in the tokens. +222 """ +223 for token in tokens: +224 for pre in token.pre_tags: +225 yield pre +226 if not equal or not token.hide_when_equal: +227 if token.trailing_whitespace: +228 yield token.html() + token.trailing_whitespace +229 else: +230 yield token.html() +231 for post in token.post_tags: +232 yield post +
233 +
234 -def merge_insert(ins_chunks, doc): +
235 """ doc is the already-handled document (as a list of text chunks); +236 here we add <ins>ins_chunks</ins> to the end of that. """ +237 # Though we don't throw away unbalanced_start or unbalanced_end +238 # (we assume there is accompanying markup later or earlier in the +239 # document), we only put <ins> around the balanced portion. +240 unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks) +241 doc.extend(unbalanced_start) +242 if doc and not doc[-1].endswith(' '): +243 # Fix up the case where the word before the insert didn't end with +244 # a space +245 doc[-1] += ' ' +246 doc.append('<ins>') +247 if balanced and balanced[-1].endswith(' '): +248 # We move space outside of </ins> +249 balanced[-1] = balanced[-1][:-1] +250 doc.extend(balanced) +251 doc.append('</ins> ') +252 doc.extend(unbalanced_end) +
253 +254 # These are sentinals to represent the start and end of a <del> +255 # segment, until we do the cleanup phase to turn them into proper +256 # markup: +
257 -class DEL_START: +
258 pass +
259 -class DEL_END: +
260 pass +
261 +
262 -class NoDeletes(Exception): +
263 """ Raised when the document no longer contains any pending deletes +264 (DEL_START/DEL_END) """ +
265 +
266 -def merge_delete(del_chunks, doc): +
267 """ Adds the text chunks in del_chunks to the document doc (another +268 list of text chunks) with marker to show it is a delete. +269 cleanup_delete later resolves these markers into <del> tags.""" +270 doc.append(DEL_START) +271 doc.extend(del_chunks) +272 doc.append(DEL_END) +
273 +
274 -def cleanup_delete(chunks): +
275 """ Cleans up any DEL_START/DEL_END markers in the document, replacing +276 them with <del></del>. To do this while keeping the document +277 valid, it may need to drop some tags (either start or end tags). +278 +279 It may also move the del into adjacent tags to try to move it to a +280 similar location where it was originally located (e.g., moving a +281 delete into preceding <div> tag, if the del looks like (DEL_START, +282 'Text</div>', DEL_END)""" +283 while 1: +284 # Find a pending DEL_START/DEL_END, splitting the document +285 # into stuff-preceding-DEL_START, stuff-inside, and +286 # stuff-following-DEL_END +287 try: +288 pre_delete, delete, post_delete = split_delete(chunks) +289 except NoDeletes: +290 # Nothing found, we've cleaned up the entire doc +291 break +292 # The stuff-inside-DEL_START/END may not be well balanced +293 # markup. First we figure out what unbalanced portions there are: +294 unbalanced_start, balanced, unbalanced_end = split_unbalanced(delete) +295 # Then we move the span forward and/or backward based on these +296 # unbalanced portions: +297 locate_unbalanced_start(unbalanced_start, pre_delete, post_delete) +298 locate_unbalanced_end(unbalanced_end, pre_delete, post_delete) +299 doc = pre_delete +300 if doc and not doc[-1].endswith(' '): +301 # Fix up case where the word before us didn't have a trailing space +302 doc[-1] += ' ' +303 doc.append('<del>') +304 if balanced and balanced[-1].endswith(' '): +305 # We move space outside of </del> +306 balanced[-1] = balanced[-1][:-1] +307 doc.extend(balanced) +308 doc.append('</del> ') +309 doc.extend(post_delete) +310 chunks = doc +311 return chunks +
312 +
313 -def split_unbalanced(chunks): +
314 """Return (unbalanced_start, balanced, unbalanced_end), where each is +315 a list of text and tag chunks. +316 +317 unbalanced_start is a list of all the tags that are opened, but +318 not closed in this span. Similarly, unbalanced_end is a list of +319 tags that are closed but were not opened. Extracting these might +320 mean some reordering of the chunks.""" +321 start = [] +322 end = [] +323 tag_stack = [] +324 balanced = [] +325 for chunk in chunks: +326 if not chunk.startswith('<'): +327 balanced.append(chunk) +328 continue +329 endtag = chunk[1] == '/' +330 name = chunk.split()[0].strip('<>/') +331 if name in empty_tags: +332 balanced.append(chunk) +333 continue +334 if endtag: +335 if tag_stack and tag_stack[-1][0] == name: +336 balanced.append(chunk) +337 name, pos, tag = tag_stack.pop() +338 balanced[pos] = tag +339 elif tag_stack: +340 start.extend([tag for name, pos, tag in tag_stack]) +341 tag_stack = [] +342 end.append(chunk) +343 else: +344 end.append(chunk) +345 else: +346 tag_stack.append((name, len(balanced), chunk)) +347 balanced.append(None) +348 start.extend( +349 [chunk for name, pos, chunk in tag_stack]) +350 balanced = [chunk for chunk in balanced if chunk is not None] +351 return start, balanced, end +
352 +
353 -def split_delete(chunks): +
354 """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END, +355 stuff_after_DEL_END). Returns the first case found (there may be +356 more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if +357 there's no DEL_START found. """ +358 try: +359 pos = chunks.index(DEL_START) +360 except ValueError: +361 raise NoDeletes +362 pos2 = chunks.index(DEL_END) +363 return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:] +
364 +
365 -def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): +
366 """ pre_delete and post_delete implicitly point to a place in the +367 document (where the two were split). This moves that point (by +368 popping items from one and pushing them onto the other). It moves +369 the point to try to find a place where unbalanced_start applies. +370 +371 As an example:: +372 +373 >>> unbalanced_start = ['<div>'] +374 >>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>'] +375 >>> pre, post = doc[:3], doc[3:] +376 >>> pre, post +377 (['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>']) +378 >>> locate_unbalanced_start(unbalanced_start, pre, post) +379 >>> pre, post +380 (['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>']) +381 +382 As you can see, we moved the point so that the dangling <div> that +383 we found will be effectively replaced by the div in the original +384 document. If this doesn't work out, we just throw away +385 unbalanced_start without doing anything. +386 """ +387 while 1: +388 if not unbalanced_start: +389 # We have totally succeeded in finding the position +390 break +391 finding = unbalanced_start[0] +392 finding_name = finding.split()[0].strip('<>') +393 if not post_delete: +394 break +395 next = post_delete[0] +396 if next is DEL_START or not next.startswith('<'): +397 # Reached a word, we can't move the delete text forward +398 break +399 if next[1] == '/': +400 # Reached a closing tag, can we go further? Maybe not... +401 break +402 name = next.split()[0].strip('<>') +403 if name == 'ins': +404 # Can't move into an insert +405 break +406 assert name != 'del', ( +407 "Unexpected delete tag: %r" % next) +408 if name == finding_name: +409 unbalanced_start.pop(0) +410 pre_delete.append(post_delete.pop(0)) +411 else: +412 # Found a tag that doesn't match +413 break +
414 +
415 -def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): +
416 """ like locate_unbalanced_start, except handling end tags and +417 possibly moving the point earlier in the document. """ +418 while 1: +419 if not unbalanced_end: +420 # Success +421 break +422 finding = unbalanced_end[-1] +423 finding_name = finding.split()[0].strip('<>/') +424 if not pre_delete: +425 break +426 next = pre_delete[-1] +427 if next is DEL_END or not next.startswith('</'): +428 # A word or a start tag +429 break +430 name = next.split()[0].strip('<>/') +431 if name == 'ins' or name == 'del': +432 # Can't move into an insert or delete +433 break +434 if name == finding_name: +435 unbalanced_end.pop() +436 post_delete.insert(0, pre_delete.pop()) +437 else: +438 # Found a tag that doesn't match +439 break +
440 +
441 -class token(_unicode): +
442 """ Represents a diffable token, generally a word that is displayed to +443 the user. Opening tags are attached to this token when they are +444 adjacent (pre_tags) and closing tags that follow the word +445 (post_tags). Some exceptions occur when there are empty tags +446 adjacent to a word, so there may be close tags in pre_tags, or +447 open tags in post_tags. +448 +449 We also keep track of whether the word was originally followed by +450 whitespace, even though we do not want to treat the word as +451 equivalent to a similar word that does not have a trailing +452 space.""" +453 +454 # When this is true, the token will be eliminated from the +455 # displayed diff if no change has occurred: +456 hide_when_equal = False +457 +
458 - def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): +
459 obj = _unicode.__new__(cls, text) +460 +461 if pre_tags is not None: +462 obj.pre_tags = pre_tags +463 else: +464 obj.pre_tags = [] +465 +466 if post_tags is not None: +467 obj.post_tags = post_tags +468 else: +469 obj.post_tags = [] +470 +471 obj.trailing_whitespace = trailing_whitespace +472 +473 return obj +
474 +
475 - def __repr__(self): +
476 return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags, +477 self.post_tags, self.trailing_whitespace) +
478 +
479 - def html(self): +
480 return _unicode(self) +
481 +
482 -class tag_token(token): +
483 +484 """ Represents a token that is actually a tag. Currently this is just +485 the <img> tag, which takes up visible space just like a word but +486 is only represented in a document by a tag. """ +487 +
488 - def __new__(cls, tag, data, html_repr, pre_tags=None, +489 post_tags=None, trailing_whitespace=""): +
490 obj = token.__new__(cls, "%s: %s" % (type, data), +491 pre_tags=pre_tags, +492 post_tags=post_tags, +493 trailing_whitespace=trailing_whitespace) +494 obj.tag = tag +495 obj.data = data +496 obj.html_repr = html_repr +497 return obj +
498 +
499 - def __repr__(self): +
500 return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % ( +501 self.tag, +502 self.data, +503 self.html_repr, +504 self.pre_tags, +505 self.post_tags, +506 self.trailing_whitespace) +
507 - def html(self): +
508 return self.html_repr +
509 +
510 -class href_token(token): +
511 +512 """ Represents the href in an anchor tag. Unlike other words, we only +513 show the href when it changes. """ +514 +515 hide_when_equal = True +516 +
517 - def html(self): +
518 return ' Link: %s' % self +
519 +
520 -def tokenize(html, include_hrefs=True): +
521 """ +522 Parse the given HTML and returns token objects (words with attached tags). +523 +524 This parses only the content of a page; anything in the head is +525 ignored, and the <head> and <body> elements are themselves +526 optional. The content is then parsed by lxml, which ensures the +527 validity of the resulting parsed document (though lxml may make +528 incorrect guesses when the markup is particular bad). +529 +530 <ins> and <del> tags are also eliminated from the document, as +531 that gets confusing. +532 +533 If include_hrefs is true, then the href attribute of <a> tags is +534 included as a special kind of diffable token.""" +535 if etree.iselement(html): +536 body_el = html +537 else: +538 body_el = parse_html(html, cleanup=True) +539 # Then we split the document into text chunks for each tag, word, and end tag: +540 chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs) +541 # Finally re-joining them into token objects: +542 return fixup_chunks(chunks) +
543 +
544 -def parse_html(html, cleanup=True): +
545 """ +546 Parses an HTML fragment, returning an lxml element. Note that the HTML will be +547 wrapped in a <div> tag that was not in the original document. +548 +549 If cleanup is true, make sure there's no <head> or <body>, and get +550 rid of any <ins> and <del> tags. +551 """ +552 if cleanup: +553 # This removes any extra markup or structure like <head>: +554 html = cleanup_html(html) +555 return fragment_fromstring(html, create_parent=True) +
556 +557 _body_re = re.compile(r'<body.*?>', re.I|re.S) +558 _end_body_re = re.compile(r'</body.*?>', re.I|re.S) +559 _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S) +560 +
561 -def cleanup_html(html): +
562 """ This 'cleans' the HTML, meaning that any page structure is removed +563 (only the contents of <body> are used, if there is any <body). +564 Also <ins> and <del> tags are removed. """ +565 match = _body_re.search(html) +566 if match: +567 html = html[match.end():] +568 match = _end_body_re.search(html) +569 if match: +570 html = html[:match.start()] +571 html = _ins_del_re.sub('', html) +572 return html +
573 +574 +575 end_whitespace_re = re.compile(r'[ \t\n\r]$') +576 +
578 """ +579 This function takes a word, such as 'test\n\n' and returns ('test','\n\n') +580 """ +581 stripped_length = len(word.rstrip()) +582 return word[0:stripped_length], word[stripped_length:] +
583 +584 +
585 -def fixup_chunks(chunks): +
586 """ +587 This function takes a list of chunks and produces a list of tokens. +588 """ +589 tag_accum = [] +590 cur_word = None +591 result = [] +592 for chunk in chunks: +593 if isinstance(chunk, tuple): +594 if chunk[0] == 'img': +595 src = chunk[1] +596 tag, trailing_whitespace = split_trailing_whitespace(chunk[2]) +597 cur_word = tag_token('img', src, html_repr=tag, +598 pre_tags=tag_accum, +599 trailing_whitespace=trailing_whitespace) +600 tag_accum = [] +601 result.append(cur_word) +602 +603 elif chunk[0] == 'href': +604 href = chunk[1] +605 cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ") +606 tag_accum = [] +607 result.append(cur_word) +608 continue +609 +610 if is_word(chunk): +611 chunk, trailing_whitespace = split_trailing_whitespace(chunk) +612 cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace) +613 tag_accum = [] +614 result.append(cur_word) +615 +616 elif is_start_tag(chunk): +617 tag_accum.append(chunk) +618 +619 elif is_end_tag(chunk): +620 if tag_accum: +621 tag_accum.append(chunk) +622 else: +623 assert cur_word, ( +624 "Weird state, cur_word=%r, result=%r, chunks=%r of %r" +625 % (cur_word, result, chunk, chunks)) +626 cur_word.post_tags.append(chunk) +627 else: +628 assert False +629 +630 if not result: +631 return [token('', pre_tags=tag_accum)] +632 else: +633 result[-1].post_tags.extend(tag_accum) +634 +635 return result +
636 +637 +638 # All the tags in HTML that don't require end tags: +639 empty_tags = ( +640 'param', 'img', 'area', 'br', 'basefont', 'input', +641 'base', 'meta', 'link', 'col') +642 +643 block_level_tags = ( +644 'address', +645 'blockquote', +646 'center', +647 'dir', +648 'div', +649 'dl', +650 'fieldset', +651 'form', +652 'h1', +653 'h2', +654 'h3', +655 'h4', +656 'h5', +657 'h6', +658 'hr', +659 'isindex', +660 'menu', +661 'noframes', +662 'noscript', +663 'ol', +664 'p', +665 'pre', +666 'table', +667 'ul', +668 ) +669 +670 block_level_container_tags = ( +671 'dd', +672 'dt', +673 'frameset', +674 'li', +675 'tbody', +676 'td', +677 'tfoot', +678 'th', +679 'thead', +680 'tr', +681 ) +682 +683 +
684 -def flatten_el(el, include_hrefs, skip_tag=False): +
685 """ Takes an lxml element el, and generates all the text chunks for +686 that tag. Each start tag is a chunk, each word is a chunk, and each +687 end tag is a chunk. +688 +689 If skip_tag is true, then the outermost container tag is +690 not returned (just its contents).""" +691 if not skip_tag: +692 if el.tag == 'img': +693 yield ('img', el.get('src'), start_tag(el)) +694 else: +695 yield start_tag(el) +696 if el.tag in empty_tags and not el.text and not len(el) and not el.tail: +697 return +698 start_words = split_words(el.text) +699 for word in start_words: +700 yield html_escape(word) +701 for child in el: +702 for item in flatten_el(child, include_hrefs=include_hrefs): +703 yield item +704 if el.tag == 'a' and el.get('href') and include_hrefs: +705 yield ('href', el.get('href')) +706 if not skip_tag: +707 yield end_tag(el) +708 end_words = split_words(el.tail) +709 for word in end_words: +710 yield html_escape(word) +
711 +712 split_words_re = re.compile(r'\S+(?:\s+|$)', re.U) +713 +
714 -def split_words(text): +
715 """ Splits some text into words. Includes trailing whitespace +716 on each word when appropriate. """ +717 if not text or not text.strip(): +718 return [] +719 +720 words = split_words_re.findall(text) +721 return words +
722 +723 start_whitespace_re = re.compile(r'^[ \t\n\r]') +724 +
725 -def start_tag(el): +
726 """ +727 The text representation of the start tag for a tag. +728 """ +729 return '<%s%s>' % ( +730 el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True)) +731 for name, value in el.attrib.items()])) +
732 +
733 -def end_tag(el): +
734 """ The text representation of an end tag for a tag. Includes +735 trailing whitespace when appropriate. """ +736 if el.tail and start_whitespace_re.search(el.tail): +737 extra = ' ' +738 else: +739 extra = '' +740 return '</%s>%s' % (el.tag, extra) +
741 +
742 -def is_word(tok): +
743 return not tok.startswith('<') +
744 +
745 -def is_end_tag(tok): +
746 return tok.startswith('</') +
747 +
748 -def is_start_tag(tok): +
749 return tok.startswith('<') and not tok.startswith('</') +
750 +
751 -def fixup_ins_del_tags(html): +
752 """ Given an html string, move any <ins> or <del> tags inside of any +753 block-level elements, e.g. transform <ins><p>word</p></ins> to +754 <p><ins>word</ins></p> """ +755 doc = parse_html(html, cleanup=False) +756 _fixup_ins_del_tags(doc) +757 html = serialize_html_fragment(doc, skip_outer=True) +758 return html +
759 +
760 -def serialize_html_fragment(el, skip_outer=False): +
761 """ Serialize a single lxml element as HTML. The serialized form +762 includes the elements tail. +763 +764 If skip_outer is true, then don't serialize the outermost tag +765 """ +766 assert not isinstance(el, basestring), ( +767 "You should pass in an element, not a string like %r" % el) +768 html = etree.tostring(el, method="html", encoding=_unicode) +769 if skip_outer: +770 # Get rid of the extra starting tag: +771 html = html[html.find('>')+1:] +772 # Get rid of the extra end tag: +773 html = html[:html.rfind('<')] +774 return html.strip() +775 else: +776 return html +
777 +
778 -def _fixup_ins_del_tags(doc): +
779 """fixup_ins_del_tags that works on an lxml document in-place +780 """ +781 for tag in ['ins', 'del']: +782 for el in doc.xpath('descendant-or-self::%s' % tag): +783 if not _contains_block_level_tag(el): +784 continue +785 _move_el_inside_block(el, tag=tag) +786 el.drop_tag() +
787 #_merge_element_contents(el) +788 +
790 """True if the element contains any block-level elements, like <p>, <td>, etc. +791 """ +792 if el.tag in block_level_tags or el.tag in block_level_container_tags: +793 return True +794 for child in el: +795 if _contains_block_level_tag(child): +796 return True +797 return False +
798 +
799 -def _move_el_inside_block(el, tag): +
800 """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags +801 and moves them inside any block-level tags. """ +802 for child in el: +803 if _contains_block_level_tag(child): +804 break +805 else: +806 # No block-level tags in any child +807 children_tag = etree.Element(tag) +808 children_tag.text = el.text +809 el.text = None +810 children_tag.extend(list(el)) +811 el[:] = [children_tag] +812 return +813 for child in list(el): +814 if _contains_block_level_tag(child): +815 _move_el_inside_block(child, tag) +816 if child.tail: +817 tail_tag = etree.Element(tag) +818 tail_tag.text = child.tail +819 child.tail = None +820 el.insert(el.index(child)+1, tail_tag) +821 else: +822 child_tag = etree.Element(tag) +823 el.replace(child, child_tag) +824 child_tag.append(child) +825 if el.text: +826 text_tag = etree.Element(tag) +827 text_tag.text = el.text +828 el.text = None +829 el.insert(0, text_tag) +
830 +
832 """ +833 Removes an element, but merges its contents into its place, e.g., +834 given <p>Hi <i>there!</i></p>, if you remove the <i> element you get +835 <p>Hi there!</p> +836 """ +837 parent = el.getparent() +838 text = el.text or '' +839 if el.tail: +840 if not len(el): +841 text += el.tail +842 else: +843 if el[-1].tail: +844 el[-1].tail += el.tail +845 else: +846 el[-1].tail = el.tail +847 index = parent.index(el) +848 if text: +849 if index == 0: +850 previous = None +851 else: +852 previous = parent[index-1] +853 if previous is None: +854 if parent.text: +855 parent.text += text +856 else: +857 parent.text = text +858 else: +859 if previous.tail: +860 previous.tail += text +861 else: +862 previous.tail = text +863 parent[index:index+1] = el.getchildren() +
864 +
865 -class InsensitiveSequenceMatcher(difflib.SequenceMatcher): +
866 """ +867 Acts like SequenceMatcher, but tries not to find very small equal +868 blocks amidst large spans of changes +869 """ +870 +871 threshold = 2 +872 +
873 - def get_matching_blocks(self): +
874 size = min(len(self.b), len(self.b)) +875 threshold = min(self.threshold, size / 4) +876 actual = difflib.SequenceMatcher.get_matching_blocks(self) +877 return [item for item in actual +878 if item[2] > threshold +879 or not item[2]] +
880 +881 if __name__ == '__main__': +882 from lxml.html import _diffcommand +883 _diffcommand.main() +884 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..ea4bd45c --- /dev/null +++ b/doc/html/api/lxml.html.diff.DEL_END-class.html @@ -0,0 +1,142 @@ + + + + + lxml.html.diff.DEL_END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class DEL_END + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DEL_END

source code

+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'DEL_END' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..a67d616d --- /dev/null +++ b/doc/html/api/lxml.html.diff.DEL_START-class.html @@ -0,0 +1,142 @@ + + + + + lxml.html.diff.DEL_START + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class DEL_START + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DEL_START

source code

+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'DEL_START' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..773a50d5 --- /dev/null +++ b/doc/html/api/lxml.html.diff.InsensitiveSequenceMatcher-class.html @@ -0,0 +1,265 @@ + + + + + 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 +
+   + + __qualname__ = 'InsensitiveSequenceMatcher' +
+ + + + + + +
+ + + + + +
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()
+[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=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 00000000..b838fe64 --- /dev/null +++ b/doc/html/api/lxml.html.diff.NoDeletes-class.html @@ -0,0 +1,230 @@ + + + + + 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__, + __unicode__ +

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'NoDeletes' +
+ + + + + + + + + +
+ + + + + +
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 00000000..a8743057 --- /dev/null +++ b/doc/html/api/lxml.html.diff.href_token-class.html @@ -0,0 +1,348 @@ + + + + + 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: + __new__, + __repr__ +

+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __format__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __sizeof__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + format, + 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 unicode (private): + _formatter_field_name_split, + _formatter_parser +

+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + hide_when_equal = True +
+   + + __qualname__ = 'href_token' +
+ + + + + + + + + +
+ + + + + +
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 00000000..6c7eb669 --- /dev/null +++ b/doc/html/api/lxml.html.diff.tag_token-class.html @@ -0,0 +1,438 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(cls, + tag, + data, + html_repr, + pre_tags=None, + post_tags=None, + trailing_whitespace="") + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
html(self) + source code + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __format__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __sizeof__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + format, + 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 unicode (private): + _formatter_field_name_split, + _formatter_parser +

+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'tag_token' +
+

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="") +

+
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 00000000..5c7365ca --- /dev/null +++ b/doc/html/api/lxml.html.diff.token-class.html @@ -0,0 +1,423 @@ + + + + + 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]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(cls, + text, + pre_tags=None, + post_tags=None, + trailing_whitespace="") + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
html(self) + source code + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __format__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __sizeof__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + format, + 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 unicode (private): + _formatter_field_name_split, + _formatter_parser +

+

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

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + hide_when_equal = False +
+   + + __qualname__ = 'token' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

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

__new__(cls, + text, + pre_tags=None, + post_tags=None, + trailing_whitespace="") +

+
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 00000000..36a4083a --- /dev/null +++ b/doc/html/api/lxml.html.formfill-module.html @@ -0,0 +1,587 @@ + + + + + lxml.html.formfill + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module formfill + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module formfill

source code

+ + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + basestring
+ str(object='') -> string +
+   + + 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=<lxml.html.formfill.DefaultErrorCreator object>) + 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 = <lxml.html.formfill.DefaultErrorCreato... +
+   + + __package__ = 'lxml.html' +
+   + + _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
+
+
+
+
+
+ +
+ +
+

default_error_creator

+ +
+
+
+
Value:
+
+<lxml.html.formfill.DefaultErrorCreator object>
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..bbdbaeb3 --- /dev/null +++ b/doc/html/api/lxml.html.formfill-pysrc.html @@ -0,0 +1,819 @@ + + + + + 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, XHTML_NAMESPACE 
+  3  from lxml.html import _forms_xpath, _options_xpath, _nons, _transform_result 
+  4  from lxml.html import defs 
+  5  import copy 
+  6   
+  7  try: 
+  8      basestring 
+  9  except NameError: 
+ 10      # Python 3 
+ 11      basestring = str 
+ 12   
+ 13  __all__ = ['FormNotFound', 'fill_form', 'fill_form_html', 
+ 14             'insert_errors', 'insert_errors_html', 
+ 15             'DefaultErrorCreator'] 
+ 16   
+
17 -class FormNotFound(LookupError): +
18 """ + 19 Raised when no form can be found + 20 """ +
21 + 22 _form_name_xpath = XPath('descendant-or-self::form[name=$name]|descendant-or-self::x:form[name=$name]', namespaces={'x':XHTML_NAMESPACE}) + 23 _input_xpath = XPath('|'.join(['descendant-or-self::'+_tag for _tag in ('input','select','textarea','x:input','x:select','x:textarea')]), + 24 namespaces={'x':XHTML_NAMESPACE}) + 25 _label_for_xpath = XPath('//label[@for=$for_id]|//x:label[@for=$for_id]', + 26 namespaces={'x':XHTML_NAMESPACE}) + 27 _name_xpath = XPath('descendant-or-self::*[@name=$name]') + 28 +
29 -def fill_form( + 30 el, + 31 values, + 32 form_id=None, + 33 form_index=None, + 34 ): +
35 el = _find_form(el, form_id=form_id, form_index=form_index) + 36 _fill_form(el, values) +
37 +
38 -def fill_form_html(html, values, form_id=None, form_index=None): +
39 result_type = type(html) + 40 if isinstance(html, basestring): + 41 doc = fromstring(html) + 42 else: + 43 doc = copy.deepcopy(html) + 44 fill_form(doc, values, form_id=form_id, form_index=form_index) + 45 return _transform_result(result_type, doc) +
46 +
47 -def _fill_form(el, values): +
48 counts = {} + 49 if hasattr(values, 'mixed'): + 50 # For Paste request parameters + 51 values = values.mixed() + 52 inputs = _input_xpath(el) + 53 for input in inputs: + 54 name = input.get('name') + 55 if not name: + 56 continue + 57 if _takes_multiple(input): + 58 value = values.get(name, []) + 59 if not isinstance(value, (list, tuple)): + 60 value = [value] + 61 _fill_multiple(input, value) + 62 elif name not in values: + 63 continue + 64 else: + 65 index = counts.get(name, 0) + 66 counts[name] = index + 1 + 67 value = values[name] + 68 if isinstance(value, (list, tuple)): + 69 try: + 70 value = value[index] + 71 except IndexError: + 72 continue + 73 elif index > 0: + 74 continue + 75 _fill_single(input, value) +
76 +
77 -def _takes_multiple(input): +
78 if _nons(input.tag) == 'select' and input.get('multiple'): + 79 # FIXME: multiple="0"? + 80 return True + 81 type = input.get('type', '').lower() + 82 if type in ('radio', 'checkbox'): + 83 return True + 84 return False +
85 +
86 -def _fill_multiple(input, value): +
87 type = input.get('type', '').lower() + 88 if type == 'checkbox': + 89 v = input.get('value') + 90 if v is None: + 91 if not value: + 92 result = False + 93 else: + 94 result = value[0] + 95 if isinstance(value, basestring): + 96 # The only valid "on" value for an unnamed checkbox is 'on' + 97 result = result == 'on' + 98 _check(input, result) + 99 else: +100 _check(input, v in value) +101 elif type == 'radio': +102 v = input.get('value') +103 _check(input, v in value) +104 else: +105 assert _nons(input.tag) == 'select' +106 for option in _options_xpath(input): +107 v = option.get('value') +108 if v is None: +109 # This seems to be the default, at least on IE +110 # FIXME: but I'm not sure +111 v = option.text_content() +112 _select(option, v in value) +
113 +
114 -def _check(el, check): +
115 if check: +116 el.set('checked', '') +117 else: +118 if 'checked' in el.attrib: +119 del el.attrib['checked'] +
120 +
121 -def _select(el, select): +
122 if select: +123 el.set('selected', '') +124 else: +125 if 'selected' in el.attrib: +126 del el.attrib['selected'] +
127 +
128 -def _fill_single(input, value): +
129 if _nons(input.tag) == 'textarea': +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 00000000..dfaf9436 --- /dev/null +++ b/doc/html/api/lxml.html.formfill.DefaultErrorCreator-class.html @@ -0,0 +1,326 @@ + + + + + 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 help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + el, + is_block, + message) + source code + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..6b86537d --- /dev/null +++ b/doc/html/api/lxml.html.formfill.FormNotFound-class.html @@ -0,0 +1,208 @@ + + + + + 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__, + __unicode__ +

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..c22c4829 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser-module.html @@ -0,0 +1,498 @@ + + + + + lxml.html.html5parser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module html5parser

source code

+An interface to html5lib that mimics the lxml.html interface. + + + + + + + + + + + + + +
+ + + + + +
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=None, + parser=None)
+ Parse a whole document into a string.
+ source code + +
+ +
+   + + + + + + +
fragments_fromstring(html, + no_leading_text=False, + guess_charset=None, + parser=None)
+ Parses several HTML elements, returning a list of elements.
+ source code + +
+ +
+   + + + + + + +
fragment_fromstring(html, + create_parent=False, + guess_charset=None, + 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=None, + parser=None)
+ Parse the html, returning a single element/document.
+ source code + +
+ +
+   + + + + + + +
parse(filename_url_or_file, + guess_charset=None, + parser=None)
+ 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.
+ source code + +
+ +
+   + + + + + + +
_looks_like_url(str) + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + xhtml_parser = XHTMLParser() +
+   + + html_parser = <lxml.html.html5parser.HTMLParser object> +
+   + + __package__ = 'lxml.html' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

document_fromstring(html, + guess_charset=None, + parser=None) +

+
source code  +
+ +

Parse a whole document into a string.

+

If guess_charset is true, or if the input is not Unicode but a +byte string, the chardet library will perform charset guessing +on the string.

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

fragments_fromstring(html, + no_leading_text=False, + guess_charset=None, + 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, the chardet library will perform charset +guessing on the string.

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

fragment_fromstring(html, + create_parent=False, + guess_charset=None, + 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. In +this case, leading or trailing text is allowed.

+

If guess_charset is true, the chardet library will perform charset +guessing on the string.

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

fromstring(html, + guess_charset=None, + 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)

+

If guess_charset is true, or if the input is not Unicode but a +byte string, the chardet library will perform charset guessing +on the string.

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

parse(filename_url_or_file, + guess_charset=None, + 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.

+

If guess_charset is true, the useChardet option is passed into +html5lib to enable character detection. This option is on by default +when parsing from URLs, off by default when parsing from file(-like) +objects (which tend to return Unicode more often than not), and on by +default when parsing from a file path (which is read in binary mode).

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..e4695ce5 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser-pysrc.html @@ -0,0 +1,721 @@ + + + + + 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 that mimics the lxml.html interface. 
+  3  """ 
+  4  import sys 
+  5  import string 
+  6   
+  7  from html5lib import HTMLParser as _HTMLParser 
+  8  from html5lib.treebuilders.etree_lxml import TreeBuilder 
+  9  from lxml import etree 
+ 10  from lxml.html import Element, XHTML_NAMESPACE, _contains_block_level_tag 
+ 11   
+ 12  # python3 compatibility 
+ 13  try: 
+ 14      _strings = basestring 
+ 15  except NameError: 
+ 16      _strings = (bytes, str) 
+ 17  try: 
+ 18      from urllib2 import urlopen 
+ 19  except ImportError: 
+ 20      from urllib.request import urlopen 
+ 21  try: 
+ 22      from urlparse import urlparse 
+ 23  except ImportError: 
+ 24      from urllib.parse import urlparse 
+ 25   
+ 26   
+
27 -class HTMLParser(_HTMLParser): +
28 """An html5lib HTML parser with lxml as tree.""" + 29 +
30 - def __init__(self, strict=False, **kwargs): +
31 _HTMLParser.__init__(self, strict=strict, tree=TreeBuilder, **kwargs) +
32 + 33 + 34 try: + 35 from html5lib import XHTMLParser as _XHTMLParser + 36 except ImportError: + 37 pass + 38 else: +
39 - class XHTMLParser(_XHTMLParser): +
40 """An html5lib XHTML Parser with lxml as tree.""" + 41 +
42 - def __init__(self, strict=False, **kwargs): +
43 _XHTMLParser.__init__(self, strict=strict, tree=TreeBuilder, **kwargs) +
44 + 45 xhtml_parser = XHTMLParser() + 46 + 47 +
48 -def _find_tag(tree, tag): +
49 elem = tree.find(tag) + 50 if elem is not None: + 51 return elem + 52 return tree.find('{%s}%s' % (XHTML_NAMESPACE, tag)) +
53 + 54 +
55 -def document_fromstring(html, guess_charset=None, parser=None): +
56 """ + 57 Parse a whole document into a string. + 58 + 59 If `guess_charset` is true, or if the input is not Unicode but a + 60 byte string, the `chardet` library will perform charset guessing + 61 on the string. + 62 """ + 63 if not isinstance(html, _strings): + 64 raise TypeError('string required') + 65 + 66 if parser is None: + 67 parser = html_parser + 68 + 69 options = {} + 70 if guess_charset is None and isinstance(html, bytes): + 71 # html5lib does not accept useChardet as an argument, if it + 72 # detected the html argument would produce unicode objects. + 73 guess_charset = True + 74 if guess_charset is not None: + 75 options['useChardet'] = guess_charset + 76 return parser.parse(html, **options).getroot() +
77 + 78 +
79 -def fragments_fromstring(html, no_leading_text=False, + 80 guess_charset=None, parser=None): +
81 """Parses several HTML elements, returning a list of elements. + 82 + 83 The first item in the list may be a string. If no_leading_text is true, + 84 then it will be an error if there is leading text, and it will always be + 85 a list of only elements. + 86 + 87 If `guess_charset` is true, the `chardet` library will perform charset + 88 guessing on the string. + 89 """ + 90 if not isinstance(html, _strings): + 91 raise TypeError('string required') + 92 + 93 if parser is None: + 94 parser = html_parser + 95 + 96 options = {} + 97 if guess_charset is None and isinstance(html, bytes): + 98 # html5lib does not accept useChardet as an argument, if it + 99 # detected the html argument would produce unicode objects. +100 guess_charset = False +101 if guess_charset is not None: +102 options['useChardet'] = guess_charset +103 children = parser.parseFragment(html, 'div', **options) +104 if children and isinstance(children[0], _strings): +105 if no_leading_text: +106 if children[0].strip(): +107 raise etree.ParserError('There is leading text: %r' % +108 children[0]) +109 del children[0] +110 return children +
111 +112 +
113 -def fragment_fromstring(html, create_parent=False, +114 guess_charset=None, parser=None): +
115 """Parses a single HTML element; it is an error if there is more than +116 one element, or if anything but whitespace precedes or follows the +117 element. +118 +119 If 'create_parent' is true (or is a tag name) then a parent node +120 will be created to encapsulate the HTML in a single element. In +121 this case, leading or trailing text is allowed. +122 +123 If `guess_charset` is true, the `chardet` library will perform charset +124 guessing on the string. +125 """ +126 if not isinstance(html, _strings): +127 raise TypeError('string required') +128 +129 accept_leading_text = bool(create_parent) +130 +131 elements = fragments_fromstring( +132 html, guess_charset=guess_charset, parser=parser, +133 no_leading_text=not accept_leading_text) +134 +135 if create_parent: +136 if not isinstance(create_parent, _strings): +137 create_parent = 'div' +138 new_root = Element(create_parent) +139 if elements: +140 if isinstance(elements[0], _strings): +141 new_root.text = elements[0] +142 del elements[0] +143 new_root.extend(elements) +144 return new_root +145 +146 if not elements: +147 raise etree.ParserError('No elements found') +148 if len(elements) > 1: +149 raise etree.ParserError('Multiple elements found') +150 result = elements[0] +151 if result.tail and result.tail.strip(): +152 raise etree.ParserError('Element followed by text: %r' % result.tail) +153 result.tail = None +154 return result +
155 +156 +
157 -def fromstring(html, guess_charset=None, parser=None): +
158 """Parse the html, returning a single element/document. +159 +160 This tries to minimally parse the chunk of text, without knowing if it +161 is a fragment or a document. +162 +163 'base_url' will set the document's base_url attribute (and the tree's +164 docinfo.URL) +165 +166 If `guess_charset` is true, or if the input is not Unicode but a +167 byte string, the `chardet` library will perform charset guessing +168 on the string. +169 """ +170 if not isinstance(html, _strings): +171 raise TypeError('string required') +172 doc = document_fromstring(html, parser=parser, +173 guess_charset=guess_charset) +174 +175 # document starts with doctype or <html>, full document! +176 start = html[:50] +177 if isinstance(start, bytes): +178 # Allow text comparison in python3. +179 # Decode as ascii, that also covers latin-1 and utf-8 for the +180 # characters we need. +181 start = start.decode('ascii', 'replace') +182 +183 start = start.lstrip().lower() +184 if start.startswith('<html') or start.startswith('<!doctype'): +185 return doc +186 +187 head = _find_tag(doc, 'head') +188 +189 # if the head is not empty we have a full document +190 if len(head): +191 return doc +192 +193 body = _find_tag(doc, 'body') +194 +195 # The body has just one element, so it was probably a single +196 # element passed in +197 if (len(body) == 1 and (not body.text or not body.text.strip()) +198 and (not body[-1].tail or not body[-1].tail.strip())): +199 return body[0] +200 +201 # Now we have a body which represents a bunch of tags which have the +202 # content that was passed in. We will create a fake container, which +203 # is the body tag, except <body> implies too much structure. +204 if _contains_block_level_tag(body): +205 body.tag = 'div' +206 else: +207 body.tag = 'span' +208 return body +
209 +210 +
211 -def parse(filename_url_or_file, guess_charset=None, parser=None): +
212 """Parse a filename, URL, or file-like object into an HTML document +213 tree. Note: this returns a tree, not an element. Use +214 ``parse(...).getroot()`` to get the document root. +215 +216 If ``guess_charset`` is true, the ``useChardet`` option is passed into +217 html5lib to enable character detection. This option is on by default +218 when parsing from URLs, off by default when parsing from file(-like) +219 objects (which tend to return Unicode more often than not), and on by +220 default when parsing from a file path (which is read in binary mode). +221 """ +222 if parser is None: +223 parser = html_parser +224 if not isinstance(filename_url_or_file, _strings): +225 fp = filename_url_or_file +226 if guess_charset is None: +227 # assume that file-like objects return Unicode more often than bytes +228 guess_charset = False +229 elif _looks_like_url(filename_url_or_file): +230 fp = urlopen(filename_url_or_file) +231 if guess_charset is None: +232 # assume that URLs return bytes +233 guess_charset = True +234 else: +235 fp = open(filename_url_or_file, 'rb') +236 if guess_charset is None: +237 guess_charset = True +238 +239 options = {} +240 # html5lib does not accept useChardet as an argument, if it +241 # detected the html argument would produce unicode objects. +242 if guess_charset: +243 options['useChardet'] = guess_charset +244 return parser.parse(fp, **options) +
245 +246 +
247 -def _looks_like_url(str): +
248 scheme = urlparse(str)[0] +249 if not scheme: +250 return False +251 elif (sys.platform == 'win32' and +252 scheme in string.ascii_letters +253 and len(scheme) == 1): +254 # looks like a 'normal' absolute path +255 return False +256 else: +257 return True +
258 +259 +260 html_parser = HTMLParser() +261 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..36d55183 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser.HTMLParser-class.html @@ -0,0 +1,279 @@ + + + + + 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, + **kwargs)
+ strict - raise an exception when a parse error is encountered
+ source code + +
+ +
+

Inherited from html5lib.html5parser.HTMLParser: + adjustForeignAttributes, + adjustMathMLAttributes, + adjustSVGAttributes, + isHTMLIntegrationPoint, + isMathMLTextIntegrationPoint, + mainLoop, + normalizeToken, + normalizedTokens, + parse, + parseError, + parseFragment, + parseRCDataRawtext, + reparseTokenNormal, + reset, + resetInsertionMode +

+

Inherited from html5lib.html5parser.HTMLParser (private): + _parse +

+

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

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

Inherited from html5lib.html5parser.HTMLParser: + documentEncoding +

+

Inherited from object: + __class__ +

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

__init__(self, + strict=False, + **kwargs) +
(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)

+
+
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 00000000..f50699e1 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser.XHTMLParser-class.html @@ -0,0 +1,162 @@ + + + + + lxml.html.html5parser.XHTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser :: + Class XHTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XHTMLParser

source code

+
+html5lib.XHTMLParser --+
+                       |
+                      XHTMLParser
+
+ +
+An html5lib XHTML Parser with lxml as tree. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + strict=False, + **kwargs) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..178d1916 --- /dev/null +++ b/doc/html/api/lxml.html.soupparser-module.html @@ -0,0 +1,510 @@ + + + + + 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. + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + _PseudoTag +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 + +
+ +
+   + + + + + + +
_parse_doctype_declaration(...)
+ match(string[, pos[, endpos]]) --> match object or None. +Matches zero or more characters at the beginning of the string
+ source code + +
+ +
+   + + + + + + +
_convert_tree(beautiful_soup_tree, + makeelement) + source code + +
+ +
+   + + + + + + +
_init_node_converters(makeelement) + 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 + +
+ +
+ character + + + + + + +
unichr(i)
+ Return a string of one character with ordinal i; 0 <= i < 256.
+ + +
+ +
+   + + + + + + +
unescape(string) + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + _DECLARATION_OR_DOCTYPE = (<class 'bs4.element.Declaration'>, ... +
+   + + __package__ = 'lxml.html' +
+ + + + + + +
+ + + + + +
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]
+
+ +
+ +
+

_DECLARATION_OR_DOCTYPE

+ +
+
+
+
Value:
+
+(<class 'bs4.element.Declaration'>, <class 'bs4.element.Doctype'>)
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9458fff4 --- /dev/null +++ b/doc/html/api/lxml.html.soupparser-pysrc.html @@ -0,0 +1,581 @@ + + + + + lxml.html.soupparser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module soupparser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.soupparser

+
+  1  """External interface to the BeautifulSoup HTML parser. 
+  2  """ 
+  3   
+  4  __all__ = ["fromstring", "parse", "convert_tree"] 
+  5   
+  6  import re 
+  7  from lxml import etree, html 
+  8   
+  9  try: 
+ 10      from bs4 import ( 
+ 11          BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString, 
+ 12          Declaration, Doctype) 
+ 13      _DECLARATION_OR_DOCTYPE = (Declaration, Doctype) 
+ 14  except ImportError: 
+ 15      from BeautifulSoup import ( 
+ 16          BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString, 
+ 17          Declaration) 
+ 18      _DECLARATION_OR_DOCTYPE = Declaration 
+
19 + 20 + 21 -def fromstring(data, beautifulsoup=None, makeelement=None, **bsargs): +
22 """Parse a string of HTML data into an Element tree using the + 23 BeautifulSoup parser. + 24 + 25 Returns the root ``<html>`` Element of the tree. + 26 + 27 You can pass a different BeautifulSoup parser through the + 28 `beautifulsoup` keyword, and a diffent Element factory function + 29 through the `makeelement` keyword. By default, the standard + 30 ``BeautifulSoup`` class and the default factory of `lxml.html` are + 31 used. + 32 """ + 33 return _parse(data, beautifulsoup, makeelement, **bsargs) +
34 +
35 + 36 -def parse(file, beautifulsoup=None, makeelement=None, **bsargs): +
37 """Parse a file into an ElemenTree using the BeautifulSoup parser. + 38 + 39 You can pass a different BeautifulSoup parser through the + 40 `beautifulsoup` keyword, and a diffent Element factory function + 41 through the `makeelement` keyword. By default, the standard + 42 ``BeautifulSoup`` class and the default factory of `lxml.html` are + 43 used. + 44 """ + 45 if not hasattr(file, 'read'): + 46 file = open(file) + 47 root = _parse(file, beautifulsoup, makeelement, **bsargs) + 48 return etree.ElementTree(root) +
49 +
50 + 51 -def convert_tree(beautiful_soup_tree, makeelement=None): +
52 """Convert a BeautifulSoup tree to a list of Element trees. + 53 + 54 Returns a list instead of a single root Element to support + 55 HTML-like soup with more than one root element. + 56 + 57 You can pass a different Element factory through the `makeelement` + 58 keyword. + 59 """ + 60 root = _convert_tree(beautiful_soup_tree, makeelement) + 61 children = root.getchildren() + 62 for child in children: + 63 root.remove(child) + 64 return children +
65 +
66 + 67 # helpers + 68 + 69 -def _parse(source, beautifulsoup, makeelement, **bsargs): +
70 if beautifulsoup is None: + 71 beautifulsoup = BeautifulSoup + 72 if hasattr(beautifulsoup, "HTML_ENTITIES"): # bs3 + 73 if 'convertEntities' not in bsargs: + 74 bsargs['convertEntities'] = 'html' + 75 if hasattr(beautifulsoup, "DEFAULT_BUILDER_FEATURES"): # bs4 + 76 if 'features' not in bsargs: + 77 bsargs['features'] = 'html.parser' # use Python html parser + 78 tree = beautifulsoup(source, **bsargs) + 79 root = _convert_tree(tree, makeelement) + 80 # from ET: wrap the document in a html root element, if necessary + 81 if len(root) == 1 and root[0].tag == "html": + 82 return root[0] + 83 root.tag = "html" + 84 return root +
85 + 86 + 87 _parse_doctype_declaration = re.compile( + 88 r'(?:\s|[<!])*DOCTYPE\s*HTML' + 89 r'(?:\s+PUBLIC)?(?:\s+(\'[^\']*\'|"[^"]*"))?' + 90 r'(?:\s+(\'[^\']*\'|"[^"]*"))?', + 91 re.IGNORECASE).match +
92 + 93 + 94 -class _PseudoTag: +
95 # Minimal imitation of BeautifulSoup.Tag +
96 - def __init__(self, contents): +
97 self.name = 'html' + 98 self.attrs = [] + 99 self.contents = contents +
100 +
101 - def __iter__(self): +
102 return self.contents.__iter__() +
103 +
104 +105 -def _convert_tree(beautiful_soup_tree, makeelement): +
106 if makeelement is None: +107 makeelement = html.html_parser.makeelement +108 +109 # Split the tree into three parts: +110 # i) everything before the root element: document type +111 # declaration, comments, processing instructions, whitespace +112 # ii) the root(s), +113 # iii) everything after the root: comments, processing +114 # instructions, whitespace +115 first_element_idx = last_element_idx = None +116 html_root = declaration = None +117 for i, e in enumerate(beautiful_soup_tree): +118 if isinstance(e, Tag): +119 if first_element_idx is None: +120 first_element_idx = i +121 last_element_idx = i +122 if html_root is None and e.name and e.name.lower() == 'html': +123 html_root = e +124 elif declaration is None and isinstance(e, _DECLARATION_OR_DOCTYPE): +125 declaration = e +126 +127 # For a nice, well-formatted document, the variable roots below is +128 # a list consisting of a single <html> element. However, the document +129 # may be a soup like '<meta><head><title>Hello</head><body>Hi +130 # all<\p>'. In this example roots is a list containing meta, head +131 # and body elements. +132 if first_element_idx is None: +133 pre_root = post_root = [] +134 roots = beautiful_soup_tree.contents +135 else: +136 pre_root = beautiful_soup_tree.contents[:first_element_idx] +137 roots = beautiful_soup_tree.contents[first_element_idx:last_element_idx+1] +138 post_root = beautiful_soup_tree.contents[last_element_idx+1:] +139 +140 # Reorganize so that there is one <html> root... +141 if html_root is not None: +142 # ... use existing one if possible, ... +143 i = roots.index(html_root) +144 html_root.contents = roots[:i] + html_root.contents + roots[i+1:] +145 else: +146 # ... otherwise create a new one. +147 html_root = _PseudoTag(roots) +148 +149 convert_node = _init_node_converters(makeelement) +150 +151 # Process pre_root +152 res_root = convert_node(html_root) +153 prev = res_root +154 for e in reversed(pre_root): +155 converted = convert_node(e) +156 if converted is not None: +157 prev.addprevious(converted) +158 prev = converted +159 +160 # ditto for post_root +161 prev = res_root +162 for e in post_root: +163 converted = convert_node(e) +164 if converted is not None: +165 prev.addnext(converted) +166 prev = converted +167 +168 if declaration is not None: +169 try: +170 # bs4 provides full Doctype string +171 doctype_string = declaration.output_ready() +172 except AttributeError: +173 doctype_string = declaration.string +174 +175 match = _parse_doctype_declaration(doctype_string) +176 if not match: +177 # Something is wrong if we end up in here. Since soupparser should +178 # tolerate errors, do not raise Exception, just let it pass. +179 pass +180 else: +181 external_id, sys_uri = match.groups() +182 docinfo = res_root.getroottree().docinfo +183 # strip quotes and update DOCTYPE values (any of None, '', '...') +184 docinfo.public_id = external_id and external_id[1:-1] +185 docinfo.system_url = sys_uri and sys_uri[1:-1] +186 +187 return res_root +
188 +
189 +190 -def _init_node_converters(makeelement): +
191 converters = {} +192 ordered_node_types = [] +193 +194 def converter(*types): +195 def add(handler): +196 for t in types: +197 converters[t] = handler +198 ordered_node_types.append(t) +199 return handler +
200 return add +201 +202 def find_best_converter(node): +203 for t in ordered_node_types: +204 if isinstance(node, t): +205 return converters[t] +206 return None +207 +208 def convert_node(bs_node, parent=None): +209 # duplicated in convert_tag() below +210 try: +211 handler = converters[type(bs_node)] +212 except KeyError: +213 handler = converters[type(bs_node)] = find_best_converter(bs_node) +214 if handler is None: +215 return None +216 return handler(bs_node, parent) +217 +218 def map_attrs(bs_attrs): +219 if isinstance(bs_attrs, dict): # bs4 +220 attribs = {} +221 for k, v in bs_attrs.items(): +222 if isinstance(v, list): +223 v = " ".join(v) +224 attribs[k] = unescape(v) +225 else: +226 attribs = dict((k, unescape(v)) for k, v in bs_attrs) +227 return attribs +228 +229 def append_text(parent, text): +230 if len(parent) == 0: +231 parent.text = (parent.text or '') + text +232 else: +233 parent[-1].tail = (parent[-1].tail or '') + text +234 +235 # converters are tried in order of their definition +236 +237 @converter(Tag, _PseudoTag) +238 def convert_tag(bs_node, parent): +239 attrs = bs_node.attrs +240 if parent is not None: +241 attribs = map_attrs(attrs) if attrs else None +242 res = etree.SubElement(parent, bs_node.name, attrib=attribs) +243 else: +244 attribs = map_attrs(attrs) if attrs else {} +245 res = makeelement(bs_node.name, attrib=attribs) +246 +247 for child in bs_node: +248 # avoid double recursion by inlining convert_node(), see above +249 try: +250 handler = converters[type(child)] +251 except KeyError: +252 pass +253 else: +254 if handler is not None: +255 handler(child, res) +256 continue +257 convert_node(child, res) +258 return res +259 +260 @converter(Comment) +261 def convert_comment(bs_node, parent): +262 res = html.HtmlComment(bs_node) +263 if parent is not None: +264 parent.append(res) +265 return res +266 +267 @converter(ProcessingInstruction) +268 def convert_pi(bs_node, parent): +269 if bs_node.endswith('?'): +270 # The PI is of XML style (<?as df?>) but BeautifulSoup +271 # interpreted it as being SGML style (<?as df>). Fix. +272 bs_node = bs_node[:-1] +273 res = etree.ProcessingInstruction(*bs_node.split(' ', 1)) +274 if parent is not None: +275 parent.append(res) +276 return res +277 +278 @converter(NavigableString) +279 def convert_text(bs_node, parent): +280 if parent is not None: +281 append_text(parent, unescape(bs_node)) +282 return None +283 +284 return convert_node +285 +286 +287 # copied from ET's ElementSoup +288 +289 try: +290 from html.entities import name2codepoint # Python 3 +291 except ImportError: +292 from htmlentitydefs import name2codepoint +293 +294 +295 handle_entities = re.compile(r"&(\w+);").sub +296 +297 +298 try: +299 unichr +300 except NameError: +301 # Python 3 +302 unichr = chr +
303 +304 +305 -def unescape(string): +
306 if not string: +307 return '' +308 # work around oddities in BeautifulSoup's entity handling +309 def unescape_entity(m): +310 try: +311 return unichr(name2codepoint[m.group(1)]) +312 except KeyError: +313 return m.group(0) # use as is +
314 return handle_entities(unescape_entity, string) +315 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.soupparser._PseudoTag-class.html b/doc/html/api/lxml.html.soupparser._PseudoTag-class.html new file mode 100644 index 00000000..03a96fc6 --- /dev/null +++ b/doc/html/api/lxml.html.soupparser._PseudoTag-class.html @@ -0,0 +1,168 @@ + + + + + lxml.html.soupparser._PseudoTag + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module soupparser :: + Class _PseudoTag + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _PseudoTag

source code

+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + contents) + source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..94870575 --- /dev/null +++ b/doc/html/api/lxml.html.usedoctest-module.html @@ -0,0 +1,124 @@ + + + + + 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 00000000..9eaac0c7 --- /dev/null +++ b/doc/html/api/lxml.html.usedoctest-pysrc.html @@ -0,0 +1,139 @@ + + + + + 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.includes-module.html b/doc/html/api/lxml.includes-module.html new file mode 100644 index 00000000..ca02b728 --- /dev/null +++ b/doc/html/api/lxml.includes-module.html @@ -0,0 +1,141 @@ + + + + + lxml.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package includes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package includes

source code

+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None
+ hash(x) +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.includes-pysrc.html b/doc/html/api/lxml.includes-pysrc.html new file mode 100644 index 00000000..04605dc5 --- /dev/null +++ b/doc/html/api/lxml.includes-pysrc.html @@ -0,0 +1,123 @@ + + + + + lxml.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package includes + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml.includes

+
+1   
+2   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.isoschematron-module.html b/doc/html/api/lxml.isoschematron-module.html new file mode 100644 index 00000000..d84c3ffb --- /dev/null +++ b/doc/html/api/lxml.isoschematron-module.html @@ -0,0 +1,428 @@ + + + + + lxml.isoschematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package isoschematron + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package isoschematron

source code

+The lxml.isoschematron package implements ISO Schematron support on top +of the pure-xslt 'skeleton' implementation. + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + unicode
+ str(object='') -> string +
+   + + basestring
+ str(object='') -> string +
+   + + Schematron
+ An ISO Schematron validator. +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
stylesheet_params(**kwargs)
+ Convert keyword args to a dictionary of stylesheet parameters. +XSL stylesheet parameters must be XPath expressions, i.e.:
+ source code + +
+ +
+   + + + + + + +
_stylesheet_param_dict(paramsDict, + kwargsDict)
+ Return a copy of paramsDict, updated with kwargsDict entries, wrapped as +stylesheet arguments. +kwargsDict entries with a value of None are ignored.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + XML_SCHEMA_NS = 'http://www.w3.org/2001/XMLSchema' +
+   + + RELAXNG_NS = 'http://relaxng.org/ns/structure/1.0' +
+   + + SCHEMATRON_NS = 'http://purl.oclc.org/dsdl/schematron' +
+   + + SVRL_NS = 'http://purl.oclc.org/dsdl/svrl' +
+   + + _schematron_root = '{http://purl.oclc.org/dsdl/schematron}schema' +
+   + + _xml_schema_root = '{http://www.w3.org/2001/XMLSchema}schema' +
+   + + _resources_dir = '/home/stefan/source/Python/lxml/lxml-release... +
+   + + extract_xsd = <lxml.etree.XSLT object> +
+   + + extract_rng = <lxml.etree.XSLT object> +
+   + + iso_dsdl_include = <lxml.etree.XSLT object> +
+   + + iso_abstract_expand = <lxml.etree.XSLT object> +
+   + + iso_svrl_for_xslt1 = <lxml.etree.XSLT object> +
+   + + svrl_validation_errors = //svrl:failed-assert +
+   + + schematron_schema_valid = <lxml.etree.RelaxNG object> +
+   + + __package__ = 'lxml.isoschematron' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

stylesheet_params(**kwargs) +

+
source code  +
+ +

Convert keyword args to a dictionary of stylesheet parameters. +XSL stylesheet parameters must be XPath expressions, i.e.:

+
    +
  • string expressions, like "'5'"
  • +
  • simple (number) expressions, like "5"
  • +
  • valid XPath expressions, like "/a/b/text()"
  • +
+

This function converts native Python keyword arguments to stylesheet +parameters following these rules: +If an arg is a string wrap it with XSLT.strparam(). +If an arg is an XPath object use its path string. +If arg is None raise TypeError. +Else convert arg to string.

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

_resources_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/isoschematron/r\
+esources'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.isoschematron-pysrc.html b/doc/html/api/lxml.isoschematron-pysrc.html new file mode 100644 index 00000000..366fa346 --- /dev/null +++ b/doc/html/api/lxml.isoschematron-pysrc.html @@ -0,0 +1,683 @@ + + + + + lxml.isoschematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package isoschematron + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml.isoschematron

+
+  1  """The ``lxml.isoschematron`` package implements ISO Schematron support on top 
+  2  of the pure-xslt 'skeleton' implementation. 
+  3  """ 
+  4   
+  5  import sys 
+  6  import os.path 
+  7  from lxml import etree as _etree # due to validator __init__ signature 
+  8   
+  9   
+ 10  # some compat stuff, borrowed from lxml.html 
+ 11  try: 
+ 12      unicode 
+ 13  except NameError: 
+ 14      # Python 3 
+ 15      unicode = str 
+ 16  try: 
+ 17      basestring 
+ 18  except NameError: 
+ 19      # Python 3 
+ 20      basestring = str 
+ 21   
+ 22   
+ 23  __all__ = ['extract_xsd', 'extract_rng', 'iso_dsdl_include', 
+ 24             'iso_abstract_expand', 'iso_svrl_for_xslt1', 
+ 25             'svrl_validation_errors', 'schematron_schema_valid', 
+ 26             'stylesheet_params', 'Schematron'] 
+ 27   
+ 28   
+ 29  # some namespaces 
+ 30  #FIXME: Maybe lxml should provide a dedicated place for common namespace 
+ 31  #FIXME: definitions? 
+ 32  XML_SCHEMA_NS = "http://www.w3.org/2001/XMLSchema" 
+ 33  RELAXNG_NS = "http://relaxng.org/ns/structure/1.0" 
+ 34  SCHEMATRON_NS = "http://purl.oclc.org/dsdl/schematron" 
+ 35  SVRL_NS = "http://purl.oclc.org/dsdl/svrl" 
+ 36   
+ 37   
+ 38  # some helpers 
+ 39  _schematron_root = '{%s}schema' % SCHEMATRON_NS 
+ 40  _xml_schema_root = '{%s}schema' % XML_SCHEMA_NS 
+ 41  _resources_dir = os.path.join(os.path.dirname(__file__), 'resources') 
+ 42   
+ 43   
+ 44  # the iso-schematron skeleton implementation steps aka xsl transformations 
+ 45  extract_xsd = _etree.XSLT(_etree.parse( 
+ 46      os.path.join(_resources_dir, 'xsl', 'XSD2Schtrn.xsl'))) 
+ 47  extract_rng = _etree.XSLT(_etree.parse( 
+ 48      os.path.join(_resources_dir, 'xsl', 'RNG2Schtrn.xsl'))) 
+ 49  iso_dsdl_include = _etree.XSLT(_etree.parse( 
+ 50      os.path.join(_resources_dir, 'xsl', 'iso-schematron-xslt1', 
+ 51                   'iso_dsdl_include.xsl'))) 
+ 52  iso_abstract_expand = _etree.XSLT(_etree.parse( 
+ 53      os.path.join(_resources_dir, 'xsl', 'iso-schematron-xslt1', 
+ 54                   'iso_abstract_expand.xsl'))) 
+ 55  iso_svrl_for_xslt1 = _etree.XSLT(_etree.parse( 
+ 56      os.path.join(_resources_dir, 
+ 57                   'xsl', 'iso-schematron-xslt1', 'iso_svrl_for_xslt1.xsl'))) 
+ 58   
+ 59   
+ 60  # svrl result accessors 
+ 61  svrl_validation_errors = _etree.XPath( 
+ 62      '//svrl:failed-assert', namespaces={'svrl': SVRL_NS}) 
+ 63   
+ 64   
+ 65  # RelaxNG validator for schematron schemas 
+ 66  schematron_schema_valid = _etree.RelaxNG( 
+ 67      file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) 
+
68 + 69 + 70 -def stylesheet_params(**kwargs): +
71 """Convert keyword args to a dictionary of stylesheet parameters. + 72 XSL stylesheet parameters must be XPath expressions, i.e.: + 73 + 74 * string expressions, like "'5'" + 75 * simple (number) expressions, like "5" + 76 * valid XPath expressions, like "/a/b/text()" + 77 + 78 This function converts native Python keyword arguments to stylesheet + 79 parameters following these rules: + 80 If an arg is a string wrap it with XSLT.strparam(). + 81 If an arg is an XPath object use its path string. + 82 If arg is None raise TypeError. + 83 Else convert arg to string. + 84 """ + 85 result = {} + 86 for key, val in kwargs.items(): + 87 if isinstance(val, basestring): + 88 val = _etree.XSLT.strparam(val) + 89 elif val is None: + 90 raise TypeError('None not allowed as a stylesheet parameter') + 91 elif not isinstance(val, _etree.XPath): + 92 val = unicode(val) + 93 result[key] = val + 94 return result +
95 +
96 + 97 # helper function for use in Schematron __init__ + 98 -def _stylesheet_param_dict(paramsDict, kwargsDict): +
99 """Return a copy of paramsDict, updated with kwargsDict entries, wrapped as +100 stylesheet arguments. +101 kwargsDict entries with a value of None are ignored. +102 """ +103 # beware of changing mutable default arg +104 paramsDict = dict(paramsDict) +105 for k, v in kwargsDict.items(): +106 if v is not None: # None values do not override +107 paramsDict[k] = v +108 paramsDict = stylesheet_params(**paramsDict) +109 return paramsDict +
110 +
111 +112 -class Schematron(_etree._Validator): +
113 """An ISO Schematron validator. +114 +115 Pass a root Element or an ElementTree to turn it into a validator. +116 Alternatively, pass a filename as keyword argument 'file' to parse from +117 the file system. +118 +119 Schematron is a less well known, but very powerful schema language. +120 The main idea is to use the capabilities of XPath to put restrictions on +121 the structure and the content of XML documents. +122 +123 The standard behaviour is to fail on ``failed-assert`` findings only +124 (``ASSERTS_ONLY``). To change this, you can either pass a report filter +125 function to the ``error_finder`` parameter (e.g. ``ASSERTS_AND_REPORTS`` +126 or a custom ``XPath`` object), or subclass isoschematron.Schematron for +127 complete control of the validation process. +128 +129 Built on the Schematron language 'reference' skeleton pure-xslt +130 implementation, the validator is created as an XSLT 1.0 stylesheet using +131 these steps: +132 +133 0) (Extract from XML Schema or RelaxNG schema) +134 1) Process inclusions +135 2) Process abstract patterns +136 3) Compile the schematron schema to XSLT +137 +138 The ``include`` and ``expand`` keyword arguments can be used to switch off +139 steps 1) and 2). +140 To set parameters for steps 1), 2) and 3) hand parameter dictionaries to the +141 keyword arguments ``include_params``, ``expand_params`` or +142 ``compile_params``. +143 For convenience, the compile-step parameter ``phase`` is also exposed as a +144 keyword argument ``phase``. This takes precedence if the parameter is also +145 given in the parameter dictionary. +146 +147 If ``store_schematron`` is set to True, the (included-and-expanded) +148 schematron document tree is stored and available through the ``schematron`` +149 property. +150 If ``store_xslt`` is set to True, the validation XSLT document tree will be +151 stored and can be retrieved through the ``validator_xslt`` property. +152 With ``store_report`` set to True (default: False), the resulting validation +153 report document gets stored and can be accessed as the ``validation_report`` +154 property. +155 +156 Here is a usage example:: +157 +158 >>> from lxml import etree +159 >>> from lxml.isoschematron import Schematron +160 +161 >>> schematron = Schematron(etree.XML(''' +162 ... <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +163 ... <pattern id="id_only_attribute"> +164 ... <title>id is the only permitted attribute name</title> +165 ... <rule context="*"> +166 ... <report test="@*[not(name()='id')]">Attribute +167 ... <name path="@*[not(name()='id')]"/> is forbidden<name/> +168 ... </report> +169 ... </rule> +170 ... </pattern> +171 ... </schema>'''), +172 ... error_finder=Schematron.ASSERTS_AND_REPORTS) +173 +174 >>> xml = etree.XML(''' +175 ... <AAA name="aaa"> +176 ... <BBB id="bbb"/> +177 ... <CCC color="ccc"/> +178 ... </AAA> +179 ... ''') +180 +181 >>> schematron.validate(xml) +182 False +183 +184 >>> xml = etree.XML(''' +185 ... <AAA id="aaa"> +186 ... <BBB id="bbb"/> +187 ... <CCC/> +188 ... </AAA> +189 ... ''') +190 +191 >>> schematron.validate(xml) +192 True +193 """ +194 +195 # libxml2 error categorization for validation errors +196 _domain = _etree.ErrorDomains.SCHEMATRONV +197 _level = _etree.ErrorLevels.ERROR +198 _error_type = _etree.ErrorTypes.SCHEMATRONV_ASSERT +199 +200 # convenience definitions for common behaviours +201 ASSERTS_ONLY = svrl_validation_errors # Default +202 ASSERTS_AND_REPORTS = _etree.XPath( +203 '//svrl:failed-assert | //svrl:successful-report', +204 namespaces={'svrl': SVRL_NS}) +205 +
206 - def _extract(self, element): +
207 """Extract embedded schematron schema from non-schematron host schema. +208 This method will only be called by __init__ if the given schema document +209 is not a schematron schema by itself. +210 Must return a schematron schema document tree or None. +211 """ +212 schematron = None +213 if element.tag == _xml_schema_root: +214 schematron = self._extract_xsd(element) +215 elif element.nsmap[element.prefix] == RELAXNG_NS: +216 # RelaxNG does not have a single unique root element +217 schematron = self._extract_rng(element) +218 return schematron +
219 +220 # customization points +221 # etree.XSLT objects that provide the extract, include, expand, compile +222 # steps +223 _extract_xsd = extract_xsd +224 _extract_rng = extract_rng +225 _include = iso_dsdl_include +226 _expand = iso_abstract_expand +227 _compile = iso_svrl_for_xslt1 +228 +229 # etree.xpath object that determines input document validity when applied to +230 # the svrl result report; must return a list of result elements (empty if +231 # valid) +232 _validation_errors = ASSERTS_ONLY +233 +
234 - def __init__(self, etree=None, file=None, include=True, expand=True, +235 include_params={}, expand_params={}, compile_params={}, +236 store_schematron=False, store_xslt=False, store_report=False, +237 phase=None, error_finder=ASSERTS_ONLY): +
238 super(Schematron, self).__init__() +239 +240 self._store_report = store_report +241 self._schematron = None +242 self._validator_xslt = None +243 self._validation_report = None +244 if error_finder is not self.ASSERTS_ONLY: +245 self._validation_errors = error_finder +246 +247 # parse schema document, may be a schematron schema or an XML Schema or +248 # a RelaxNG schema with embedded schematron rules +249 root = None +250 try: +251 if etree is not None: +252 if _etree.iselement(etree): +253 root = etree +254 else: +255 root = etree.getroot() +256 elif file is not None: +257 root = _etree.parse(file).getroot() +258 except Exception: +259 raise _etree.SchematronParseError( +260 "No tree or file given: %s" % sys.exc_info()[1]) +261 if root is None: +262 raise ValueError("Empty tree") +263 if root.tag == _schematron_root: +264 schematron = root +265 else: +266 schematron = self._extract(root) +267 if schematron is None: +268 raise _etree.SchematronParseError( +269 "Document is not a schematron schema or schematron-extractable") +270 # perform the iso-schematron skeleton implementation steps to get a +271 # validating xslt +272 if include: +273 schematron = self._include(schematron, **include_params) +274 if expand: +275 schematron = self._expand(schematron, **expand_params) +276 if not schematron_schema_valid(schematron): +277 raise _etree.SchematronParseError( +278 "invalid schematron schema: %s" % +279 schematron_schema_valid.error_log) +280 if store_schematron: +281 self._schematron = schematron +282 # add new compile keyword args here if exposing them +283 compile_kwargs = {'phase': phase} +284 compile_params = _stylesheet_param_dict(compile_params, compile_kwargs) +285 validator_xslt = self._compile(schematron, **compile_params) +286 if store_xslt: +287 self._validator_xslt = validator_xslt +288 self._validator = _etree.XSLT(validator_xslt) +
289 +
290 - def __call__(self, etree): +
291 """Validate doc using Schematron. +292 +293 Returns true if document is valid, false if not. +294 """ +295 self._clear_error_log() +296 result = self._validator(etree) +297 if self._store_report: +298 self._validation_report = result +299 errors = self._validation_errors(result) +300 if errors: +301 if _etree.iselement(etree): +302 fname = etree.getroottree().docinfo.URL or '<file>' +303 else: +304 fname = etree.docinfo.URL or '<file>' +305 for error in errors: +306 # Does svrl report the line number, anywhere? Don't think so. +307 self._append_log_message( +308 domain=self._domain, type=self._error_type, +309 level=self._level, line=0, +310 message=_etree.tostring(error, encoding='unicode'), +311 filename=fname) +312 return False +313 return True +
314 +315 @property +
316 - def schematron(self): +
317 """ISO-schematron schema document (None if object has been initialized +318 with store_schematron=False). +319 """ +320 return self._schematron +
321 +322 @property +
323 - def validator_xslt(self): +
324 """ISO-schematron skeleton implementation XSLT validator document (None +325 if object has been initialized with store_xslt=False). +326 """ +327 return self._validator_xslt +
328 +329 @property +
330 - def validation_report(self): +
331 """ISO-schematron validation result report (None if result-storing has +332 been turned off). +333 """ +334 return self._validation_report +
335 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.isoschematron.Schematron-class.html b/doc/html/api/lxml.isoschematron.Schematron-class.html new file mode 100644 index 00000000..ff54808c --- /dev/null +++ b/doc/html/api/lxml.isoschematron.Schematron-class.html @@ -0,0 +1,650 @@ + + + + + lxml.isoschematron.Schematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package isoschematron :: + Class Schematron + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Schematron

source code

+
+      object --+    
+               |    
+etree._Validator --+
+                   |
+                  Schematron
+
+ +
+

An ISO 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.

+

The standard behaviour is to fail on failed-assert findings only +(ASSERTS_ONLY). To change this, you can either pass a report filter +function to the error_finder parameter (e.g. ASSERTS_AND_REPORTS +or a custom XPath object), or subclass isoschematron.Schematron for +complete control of the validation process.

+

Built on the Schematron language 'reference' skeleton pure-xslt +implementation, the validator is created as an XSLT 1.0 stylesheet using +these steps:

+
+
    +
  1. (Extract from XML Schema or RelaxNG schema)
  2. +
  3. Process inclusions
  4. +
  5. Process abstract patterns
  6. +
  7. Compile the schematron schema to XSLT
  8. +
+
+

The include and expand keyword arguments can be used to switch off +steps 1) and 2). +To set parameters for steps 1), 2) and 3) hand parameter dictionaries to the +keyword arguments include_params, expand_params or +compile_params. +For convenience, the compile-step parameter phase is also exposed as a +keyword argument phase. This takes precedence if the parameter is also +given in the parameter dictionary.

+

If store_schematron is set to True, the (included-and-expanded) +schematron document tree is stored and available through the schematron +property. +If store_xslt is set to True, the validation XSLT document tree will be +stored and can be retrieved through the validator_xslt property. +With store_report set to True (default: False), the resulting validation +report document gets stored and can be accessed as the validation_report +property.

+

Here is a usage example:

+
+>>> from lxml import etree
+>>> from lxml.isoschematron import Schematron
+
+>>> schematron = Schematron(etree.XML('''
+... <schema xmlns="http://purl.oclc.org/dsdl/schematron" >
+...   <pattern id="id_only_attribute">
+...     <title>id is the only permitted attribute name</title>
+...     <rule context="*">
+...       <report test="@*[not(name()='id')]">Attribute
+...         <name path="@*[not(name()='id')]"/> is forbidden<name/>
+...       </report>
+...     </rule>
+...   </pattern>
+... </schema>'''),
+... error_finder=Schematron.ASSERTS_AND_REPORTS)
+
+>>> xml = etree.XML('''
+... <AAA name="aaa">
+...   <BBB id="bbb"/>
+...   <CCC color="ccc"/>
+... </AAA>
+... ''')
+
+>>> schematron.validate(xml)
+False
+
+>>> xml = etree.XML('''
+... <AAA id="aaa">
+...   <BBB id="bbb"/>
+...   <CCC/>
+... </AAA>
+... ''')
+
+>>> schematron.validate(xml)
+True
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_extract(self, + element)
+ Extract embedded schematron schema from non-schematron host schema. +This method will only be called by __init__ if the given schema document +is not a schematron schema by itself. +Must return a schematron schema document tree or None.
+ source code + +
+ +
+   + + + + + + +
__init__(self, + etree=None, + file=None, + include=True, + expand=True, + include_params={}, + expand_params={}, + compile_params={}, + store_schematron=False, + store_xslt=False, + store_report=False, + phase=None, + error_finder=//svrl:failed-assert)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + etree)
+ Validate doc using Schematron.
+ source code + +
+ +
+

Inherited from etree._Validator: + __new__, + assertValid, + assert_, + validate +

+

Inherited from etree._Validator (private): + _append_log_message, + _clear_error_log +

+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _domain = 28 +
+   + + _level = 2 +
+   + + _error_type = 4000 +
+   + + ASSERTS_ONLY = //svrl:failed-assert +
+   + + ASSERTS_AND_REPORTS = //svrl:failed-assert | //svrl:successful... +
+   + + _extract_xsd = <lxml.etree.XSLT object> +
+   + + _extract_rng = <lxml.etree.XSLT object> +
+   + + _include = <lxml.etree.XSLT object> +
+   + + _expand = <lxml.etree.XSLT object> +
+   + + _compile = <lxml.etree.XSLT object> +
+   + + _validation_errors = //svrl:failed-assert +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + schematron
+ ISO-schematron schema document (None if object has been initialized +with store_schematron=False). +
+   + + validator_xslt
+ ISO-schematron skeleton implementation XSLT validator document (None +if object has been initialized with store_xslt=False). +
+   + + validation_report
+ ISO-schematron validation result report (None if result-storing has +been turned off). +
+

Inherited from etree._Validator: + error_log +

+

Inherited from object: + __class__ +

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

__init__(self, + etree=None, + file=None, + include=True, + expand=True, + include_params={}, + expand_params={}, + compile_params={}, + store_schematron=False, + store_xslt=False, + store_report=False, + phase=None, + error_finder=//svrl:failed-assert) +
(Constructor) +

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

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

+
source code  +
+ +

Validate doc using Schematron.

+

Returns true if document is valid, false if not.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

ASSERTS_AND_REPORTS

+ +
+
+
+
Value:
+
+//svrl:failed-assert | //svrl:successful-report
+
+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

schematron

+ ISO-schematron schema document (None if object has been initialized +with store_schematron=False). +
+
Get Method:
+
unreachable.schematron(self) + - ISO-schematron schema document (None if object has been initialized +with store_schematron=False). +
+
+
+
+ +
+ +
+

validator_xslt

+ ISO-schematron skeleton implementation XSLT validator document (None +if object has been initialized with store_xslt=False). +
+
Get Method:
+
unreachable.validator_xslt(self) + - ISO-schematron skeleton implementation XSLT validator document (None +if object has been initialized with store_xslt=False). +
+
+
+
+ +
+ +
+

validation_report

+ ISO-schematron validation result report (None if result-storing has +been turned off). +
+
Get Method:
+
unreachable.validation_report(self) + - ISO-schematron validation result report (None if result-storing has +been turned off). +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify-module.html b/doc/html/api/lxml.objectify-module.html new file mode 100644 index 00000000..fd25a2ed --- /dev/null +++ b/doc/html/api/lxml.objectify-module.html @@ -0,0 +1,1159 @@ + + + + + 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: + 4.4.3 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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. Subclasses should +override the 'pyval' property and possibly the __str__ method. +
+   + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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.
+ + +
+ +
+   + + + + + + +
SubElement(_parent, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Subelement factory. This function creates an element instance, and +appends it to an existing 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, + cleanup_namespaces=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> +
+   + + PYTYPE_ATTRIBUTE = '{http://codespeak.net/lxml/objectify/pytyp... +
+   + + __package__ = None
+ hash(x) +
+   + + __test__ = {} +
+ + + + + + +
+ + + + + +
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, + cleanup_namespaces=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 by +default. If you want to remove unused namespace declarations from +the tree, pass the option cleanup_namespaces=True.

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

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 00000000..e7673615 --- /dev/null +++ b/doc/html/api/lxml.objectify.BoolElement-class.html @@ -0,0 +1,828 @@ + + + + + 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
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__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__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+   + + + + + + +
_init(...)
+ Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses.
+ + +
+ +
+

Inherited from IntElement: + __index__ +

+

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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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__ +
+
+
+
+ +
+ +
+ + +
+

__hash__(x) +
(Hashing function) +

+
  +
+ + hash(x) +
+
Overrides: + object.__hash__ +
+
+
+
+ +
+ +
+ + +
+

__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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

_init(...) +

+
  +
+ + 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 00000000..e4c6c4e1 --- /dev/null +++ b/doc/html/api/lxml.objectify.ElementMaker-class.html @@ -0,0 +1,388 @@ + + + + + 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)
+>>> attributes = {'class': 'par'}
+>>> html = M.html( M.body( M.p('hello', attributes, M.br, 'objectify', style="font-weight: bold") ) )
+
+>>> from lxml.etree import tostring
+>>> print(tostring(html, method='html').decode('ascii'))
+<html><body><p style="font-weight: bold" class="par">hello<br>objectify</p></body></html>
+
+

To create tags that are not valid Python identifiers, call the factory +directly and pass the tag name as first argument:

+
+>>> root = M('tricky-tag', 'some text')
+>>> print(root.tag)
+tricky-tag
+>>> print(root.text)
+some text
+
+

Note that this module has a predefined ElementMaker instance called E.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(x, + ...)
+ x(...)
+ + +
+ +
+   + + + + + + +
__getattr__(...) + + +
+ +
+   + + + + + + +
__getattribute__(...)
+ x.__getattribute__('name') <==> x.name
+ + +
+ +
+   + + + + + + +
__init__(self, + namespace=None, + nsmap=None, + annotate=True, + makeelement=None)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __format__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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 00000000..b2c0bcc1 --- /dev/null +++ b/doc/html/api/lxml.objectify.FloatElement-class.html @@ -0,0 +1,414 @@ + + + + + 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(...)
+ Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hash__, + __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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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(...) +

+
  +
+ + 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 00000000..dbb096e3 --- /dev/null +++ b/doc/html/api/lxml.objectify.IntElement-class.html @@ -0,0 +1,437 @@ + + + + + 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]
+
+   + + + + + + +
__index__(...)
+ x[y:z] <==> x[y.__index__():z.__index__()]
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_init(...)
+ Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hash__, + __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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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(...) +

+
  +
+ + 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 00000000..8a8853c6 --- /dev/null +++ b/doc/html/api/lxml.objectify.LongElement-class.html @@ -0,0 +1,431 @@ + + + + + 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]
+
+   + + + + + + +
__index__(...)
+ x[y:z] <==> x[y.__index__():z.__index__()]
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_init(...)
+ Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hash__, + __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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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(...) +

+
  +
+ + 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 00000000..6c0f6a79 --- /dev/null +++ b/doc/html/api/lxml.objectify.NoneElement-class.html @@ -0,0 +1,596 @@ + + + + + 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
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__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__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + 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: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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]
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..cc744ee6 --- /dev/null +++ b/doc/html/api/lxml.objectify.NumberElement-class.html @@ -0,0 +1,1242 @@ + + + + + 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__(x)
+ abs(x)
+ + +
+ +
+   + + + + + + +
__add__(x, + y)
+ x+y
+ + +
+ +
+   + + + + + + +
__and__(x, + y)
+ x&y
+ + +
+ +
+   + + + + + + +
__complex__(...) + + +
+ +
+   + + + + + + +
__div__(x, + y)
+ x/y
+ + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__float__(x)
+ float(x)
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__hex__(x)
+ hex(x)
+ + +
+ +
+   + + + + + + +
__int__(x)
+ int(x)
+ + +
+ +
+   + + + + + + +
__invert__(x)
+ ~x
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__long__(x)
+ long(x)
+ + +
+ +
+   + + + + + + +
__lshift__(x, + y)
+ x<<y
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__mod__(x, + y)
+ x%y
+ + +
+ +
+   + + + + + + +
__mul__(x, + y)
+ x*y
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+   + + + + + + +
__neg__(x)
+ -x
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__oct__(x)
+ oct(x)
+ + +
+ +
+   + + + + + + +
__or__(x, + y)
+ x|y
+ + +
+ +
+   + + + + + + +
__pos__(x)
+ +x
+ + +
+ +
+   + + + + + + +
__pow__(x, + y, + z=...)
+ pow(x, y[, z])
+ + +
+ +
+   + + + + + + +
__radd__(x, + y)
+ y+x
+ + +
+ +
+   + + + + + + +
__rand__(x, + y)
+ y&x
+ + +
+ +
+   + + + + + + +
__rdiv__(x, + y)
+ y/x
+ + +
+ +
+   + + + + + + +
__repr__(x)
+ 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__(x, + y)
+ x>>y
+ + +
+ +
+   + + + + + + +
__rsub__(x, + y)
+ y-x
+ + +
+ +
+   + + + + + + +
__rtruediv__(x, + y)
+ y/x
+ + +
+ +
+   + + + + + + +
__rxor__(x, + y)
+ y^x
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+   + + + + + + +
__sub__(x, + y)
+ x-y
+ + +
+ +
+   + + + + + + +
__truediv__(x, + y)
+ x/y
+ + +
+ +
+   + + + + + + +
__xor__(x, + y)
+ x^y
+ + +
+ +
+   + + + + + + +
_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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + 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: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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]
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

_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 00000000..090955c7 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectPath-class.html @@ -0,0 +1,475 @@ + + + + + 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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__str__(x)
+ 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

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 00000000..e6815ba7 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifiedDataElement-class.html @@ -0,0 +1,432 @@ + + + + + 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__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+   + + + + + + +
_setText(...)
+ For use in subclasses only. Don't use unless you know what you are +doing.
+ + +
+ +
+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __nonzero__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + 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: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..2100f9ae --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifiedElement-class.html @@ -0,0 +1,883 @@ + + + + + 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. If no namespace +is provided, the child will be looked up in the same one as self.
+ + +
+ +
+   + + + + + + +
__getattribute__(...)
+ x.__getattribute__('name') <==> x.name
+ + +
+ +
+   + + + + + + +
__getitem__(...)
+ Return a sibling, counting from the first child of the parent. The +method behaves like both a dict and a sequence.
+ + +
+ +
+   + + + + + + +
__iter__(...)
+ Iterate over self and all siblings with the same tag.
+ + +
+ +
+   + + + + + + +
__len__(...)
+ Count self and siblings with the same tag.
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__reduce__(...)
+ helper for pickle
+ + +
+ +
+   + + + + + + +
__setattr__(...)
+ 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.
+ + +
+ +
+   + + + + + + +
__setitem__(...)
+ Set the value of a sibling, counting from the first child of the +parent. Implements key assignment, item assignment and slice +assignment.
+ + +
+ +
+   + + + + + + +
__str__(x)
+ 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.
+ + +
+ +
+   + + + + + + +
getchildren(self)
+ Returns a sequence of all direct children. The elements are +returned in document order.
+ + +
+ +
+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __nonzero__, + __repr__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + 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: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + text
+ Text before the first subelement. This is either a string or +the value None, if there was no text. +
+

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__ +
+
+
+
+ +
+ +
+ + +
+

__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__(...) +

+
  +
+ + Iterate over self and all siblings with the same tag. +
+
Overrides: + etree._Element.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__len__(...) +
(Length operator) +

+
  +
+ + Count self and siblings with the same tag. +
+
Overrides: + etree._Element.__len__ +
+
+
+
+ +
+ +
+ + +
+

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

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__reduce__(...) +

+
  +
+ + helper for pickle +
+
Overrides: + object.__reduce__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__setattr__(...) +

+
  +
+ + 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. +
+
Overrides: + object.__setattr__ +
+
+
+
+ +
+ +
+ + +
+

__setitem__(...) +
(Index assignment operator) +

+
  +
+ +

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.
  • +
+
+
Overrides: + etree._Element.__setitem__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

addattr(self, + tag, + value) +

+
  +
+ +

Add a child value to the element.

+

As opposed to append(), it sets a data value, not an element.

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

getchildren(self) +

+
  +
+ + Returns a sequence of all direct children. The elements are +returned in document order. +
+
Overrides: + etree._Element.getchildren +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..402ab362 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifyElementClassLookup-class.html @@ -0,0 +1,299 @@ + + + + + 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)
+ Lookup mechanism for objectify.
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + tree_class=None, + empty_data_class=None) +
(Constructor) +

+
  +
+ +

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 (defaults to StringElement).

+
+
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 00000000..7451f945 --- /dev/null +++ b/doc/html/api/lxml.objectify.PyType-class.html @@ -0,0 +1,469 @@ + + + + + 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, a type class that +inherits from ObjectifiedDataElement and an optional "stringification" +function. 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. For registered +named types, the 'stringify' function (or unicode() if None) is used to +convert a Python object with type name 'name' to the string representation +stored in the XML tree.

+

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 help(type(x)) for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
register(self, + before=None, + after=None)
+ Register the type.
+ + +
+ +
+   + + + + + + +
unregister(self) + + +
+ +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

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 00000000..15f44be0 --- /dev/null +++ b/doc/html/api/lxml.objectify.StringElement-class.html @@ -0,0 +1,755 @@ + + + + + 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__(x, + y)
+ x+y
+ + +
+ +
+   + + + + + + +
__complex__(...) + + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__float__(x)
+ float(x)
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__int__(x)
+ int(x)
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__long__(x)
+ long(x)
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__mod__(x, + y)
+ x%y
+ + +
+ +
+   + + + + + + +
__mul__(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
+ + +
+ +
+   + + + + + + +
__radd__(x, + y)
+ y+x
+ + +
+ +
+   + + + + + + +
__repr__(x)
+ 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__, + __reduce__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + getchildren +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + cssselect, + extend, + find, + findall, + findtext, + get, + 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: + __format__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
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]
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.pyclasslookup-module.html b/doc/html/api/lxml.pyclasslookup-module.html new file mode 100644 index 00000000..b0c4f179 --- /dev/null +++ b/doc/html/api/lxml.pyclasslookup-module.html @@ -0,0 +1,140 @@ + + + + + lxml.pyclasslookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module pyclasslookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module pyclasslookup

source code

+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'lxml' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.pyclasslookup-pysrc.html b/doc/html/api/lxml.pyclasslookup-pysrc.html new file mode 100644 index 00000000..cac1e680 --- /dev/null +++ b/doc/html/api/lxml.pyclasslookup-pysrc.html @@ -0,0 +1,133 @@ + + + + + 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 lxml.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 00000000..44f55fcd --- /dev/null +++ b/doc/html/api/lxml.sax-module.html @@ -0,0 +1,344 @@ + + + + + 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 + +
+ +
+   + + + + + + +
__pyx_unpickle_ElementTreeProducer(...) + source code + +
+ +
+   + + + + + + +
__reduce_cython__(...) + source code + +
+ +
+   + + + + + + +
__setstate_cython__(...) + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None
+ hash(x) +
+   + + __pyx_capi__ = {'_getNsTag': <capsule object "PyObject *(PyObj... +
+   + + __test__ = {} +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

__pyx_capi__

+ +
+
+
+
Value:
+
+{'_getNsTag': <capsule object "PyObject *(PyObject *)" at 0x7f4dd2c7e9\
+90>}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax-pysrc.html b/doc/html/api/lxml.sax-pysrc.html new file mode 100644 index 00000000..be4b0d1a --- /dev/null +++ b/doc/html/api/lxml.sax-pysrc.html @@ -0,0 +1,686 @@ + + + + + lxml.sax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.sax

+
+  1  # cython: language_level=2 
+  2   
+  3  """ 
+  4  SAX-based adapter to copy trees from/to the Python standard library. 
+  5   
+  6  Use the `ElementTreeContentHandler` class to build an ElementTree from 
+  7  SAX events. 
+  8   
+  9  Use the `ElementTreeProducer` class or the `saxify()` function to fire 
+ 10  the SAX events of an ElementTree against a SAX ContentHandler. 
+ 11   
+ 12  See http://codespeak.net/lxml/sax.html 
+ 13  """ 
+ 14   
+ 15  from __future__ import absolute_import 
+ 16   
+ 17  from xml.sax.handler import ContentHandler 
+ 18  from lxml import etree 
+ 19  from lxml.etree import ElementTree, SubElement 
+ 20  from lxml.etree import Comment, ProcessingInstruction 
+ 21   
+ 22   
+
23 -class SaxError(etree.LxmlError): +
24 """General SAX error. + 25 """ +
26 + 27 +
28 -def _getNsTag(tag): +
29 if tag[0] == '{': + 30 return tuple(tag[1:].split('}', 1)) + 31 else: + 32 return None, tag +
33 + 34 +
35 -class ElementTreeContentHandler(ContentHandler): +
36 """Build an lxml ElementTree from SAX events. + 37 """ +
38 - def __init__(self, makeelement=None): +
39 ContentHandler.__init__(self) + 40 self._root = None + 41 self._root_siblings = [] + 42 self._element_stack = [] + 43 self._default_ns = None + 44 self._ns_mapping = { None : [None] } + 45 self._new_mappings = {} + 46 if makeelement is None: + 47 makeelement = etree.Element + 48 self._makeelement = makeelement +
49 +
50 - def _get_etree(self): +
51 "Contains the generated ElementTree after parsing is finished." + 52 return ElementTree(self._root) +
53 + 54 etree = property(_get_etree, doc=_get_etree.__doc__) + 55 +
56 - def setDocumentLocator(self, locator): +
57 pass +
58 +
59 - def startDocument(self): +
60 pass +
61 +
62 - def endDocument(self): +
63 pass +
64 +
65 - def startPrefixMapping(self, prefix, uri): +
66 self._new_mappings[prefix] = uri + 67 try: + 68 self._ns_mapping[prefix].append(uri) + 69 except KeyError: + 70 self._ns_mapping[prefix] = [uri] + 71 if prefix is None: + 72 self._default_ns = uri +
73 +
74 - def endPrefixMapping(self, prefix): +
75 ns_uri_list = self._ns_mapping[prefix] + 76 ns_uri_list.pop() + 77 if prefix is None: + 78 self._default_ns = ns_uri_list[-1] +
79 +
80 - def _buildTag(self, ns_name_tuple): +
81 ns_uri, local_name = ns_name_tuple + 82 if ns_uri: + 83 el_tag = "{%s}%s" % ns_name_tuple + 84 elif self._default_ns: + 85 el_tag = "{%s}%s" % (self._default_ns, local_name) + 86 else: + 87 el_tag = local_name + 88 return el_tag +
89 +
90 - def startElementNS(self, ns_name, qname, attributes=None): +
91 el_name = self._buildTag(ns_name) + 92 if attributes: + 93 attrs = {} + 94 try: + 95 iter_attributes = attributes.iteritems() + 96 except AttributeError: + 97 iter_attributes = attributes.items() + 98 + 99 for name_tuple, value in iter_attributes: +100 if name_tuple[0]: +101 attr_name = "{%s}%s" % name_tuple +102 else: +103 attr_name = name_tuple[1] +104 attrs[attr_name] = value +105 else: +106 attrs = None +107 +108 element_stack = self._element_stack +109 if self._root is None: +110 element = self._root = \ +111 self._makeelement(el_name, attrs, self._new_mappings) +112 if self._root_siblings and hasattr(element, 'addprevious'): +113 for sibling in self._root_siblings: +114 element.addprevious(sibling) +115 del self._root_siblings[:] +116 else: +117 element = SubElement(element_stack[-1], el_name, +118 attrs, self._new_mappings) +119 element_stack.append(element) +120 +121 self._new_mappings.clear() +
122 +
123 - def processingInstruction(self, target, data): +
124 pi = ProcessingInstruction(target, data) +125 if self._root is None: +126 self._root_siblings.append(pi) +127 else: +128 self._element_stack[-1].append(pi) +
129 +
130 - def endElementNS(self, ns_name, qname): +
131 element = self._element_stack.pop() +132 el_tag = self._buildTag(ns_name) +133 if el_tag != element.tag: +134 raise SaxError("Unexpected element closed: " + el_tag) +
135 +
136 - def startElement(self, name, attributes=None): +
137 if attributes: +138 attributes = dict( +139 [((None, k), v) for k, v in attributes.items()] +140 ) +141 self.startElementNS((None, name), name, attributes) +
142 +
143 - def endElement(self, name): +
144 self.endElementNS((None, name), name) +
145 +
146 - def characters(self, data): +
147 last_element = self._element_stack[-1] +148 try: +149 # if there already is a child element, we must append to its tail +150 last_element = last_element[-1] +151 last_element.tail = (last_element.tail or '') + data +152 except IndexError: +153 # otherwise: append to the text +154 last_element.text = (last_element.text or '') + data +
155 +156 ignorableWhitespace = characters +
157 +158 +
159 -class ElementTreeProducer(object): +
160 """Produces SAX events for an element and children. +161 """ +
162 - def __init__(self, element_or_tree, content_handler): +
163 try: +164 element = element_or_tree.getroot() +165 except AttributeError: +166 element = element_or_tree +167 self._element = element +168 self._content_handler = content_handler +169 from xml.sax.xmlreader import AttributesNSImpl as attr_class +170 self._attr_class = attr_class +171 self._empty_attributes = attr_class({}, {}) +
172 +
173 - def saxify(self): +
174 self._content_handler.startDocument() +175 +176 element = self._element +177 if hasattr(element, 'getprevious'): +178 siblings = [] +179 sibling = element.getprevious() +180 while getattr(sibling, 'tag', None) is ProcessingInstruction: +181 siblings.append(sibling) +182 sibling = sibling.getprevious() +183 for sibling in siblings[::-1]: +184 self._recursive_saxify(sibling, {}) +185 +186 self._recursive_saxify(element, {}) +187 +188 if hasattr(element, 'getnext'): +189 sibling = element.getnext() +190 while getattr(sibling, 'tag', None) is ProcessingInstruction: +191 self._recursive_saxify(sibling, {}) +192 sibling = sibling.getnext() +193 +194 self._content_handler.endDocument() +
195 +
196 - def _recursive_saxify(self, element, parent_nsmap): +
197 content_handler = self._content_handler +198 tag = element.tag +199 if tag is Comment or tag is ProcessingInstruction: +200 if tag is ProcessingInstruction: +201 content_handler.processingInstruction( +202 element.target, element.text) +203 tail = element.tail +204 if tail: +205 content_handler.characters(tail) +206 return +207 +208 element_nsmap = element.nsmap +209 new_prefixes = [] +210 if element_nsmap != parent_nsmap: +211 # There have been updates to the namespace +212 for prefix, ns_uri in element_nsmap.items(): +213 if parent_nsmap.get(prefix) != ns_uri: +214 new_prefixes.append( (prefix, ns_uri) ) +215 +216 attribs = element.items() +217 if attribs: +218 attr_values = {} +219 attr_qnames = {} +220 for attr_ns_name, value in attribs: +221 attr_ns_tuple = _getNsTag(attr_ns_name) +222 attr_values[attr_ns_tuple] = value +223 attr_qnames[attr_ns_tuple] = self._build_qname( +224 attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap, +225 preferred_prefix=None, is_attribute=True) +226 sax_attributes = self._attr_class(attr_values, attr_qnames) +227 else: +228 sax_attributes = self._empty_attributes +229 +230 ns_uri, local_name = _getNsTag(tag) +231 qname = self._build_qname( +232 ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False) +233 +234 for prefix, uri in new_prefixes: +235 content_handler.startPrefixMapping(prefix, uri) +236 content_handler.startElementNS( +237 (ns_uri, local_name), qname, sax_attributes) +238 text = element.text +239 if text: +240 content_handler.characters(text) +241 for child in element: +242 self._recursive_saxify(child, element_nsmap) +243 content_handler.endElementNS((ns_uri, local_name), qname) +244 for prefix, uri in new_prefixes: +245 content_handler.endPrefixMapping(prefix) +246 tail = element.tail +247 if tail: +248 content_handler.characters(tail) +
249 +
250 - def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute): +
251 if ns_uri is None: +252 return local_name +253 +254 if not is_attribute and nsmap.get(preferred_prefix) == ns_uri: +255 prefix = preferred_prefix +256 else: +257 # Pick the first matching prefix, in alphabetical order. +258 candidates = [ +259 pfx for (pfx, uri) in nsmap.items() +260 if pfx is not None and uri == ns_uri +261 ] +262 prefix = ( +263 candidates[0] if len(candidates) == 1 +264 else min(candidates) if candidates +265 else None +266 ) +267 +268 if prefix is None: +269 # Default namespace +270 return local_name +271 return prefix + ':' + local_name +
272 +273 +
274 -def saxify(element_or_tree, content_handler): +
275 """One-shot helper to generate SAX events from an XML tree and fire +276 them against a SAX ContentHandler. +277 """ +278 return ElementTreeProducer(element_or_tree, content_handler).saxify() +
279 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..bc5b4f68 --- /dev/null +++ b/doc/html/api/lxml.sax.ElementTreeContentHandler-class.html @@ -0,0 +1,919 @@ + + + + + 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 + +
+ +
+   + + + + + + +
_buildTag(self, + ns_name_tuple) + 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 +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'ElementTreeContentHandler' +
+ + + + + + + + + +
+ + + + + +
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 00000000..6bf9580f --- /dev/null +++ b/doc/html/api/lxml.sax.ElementTreeProducer-class.html @@ -0,0 +1,401 @@ + + + + + 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 help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
saxify(self) + source code + +
+ +
+   + + + + + + +
_recursive_saxify(self, + element, + parent_nsmap) + source code + +
+ +
+   + + + + + + +
_build_qname(self, + ns_uri, + local_name, + nsmap, + preferred_prefix, + is_attribute) + source code + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + source code + +
+ +
+   + + + + + + +
__reduce__(...)
+ helper for pickle
+ source code + +
+ +
+   + + + + + + +
__setstate__(...) + source code + +
+ +
+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

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

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

__reduce__(...) +

+
source code  +
+ + helper for pickle +
+
Overrides: + object.__reduce__ +
(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 00000000..2fc8be0c --- /dev/null +++ b/doc/html/api/lxml.sax.SaxError-class.html @@ -0,0 +1,232 @@ + + + + + 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__, + __new__ +

+

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

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + __qualname__ = 'SaxError' +
+ + + + + + + + + +
+ + + + + +
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 00000000..0ef66a49 --- /dev/null +++ b/doc/html/api/lxml.tests-module.html @@ -0,0 +1,197 @@ + + + + + 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]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None
+ hash(x) +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests-pysrc.html b/doc/html/api/lxml.tests-pysrc.html new file mode 100644 index 00000000..2e715354 --- /dev/null +++ b/doc/html/api/lxml.tests-pysrc.html @@ -0,0 +1,125 @@ + + + + + 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 00000000..32ce6e27 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports-module.html @@ -0,0 +1,604 @@ + + + + + lxml.tests.common_imports + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module common_imports

source code

+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + skipif
+ Using a class because a function would bind into a method when used in classes +
+   + + HelperTestCase +
+   + + SillyFileLike +
+   + + LargeFileLike +
+   + + LargeFileLikeUnicode +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
make_version_tuple(version_string) + source code + +
+ +
+   + + + + + + +
filter_by_version(test_class, + version_dict, + current_version)
+ Remove test methods that do not work with the current lib version.
+ 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 + +
+ +
+   + + + + + + +
path2url(path) + source code + +
+ +
+   + + + + + + +
fileUrlInTestDir(name) + source code + +
+ +
+   + + + + + + +
read_file(name, + mode='r') + source code + +
+ +
+   + + + + + + +
write_to_file(name, + data, + mode='w') + source code + +
+ +
+   + + + + + + +
readFileInTestDir(name, + mode='r') + source code + +
+ +
+   + + + + + + +
canonicalize(xml) + source code + +
+ +
+   + + + + + + +
tmpfile(*args, + **kwds) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + IS_PYPY = False +
+   + + IS_PYTHON3 = False +
+   + + IS_PYTHON2 = True +
+   + + ET_VERSION = (1, 3, 0) +
+   + + CET_VERSION = (1, 0, 6) +
+   + + unichr_escape = re.compile(r'\\u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}') +
+   + + _fix_unicode = re.compile(r'(\s+)u(["\'])').sub +
+   + + doctest_parser = <doctest.DocTestParser object> +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

tmpfile(*args, + **kwds) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @contextmanager
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..d3daa263 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports-pysrc.html @@ -0,0 +1,675 @@ + + + + + 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 gc 
+  2  import os 
+  3  import os.path 
+  4  import re 
+  5  import sys 
+  6  import tempfile 
+  7  import unittest 
+  8  from contextlib import contextmanager 
+  9   
+ 10  try: 
+ 11      import urlparse 
+ 12  except ImportError: 
+ 13      import urllib.parse as urlparse  
+ 14   
+ 15  try: 
+ 16      from urllib import pathname2url 
+ 17  except: 
+ 18      from urllib.request import pathname2url 
+ 19   
+ 20  from lxml import etree, html 
+
21 + 22 -def make_version_tuple(version_string): +
23 return tuple( + 24 int(part) if part.isdigit() else part + 25 for part in re.findall('([0-9]+|[^0-9.]+)', version_string) + 26 ) +
27 + 28 IS_PYPY = (getattr(sys, 'implementation', None) == 'pypy' or + 29 getattr(sys, 'pypy_version_info', None) is not None) + 30 + 31 IS_PYTHON3 = sys.version_info[0] >= 3 + 32 IS_PYTHON2 = sys.version_info[0] < 3 + 33 + 34 from xml.etree import ElementTree + 35 + 36 if hasattr(ElementTree, 'VERSION'): + 37 ET_VERSION = make_version_tuple(ElementTree.VERSION) + 38 else: + 39 ET_VERSION = (0,0,0) + 40 + 41 if IS_PYTHON2: + 42 from xml.etree import cElementTree + 43 + 44 if hasattr(cElementTree, 'VERSION'): + 45 CET_VERSION = make_version_tuple(cElementTree.VERSION) + 46 else: + 47 CET_VERSION = (0,0,0) + 48 else: + 49 CET_VERSION = (0, 0, 0) + 50 cElementTree = None +
51 + 52 + 53 -def filter_by_version(test_class, version_dict, current_version): +
54 """Remove test methods that do not work with the current lib version. + 55 """ + 56 find_required_version = version_dict.get + 57 def dummy_test_method(self): + 58 pass +
59 for name in dir(test_class): + 60 expected_version = find_required_version(name, (0,0,0)) + 61 if expected_version > current_version: + 62 setattr(test_class, name, dummy_test_method) + 63 + 64 import doctest + 65 + 66 try: + 67 next + 68 except NameError: +
69 - def next(it): +
70 return it.next() +
71 else: + 72 locals()['next'] = next + 73 + 74 + 75 try: + 76 import pytest + 77 except ImportError: +
78 - class skipif(object): +
79 "Using a class because a function would bind into a method when used in classes" +
80 - def __init__(self, *args): pass +
81 - def __call__(self, func, *args): return func +
82 else: + 83 skipif = pytest.mark.skipif +
84 + 85 -def _get_caller_relative_path(filename, frame_depth=2): +
86 module = sys.modules[sys._getframe(frame_depth).f_globals['__name__']] + 87 return os.path.normpath(os.path.join( + 88 os.path.dirname(getattr(module, '__file__', '')), filename)) +
89 + 90 from io import StringIO + 91 + 92 unichr_escape = re.compile(r'\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}') + 93 + 94 if sys.version_info[0] >= 3: + 95 # Python 3 + 96 from builtins import str as unicode + 97 from codecs import unicode_escape_decode + 98 _chr = chr +
99 - def _str(s, encoding="UTF-8"): +
100 return unichr_escape.sub(lambda x: unicode_escape_decode(x.group(0))[0], s) +
101 - def _bytes(s, encoding="UTF-8"): +
102 return s.encode(encoding) +
103 from io import BytesIO as _BytesIO +
104 - def BytesIO(*args): +
105 if args and isinstance(args[0], str): +106 args = (args[0].encode("UTF-8"),) +107 return _BytesIO(*args) +
108 +109 doctest_parser = doctest.DocTestParser() +110 _fix_unicode = re.compile(r'(\s+)u(["\'])').sub +111 _fix_exceptions = re.compile(r'(.*except [^(]*),\s*(.*:)').sub +
112 - def make_doctest(filename): +
113 filename = _get_caller_relative_path(filename) +114 doctests = read_file(filename) +115 doctests = _fix_unicode(r'\1\2', doctests) +116 doctests = _fix_exceptions(r'\1 as \2', doctests) +117 return doctest.DocTestCase( +118 doctest_parser.get_doctest( +119 doctests, {}, os.path.basename(filename), filename, 0)) +
120 else: +121 # Python 2 +122 from __builtin__ import unicode +123 _chr = unichr +
124 - def _str(s, encoding="UTF-8"): +
125 s = unicode(s, encoding=encoding) +126 return unichr_escape.sub(lambda x: +127 x.group(0).decode('unicode-escape'), +128 s) +
129 - def _bytes(s, encoding="UTF-8"): +
130 return s +
131 from io import BytesIO +132 +133 doctest_parser = doctest.DocTestParser() +134 _fix_traceback = re.compile(r'^(\s*)(?:\w+\.)+(\w*(?:Error|Exception|Invalid):)', re.M).sub +135 _fix_exceptions = re.compile(r'(.*except [^(]*)\s+as\s+(.*:)').sub +136 _fix_bytes = re.compile(r'(\s+)b(["\'])').sub +
137 - def make_doctest(filename): +
138 filename = _get_caller_relative_path(filename) +139 doctests = read_file(filename) +140 doctests = _fix_traceback(r'\1\2', doctests) +141 doctests = _fix_exceptions(r'\1, \2', doctests) +142 doctests = _fix_bytes(r'\1\2', doctests) +143 return doctest.DocTestCase( +144 doctest_parser.get_doctest( +145 doctests, {}, os.path.basename(filename), filename, 0)) +
146 +147 try: +148 skipIf = unittest.skipIf +149 except AttributeError: +
150 - def skipIf(condition, why): +
151 def _skip(thing): +152 import types +153 if isinstance(thing, (type, types.ClassType)): +154 return type(thing.__name__, (object,), {}) +155 else: +156 return None +
157 if condition: +158 return _skip +159 return lambda thing: thing +160 +
161 +162 -class HelperTestCase(unittest.TestCase): +
163 - def tearDown(self): +
164 gc.collect() +
165 +
166 - def parse(self, text, parser=None): +
167 f = BytesIO(text) if isinstance(text, bytes) else StringIO(text) +168 return etree.parse(f, parser=parser) +
169 +
170 - def _rootstring(self, tree): +
171 return etree.tostring(tree.getroot()).replace( +172 _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) +
173 +
174 +175 -class SillyFileLike: +
176 - def __init__(self, xml_data=_bytes('<foo><bar/></foo>')): +
177 self.xml_data = xml_data +
178 +
179 - def read(self, amount=None): +
180 if self.xml_data: +181 if amount: +182 data = self.xml_data[:amount] +183 self.xml_data = self.xml_data[amount:] +184 else: +185 data = self.xml_data +186 self.xml_data = _bytes('') +187 return data +188 return _bytes('') +
189 +
190 -class LargeFileLike: +
191 - def __init__(self, charlen=100, depth=4, children=5): +
192 self.data = BytesIO() +193 self.chars = _bytes('a') * charlen +194 self.children = range(children) +195 self.more = self.iterelements(depth) +
196 +
197 - def iterelements(self, depth): +
198 yield _bytes('<root>') +199 depth -= 1 +200 if depth > 0: +201 for child in self.children: +202 for element in self.iterelements(depth): +203 yield element +204 yield self.chars +205 else: +206 yield self.chars +207 yield _bytes('</root>') +
208 +
209 - def read(self, amount=None): +
210 data = self.data +211 append = data.write +212 if amount: +213 for element in self.more: +214 append(element) +215 if data.tell() >= amount: +216 break +217 else: +218 for element in self.more: +219 append(element) +220 result = data.getvalue() +221 data.seek(0) +222 data.truncate() +223 if amount: +224 append(result[amount:]) +225 result = result[:amount] +226 return result +
227 +
228 -class LargeFileLikeUnicode(LargeFileLike): +
229 - def __init__(self, charlen=100, depth=4, children=5): +
230 LargeFileLike.__init__(self, charlen, depth, children) +231 self.data = StringIO() +232 self.chars = _str('a') * charlen +233 self.more = self.iterelements(depth) +
234 +
235 - def iterelements(self, depth): +
236 yield _str('<root>') +237 depth -= 1 +238 if depth > 0: +239 for child in self.children: +240 for element in self.iterelements(depth): +241 yield element +242 yield self.chars +243 else: +244 yield self.chars +245 yield _str('</root>') +
246 +
247 -def fileInTestDir(name): +
248 _testdir = os.path.dirname(__file__) +249 return os.path.join(_testdir, name) +
250 +
251 -def path2url(path): +
252 return urlparse.urljoin( +253 'file:', pathname2url(path)) +
254 +
255 -def fileUrlInTestDir(name): +
256 return path2url(fileInTestDir(name)) +
257 +
258 -def read_file(name, mode='r'): +
259 with open(name, mode) as f: +260 data = f.read() +261 return data +
262 +
263 -def write_to_file(name, data, mode='w'): +
264 with open(name, mode) as f: +265 f.write(data) +
266 +
267 -def readFileInTestDir(name, mode='r'): +
268 return read_file(fileInTestDir(name), mode) +
269 +
270 -def canonicalize(xml): +
271 tree = etree.parse(BytesIO(xml) if isinstance(xml, bytes) else StringIO(xml)) +272 f = BytesIO() +273 tree.write_c14n(f) +274 return f.getvalue() +
275 +
276 +277 @contextmanager +278 -def tmpfile(**kwargs): +
279 handle, filename = tempfile.mkstemp(**kwargs) +280 try: +281 yield filename +282 finally: +283 os.close(handle) +284 os.remove(filename) +
285 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..52a83ef2 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.HelperTestCase-class.html @@ -0,0 +1,436 @@ + + + + + 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.case.TestCase --+
+                         |
+                        HelperTestCase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.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 00000000..3943a4bf --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.LargeFileLike-class.html @@ -0,0 +1,195 @@ + + + + + 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 00000000..8aecc9cd --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.LargeFileLikeUnicode-class.html @@ -0,0 +1,253 @@ + + + + + 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 00000000..584f45b1 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.SillyFileLike-class.html @@ -0,0 +1,169 @@ + + + + + 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.common_imports.skipif-class.html b/doc/html/api/lxml.tests.common_imports.skipif-class.html new file mode 100644 index 00000000..1e62ad9e --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.skipif-class.html @@ -0,0 +1,267 @@ + + + + + lxml.tests.common_imports.skipif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports :: + Class skipif + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class skipif

source code

+
+object --+
+         |
+        skipif
+
+ +
+Using a class because a function would bind into a method when used in classes + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + func, + *args) + source code + +
+ +
+   + + + + + + +
__init__(self, + *args)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + *args) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.dummy_http_server-module.html b/doc/html/api/lxml.tests.dummy_http_server-module.html new file mode 100644 index 00000000..85a87f7f --- /dev/null +++ b/doc/html/api/lxml.tests.dummy_http_server-module.html @@ -0,0 +1,286 @@ + + + + + lxml.tests.dummy_http_server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module dummy_http_server + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module dummy_http_server

source code

+Simple HTTP request dumper for tests. + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + WebServer
+ A web server that starts a new thread for each request. +
+   + + _RequestHandler +
+   + + HTTPRequestCollector +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
webserver(*args, + **kwds)
+ Context manager entry point for the 'with' statement.
+ source code + +
+ +
+   + + + + + + +
build_web_server(app, + port, + host=None) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

webserver(*args, + **kwds) +

+
source code  +
+ +

Context manager entry point for the 'with' statement.

+

Pass 0 as port number to dynamically allocate a free port.

+

Usage:

+
+
with webserver(wsgi_app_function, 8080) as host_url:
+
do_ws_calls(host_url)
+
+
+
Decorators:
+
    +
  • @contextmanager
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.dummy_http_server-pysrc.html b/doc/html/api/lxml.tests.dummy_http_server-pysrc.html new file mode 100644 index 00000000..60832cc5 --- /dev/null +++ b/doc/html/api/lxml.tests.dummy_http_server-pysrc.html @@ -0,0 +1,221 @@ + + + + + lxml.tests.dummy_http_server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module dummy_http_server + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.dummy_http_server

+
+ 1  """ 
+ 2  Simple HTTP request dumper for tests. 
+ 3  """ 
+ 4   
+ 5  import sys 
+ 6  from contextlib import contextmanager 
+ 7   
+ 8  try: 
+ 9      import urlparse 
+10  except ImportError: 
+11      # Python 3 
+12      import urllib.parse as urlparse 
+
13 +14 +15 @contextmanager +16 -def webserver(app, port=0, host=None): +
17 """Context manager entry point for the 'with' statement. +18 +19 Pass 0 as port number to dynamically allocate a free port. +20 +21 Usage: +22 +23 with webserver(wsgi_app_function, 8080) as host_url: +24 do_ws_calls(host_url) +25 """ +26 server = build_web_server(app, port, host or '127.0.0.1') +27 host, port = server.socket.getsockname() +28 +29 import threading +30 thread = threading.Thread(target=server.serve_forever, +31 kwargs={'poll_interval': 0.5}) +32 thread.setDaemon(True) +33 thread.start() +34 try: +35 yield 'http://%s:%s/' % (host, port) # yield control to 'with' body +36 finally: +37 server.shutdown() +38 server.server_close() +39 thread.join(timeout=1) +
40 +41 +42 try: +43 from SocketServer import ThreadingMixIn +44 except ImportError: +45 # Python 3 +46 from socketserver import ThreadingMixIn +47 +48 import wsgiref.simple_server as wsgiserver +
49 -class WebServer(wsgiserver.WSGIServer, ThreadingMixIn): +
50 """A web server that starts a new thread for each request. +51 """ +
52 +
53 +54 -class _RequestHandler(wsgiserver.WSGIRequestHandler): +
55 - def get_stderr(self): +
56 # don't write to stderr +57 return sys.stdout +
58 +
59 - def log_message(self, format, *args): +
60 # message = "wsmock(%s) %s" % (self.address_string(), format % args) +61 pass # don't log messages +
62 +
63 +64 -def build_web_server(app, port, host=None): +
65 server = wsgiserver.make_server( +66 host or '', port, app, +67 server_class=WebServer, +68 handler_class=_RequestHandler) +69 return server +
70 +
71 +72 -class HTTPRequestCollector(object): +
73 - def __init__(self, response_data, response_code=200, headers=()): +
74 self.requests = [] +75 self.response_code = response_code +76 self.response_data = response_data +77 self.headers = list(headers or ()) +
78 +
79 - def __call__(self, environ, start_response): +
80 self.requests.append(( +81 environ.get('PATH_INFO'), +82 urlparse.parse_qsl(environ.get('QUERY_STRING')))) +83 start_response('%s OK' % self.response_code, self.headers) +84 return [self.response_data] +
85 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.dummy_http_server.HTTPRequestCollector-class.html b/doc/html/api/lxml.tests.dummy_http_server.HTTPRequestCollector-class.html new file mode 100644 index 00000000..57f2d0dc --- /dev/null +++ b/doc/html/api/lxml.tests.dummy_http_server.HTTPRequestCollector-class.html @@ -0,0 +1,269 @@ + + + + + lxml.tests.dummy_http_server.HTTPRequestCollector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module dummy_http_server :: + Class HTTPRequestCollector + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTTPRequestCollector

source code

+
+object --+
+         |
+        HTTPRequestCollector
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + response_data, + response_code=200, + headers=())
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + environ, + start_response) + source code + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + response_data, + response_code=200, + headers=()) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.dummy_http_server.WebServer-class.html b/doc/html/api/lxml.tests.dummy_http_server.WebServer-class.html new file mode 100644 index 00000000..e9c14512 --- /dev/null +++ b/doc/html/api/lxml.tests.dummy_http_server.WebServer-class.html @@ -0,0 +1,226 @@ + + + + + lxml.tests.dummy_http_server.WebServer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module dummy_http_server :: + Class WebServer + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class WebServer

source code

+
+SocketServer.BaseServer --+            
+                          |            
+     SocketServer.TCPServer --+        
+                              |        
+      BaseHTTPServer.HTTPServer --+    
+                                  |    
+   wsgiref.simple_server.WSGIServer --+
+                                      |
+        SocketServer.ThreadingMixIn --+
+                                      |
+                                     WebServer
+
+ +
+A web server that starts a new thread for each request. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from wsgiref.simple_server.WSGIServer: + get_app, + server_bind, + set_app, + setup_environ +

+

Inherited from SocketServer.TCPServer: + __init__, + close_request, + fileno, + get_request, + server_activate, + server_close, + shutdown_request +

+

Inherited from SocketServer.BaseServer: + finish_request, + handle_error, + handle_request, + handle_timeout, + process_request, + serve_forever, + shutdown, + verify_request +

+

Inherited from SocketServer.BaseServer (private): + _handle_request_noblock +

+

Inherited from SocketServer.ThreadingMixIn: + process_request_thread +

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

Inherited from wsgiref.simple_server.WSGIServer: + application +

+

Inherited from BaseHTTPServer.HTTPServer: + allow_reuse_address +

+

Inherited from SocketServer.TCPServer: + address_family, + request_queue_size, + socket_type +

+

Inherited from SocketServer.BaseServer: + timeout +

+

Inherited from SocketServer.ThreadingMixIn: + daemon_threads +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.dummy_http_server._RequestHandler-class.html b/doc/html/api/lxml.tests.dummy_http_server._RequestHandler-class.html new file mode 100644 index 00000000..b417313b --- /dev/null +++ b/doc/html/api/lxml.tests.dummy_http_server._RequestHandler-class.html @@ -0,0 +1,353 @@ + + + + + lxml.tests.dummy_http_server._RequestHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module dummy_http_server :: + Class _RequestHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _RequestHandler

source code

+
+SocketServer.BaseRequestHandler --+            
+                                  |            
+  SocketServer.StreamRequestHandler --+        
+                                      |        
+  BaseHTTPServer.BaseHTTPRequestHandler --+    
+                                          |    
+   wsgiref.simple_server.WSGIRequestHandler --+
+                                              |
+                                             _RequestHandler
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + MessageClass +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
get_stderr(self) + source code + +
+ +
+   + + + + + + +
log_message(self, + format, + *args)
+ Log an arbitrary message.
+ source code + +
+ +
+

Inherited from wsgiref.simple_server.WSGIRequestHandler: + get_environ, + handle +

+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + address_string, + date_time_string, + end_headers, + handle_one_request, + log_date_time_string, + log_error, + log_request, + parse_request, + send_error, + send_header, + send_response, + version_string +

+

Inherited from SocketServer.StreamRequestHandler: + finish, + setup +

+

Inherited from SocketServer.BaseRequestHandler: + __init__ +

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

Inherited from wsgiref.simple_server.WSGIRequestHandler: + server_version +

+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + default_request_version, + error_content_type, + error_message_format, + monthname, + protocol_version, + responses, + sys_version, + weekdayname +

+

Inherited from SocketServer.StreamRequestHandler: + disable_nagle_algorithm, + rbufsize, + timeout, + wbufsize +

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

get_stderr(self) +

+
source code  +
+ + +
+
Overrides: + wsgiref.simple_server.WSGIRequestHandler.get_stderr +
+
+
+
+ +
+ +
+ + +
+

log_message(self, + format, + *args) +

+
source code  +
+ +

Log an arbitrary message.

+

This is used by all other logging functions. Override +it if you have specific logging wishes.

+

The first argument, FORMAT, is a format string for the +message to be logged. If the format string contains +any % escapes requiring parameters, they should be +specified as subsequent arguments (it's just like +printf!).

+

The client ip address and current date/time are prefixed to every +message.

+
+
Overrides: + BaseHTTPServer.BaseHTTPRequestHandler.log_message +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.selftest-module.html b/doc/html/api/lxml.tests.selftest-module.html new file mode 100644 index 00000000..ed72b83a --- /dev/null +++ b/doc/html/api/lxml.tests.selftest-module.html @@ -0,0 +1,1200 @@ + + + + + lxml.tests.selftest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module selftest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module selftest

source code

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
stdout() + source code + +
+ +
+   + + + + + + +
fix_compatibility(xml_data) + source code + +
+ +
+   + + + + + + +
serialize(elem, + **options) + source code + +
+ +
+   + + + + + + +
summarize(elem) + source code + +
+ +
+   + + + + + + +
summarize_list(seq) + source code + +
+ +
+   + + + + + + +
normalize_crlf(tree) + source code + +
+ +
+   + + + + + + +
check_string(string) + source code + +
+ +
+   + + + + + + +
check_string_or_none(value) + source code + +
+ +
+   + + + + + + +
check_mapping(mapping) + source code + +
+ +
+   + + + + + + +
check_element(element) + source code + +
+ +
+   + + + + + + +
check_element_tree(tree) + source code + +
+ +
+   + + + + + + +
interface()
+ Test element tree interface.
+ source code + +
+ +
+   + + + + + + +
simpleops() + source code + +
+ +
+   + + + + + + +
find()
+ Test find methods (including xpath syntax).
+ source code + +
+ +
+   + + + + + + +
bad_find()
+ Check bad or unsupported path expressions.
+ source code + +
+ +
+   + + + + + + +
parsefile()
+ Test parsing from file.
+ source code + +
+ +
+   + + + + + + +
parseliteral()
+ ## >>> sequence = ["<html><body>", "text</bo", "dy></html>"] +## >>> element = ElementTree.fromstringlist(sequence) +## >>> ElementTree.ElementTree(element).write(stdout()) +## <html><body>text</body></html>
+ source code + +
+ +
+   + + + + + + +
iterparse()
+ Test iterparse interface.
+ source code + +
+ +
+   + + + + + + +
writefile()
+ ## Test tag suppression +## >>> elem.tag = None +## >>> serialize(elem) +## 'text<subtag>subtext</subtag>'
+ source code + +
+ +
+   + + + + + + +
writestring() + source code + +
+ +
+   + + + + + + +
encoding()
+ Test encoding issues.
+ source code + +
+ +
+   + + + + + + +
iterators()
+ Test iterators.
+ source code + +
+ +
+   + + + + + + +
namespace()
+ Test namespace issues.
+ source code + +
+ +
+   + + + + + + +
qname()
+ Test QName handling.
+ source code + +
+ +
+   + + + + + + +
xpath_tokenizer(p)
+ Test the XPath tokenizer.
+ source code + +
+ +
+   + + + + + + +
xinclude_loader(href, + parse='xml', + encoding=None) + source code + +
+ +
+   + + + + + + +
xinclude()
+ Basic inclusion example (XInclude C.1)
+ source code + +
+ +
+   + + + + + + +
xinclude_default() + source code + +
+ +
+   + + + + + + +
bug_xmltoolkit25()
+ typo in ElementTree.findtext
+ source code + +
+ +
+   + + + + + + +
bug_xmltoolkit28()
+ .//tag causes exceptions
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + SAMPLE_XML = ElementTree.XML(... +
+   + + ENTITY_XML = '<!DOCTYPE points [\n<!ENTITY % user-entities SYS... +
+   + + XINCLUDE = {'C1.xml': '<?xml version=\'1.0\'?>\n<document xmln... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

find() +

+
source code  +
+ +

Test find methods (including xpath syntax).

+
+>>> elem = SAMPLE_XML
+>>> elem.find("tag").tag
+'tag'
+>>> ElementTree.ElementTree(elem).find("tag").tag
+'tag'
+>>> elem.find("section/tag").tag
+'tag'
+>>> ElementTree.ElementTree(elem).find("section/tag").tag
+'tag'
+>>> elem.findtext("tag")
+'text'
+>>> elem.findtext("tog")
+>>> elem.findtext("tog", "default")
+'default'
+>>> ElementTree.ElementTree(elem).findtext("tag")
+'text'
+>>> elem.findtext("section/tag")
+'subtext'
+>>> ElementTree.ElementTree(elem).findtext("section/tag")
+'subtext'
+>>> summarize_list(elem.findall("tag"))
+['tag', 'tag']
+>>> summarize_list(elem.findall("*"))
+['tag', 'tag', 'section']
+>>> summarize_list(elem.findall(".//tag"))
+['tag', 'tag', 'tag']
+>>> summarize_list(elem.findall("section/tag"))
+['tag']
+>>> summarize_list(elem.findall("section//tag"))
+['tag']
+>>> summarize_list(elem.findall("section/*"))
+['tag']
+>>> summarize_list(elem.findall("section//*"))
+['tag']
+>>> summarize_list(elem.findall("section/.//*"))
+['tag']
+>>> summarize_list(elem.findall("*/*"))
+['tag']
+>>> summarize_list(elem.findall("*//*"))
+['tag']
+>>> summarize_list(elem.findall("*/tag"))
+['tag']
+>>> summarize_list(elem.findall("*/./tag"))
+['tag']
+>>> summarize_list(elem.findall("./tag"))
+['tag', 'tag']
+>>> summarize_list(elem.findall(".//tag"))
+['tag', 'tag', 'tag']
+>>> summarize_list(elem.findall("././tag"))
+['tag', 'tag']
+>>> summarize_list(elem.findall(".//tag[@class]"))
+['tag', 'tag', 'tag']
+>>> summarize_list(elem.findall(".//tag[@class='a']"))
+['tag']
+>>> summarize_list(elem.findall(".//tag[@class='b']"))
+['tag', 'tag']
+>>> summarize_list(elem.findall(".//tag[@id]"))
+['tag']
+>>> summarize_list(elem.findall(".//section[tag]"))
+['section']
+>>> summarize_list(elem.findall(".//section[element]"))
+[]
+>>> summarize_list(elem.findall("../tag"))
+[]
+>>> summarize_list(elem.findall("section/../tag"))
+['tag', 'tag']
+>>> summarize_list(ElementTree.ElementTree(elem).findall("./tag"))
+['tag', 'tag']
+

FIXME: ET's Path module handles this case incorrectly; this gives +a warning in 1.3, and the behaviour will be modified in 1.4.

+
+>>> summarize_list(ElementTree.ElementTree(elem).findall("/tag"))
+['tag', 'tag']
+
+
+
+
+ +
+ +
+ + +
+

bad_find() +

+
source code  +
+ +

Check bad or unsupported path expressions.

+
+>>> elem = SAMPLE_XML
+>>> elem.findall("/tag")
+Traceback (most recent call last):
+SyntaxError: cannot use absolute path on element
+

# this is supported in ET 1.3: +#>>> elem.findall("section//") +#Traceback (most recent call last): +#SyntaxError: invalid path

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

parsefile() +

+
source code  +
+ +
+

Test parsing from file.

+
+>>> tree = ElementTree.parse("samples/simple.xml")
+>>> normalize_crlf(tree)
+>>> tree.write(stdout())
+<root>
+   <element key="value">text</element>
+   <element>text</element>tail
+   <empty-element/>
+</root>
+>>> tree = ElementTree.parse("samples/simple-ns.xml")
+>>> normalize_crlf(tree)
+>>> tree.write(stdout())
+<root xmlns="http://namespace/">
+   <element key="value">text</element>
+   <element>text</element>tail
+   <empty-element/>
+</root>
+
+

## <ns0:root xmlns:ns0="http://namespace/"> +## <ns0:element key="value">text</ns0:element> +## <ns0:element>text</ns0:element>tail +## <ns0:empty-element/> +## </ns0:root>

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

parseliteral() +

+
source code  +
+ +
+
+>>> element = ElementTree.XML("<html><body>text</body></html>")
+>>> ElementTree.ElementTree(element).write(stdout())
+<html><body>text</body></html>
+>>> element = ElementTree.fromstring("<html><body>text</body></html>")
+>>> ElementTree.ElementTree(element).write(stdout())
+<html><body>text</body></html>
+
+

## >>> sequence = ["<html><body>", "text</bo", "dy></html>"] +## >>> element = ElementTree.fromstringlist(sequence) +## >>> ElementTree.ElementTree(element).write(stdout()) +## <html><body>text</body></html>

+
+
+>>> print(repr(ElementTree.tostring(element)).lstrip('b'))
+'<html><body>text</body></html>'
+
+

# looks different in lxml +# >>> print(ElementTree.tostring(element, "ascii")) +# <?xml version='1.0' encoding='ascii'?> +# <html><body>text</body></html>

+
+
+>>> _, ids = ElementTree.XMLID("<html><body>text</body></html>")
+>>> len(ids)
+0
+>>> _, ids = ElementTree.XMLID("<html><body id='body'>text</body></html>")
+>>> len(ids)
+1
+>>> ids["body"].tag
+'body'
+
+
+
+
+
+ +
+ +
+ + +
+

namespace() +

+
source code  +
+ +

Test namespace issues.

+
    +
  1. xml namespace
  2. +
+
+>>> elem = ElementTree.XML("<tag xml:lang='en' />")
+>>> serialize(elem) # 1.1
+'<tag xml:lang="en"/>'
+
    +
  1. other "well-known" namespaces
  2. +
+
+>>> elem = ElementTree.XML("<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' />")
+>>> serialize(elem) # 2.1
+'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>'
+
+>>> elem = ElementTree.XML("<html:html xmlns:html='http://www.w3.org/1999/xhtml' />")
+>>> serialize(elem) # 2.2
+'<html:html xmlns:html="http://www.w3.org/1999/xhtml"/>'
+
+>>> elem = ElementTree.XML("<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope' />")
+>>> serialize(elem) # 2.3
+'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"/>'
+
    +
  1. unknown namespaces
  2. +
+
+
+
+
+ +
+ +
+ + +
+

qname() +

+
source code  +
+ +
+

Test QName handling.

+
    +
  1. decorated tags
  2. +
+
+>>> elem = ElementTree.Element("{uri}tag")
+>>> serialize(elem) # 1.1
+'<ns0:tag xmlns:ns0="uri"/>'
+>>> elem = ElementTree.Element(ElementTree.QName("{uri}tag"))
+>>> serialize(elem) # 1.2
+'<ns0:tag xmlns:ns0="uri"/>'
+>>> elem = ElementTree.Element(ElementTree.QName("uri", "tag"))
+>>> serialize(elem) # 1.3
+'<ns0:tag xmlns:ns0="uri"/>'
+
+

# ns/attribute order ...

+

## 2) decorated attributes

+

## >>> elem.clear() +## >>> elem.attrib["{uri}key"] = "value" +## >>> serialize(elem) # 2.1 +## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>'

+

## >>> elem.clear() +## >>> elem.attrib[ElementTree.QName("{uri}key")] = "value" +## >>> serialize(elem) # 2.2 +## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>'

+

## 3) decorated values are not converted by default, but the +## QName wrapper can be used for values

+

## >>> elem.clear() +## >>> elem.attrib["{uri}key"] = "{uri}value" +## >>> serialize(elem) # 3.1 +## '<ns0:tag ns0:key="{uri}value" xmlns:ns0="uri"/>'

+

## >>> elem.clear() +## >>> elem.attrib["{uri}key"] = ElementTree.QName("{uri}value") +## >>> serialize(elem) # 3.2 +## '<ns0:tag ns0:key="ns0:value" xmlns:ns0="uri"/>'

+

## >>> elem.clear() +## >>> subelem = ElementTree.Element("tag") +## >>> subelem.attrib["{uri1}key"] = ElementTree.QName("{uri2}value") +## >>> elem.append(subelem) +## >>> elem.append(subelem) +## >>> serialize(elem) # 3.3 +## '<ns0:tag xmlns:ns0="uri"><tag ns1:key="ns2:value" xmlns:ns1="uri1" xmlns:ns2="uri2"/><tag ns1:key="ns2:value" xmlns:ns1="uri1" xmlns:ns2="uri2"/></ns0:tag>'

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

xinclude() +

+
source code  +
+ +
+

Basic inclusion example (XInclude C.1)

+
+>>> document = xinclude_loader("C1.xml")
+>>> ElementInclude.include(document, xinclude_loader)
+>>> print(serialize(document)) # C1
+<document>
+  <p>120 Mz is adequate for an average home user.</p>
+  <disclaimer>
+  <p>The opinions represented herein represent those of the individual
+  and should not be interpreted as official policy endorsed by this
+  organization.</p>
+</disclaimer>
+</document>
+

Textual inclusion example (XInclude C.2)

+
+>>> document = xinclude_loader("C2.xml")
+>>> ElementInclude.include(document, xinclude_loader)
+>>> print(serialize(document)) # C2
+<document>
+  <p>This document has been accessed
+  324387 times.</p>
+</document>
+

Textual inclusion of XML example (XInclude C.3)

+
+>>> document = xinclude_loader("C3.xml")
+>>> ElementInclude.include(document, xinclude_loader)
+>>> print(serialize(document)) # C3
+<document>
+  <p>The following is the source of the "data.xml" resource:</p>
+  <example>&lt;?xml version='1.0'?&gt;
+&lt;data&gt;
+  &lt;item&gt;&lt;![CDATA[Brooks &amp; Shields]]&gt;&lt;/item&gt;
+&lt;/data&gt;
+</example>
+</document>
+
+

## Fallback example (XInclude C.5) +## Note! Fallback support is not yet implemented

+

## >>> document = xinclude_loader("C5.xml") +## >>> ElementInclude.include(document, xinclude_loader) +## Traceback (most recent call last): +## IOError: resource not found +## >>> # print(serialize(document)) # C5

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

SAMPLE_XML

+ +
+
+
+
Value:
+
+ElementTree.XML("""
+<body>
+  <tag class='a'>text</tag>
+  <tag class='b' />
+   <section>
+    <tag class='b' id='inner'>subtext</tag>
+   </section>
+</body>
+...
+
+
+
+
+
+ +
+ +
+

ENTITY_XML

+ +
+
+
+
Value:
+
+'''<!DOCTYPE points [
+<!ENTITY % user-entities SYSTEM \'user-entities.xml\'>
+%user-entities;
+]>
+<document>&entity;</document>
+'''
+
+
+
+
+
+ +
+ +
+

XINCLUDE

+ +
+
+
+
Value:
+
+{'C1.xml': '''<?xml version=\'1.0\'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+  <p>120 Mz is adequate for an average home user.</p>
+  <xi:include href="disclaimer.xml"/>
+</document>
+''',
+ 'C2.xml': '''<?xml version=\'1.0\'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.selftest-pysrc.html b/doc/html/api/lxml.tests.selftest-pysrc.html new file mode 100644 index 00000000..b5de6fd8 --- /dev/null +++ b/doc/html/api/lxml.tests.selftest-pysrc.html @@ -0,0 +1,1521 @@ + + + + + lxml.tests.selftest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module selftest + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.selftest

+
+   1  # $Id: selftest.py 3276 2007-09-12 06:52:30Z fredrik $ 
+   2  # -*- coding: iso-8859-1 -*- 
+   3  # elementtree selftest program 
+   4   
+   5  # this test script uses Python's "doctest" module to check that the 
+   6  # *test script* works as expected. 
+   7   
+   8  # TODO: add more elementtree method tests 
+   9  # TODO: add xml/html parsing tests 
+  10  # TODO: etc 
+  11   
+  12  import re, sys 
+  13   
+
14 -def stdout(): +
15 if sys.version_info[0] < 3: + 16 return sys.stdout + 17 class bytes_stdout(object): + 18 def write(self, data): + 19 if isinstance(data, bytes): + 20 data = data.decode('ISO8859-1') + 21 sys.stdout.write(data) +
22 return bytes_stdout() + 23 + 24 try: + 25 from StringIO import StringIO as BytesIO + 26 except ImportError: + 27 from io import BytesIO + 28 + 29 from lxml import etree as ElementTree + 30 from lxml import _elementpath as ElementPath + 31 from lxml import ElementInclude + 32 ET = ElementTree + 33 + 34 #from elementtree import ElementTree + 35 #from elementtree import ElementPath + 36 #from elementtree import ElementInclude + 37 #from elementtree import HTMLTreeBuilder + 38 #from elementtree import SimpleXMLWriter + 39 +
40 -def fix_compatibility(xml_data): +
41 xml_data = re.sub(r'\s*xmlns:[a-z0-9]+="http://www.w3.org/2001/XInclude"', '', xml_data) + 42 xml_data = xml_data.replace(' />', '/>') + 43 if xml_data[-1:] == '\n': + 44 xml_data = xml_data[:-1] + 45 return xml_data +
46 +
47 -def serialize(elem, **options): +
48 file = BytesIO() + 49 tree = ElementTree.ElementTree(elem) + 50 tree.write(file, **options) + 51 if sys.version_info[0] < 3: + 52 try: + 53 encoding = options["encoding"] + 54 except KeyError: + 55 encoding = "utf-8" + 56 else: + 57 encoding = 'ISO8859-1' + 58 result = fix_compatibility(file.getvalue().decode(encoding)) + 59 if sys.version_info[0] < 3: + 60 result = result.encode(encoding) + 61 return result +
62 +
63 -def summarize(elem): +
64 return elem.tag +
65 +
66 -def summarize_list(seq): +
67 return list(map(summarize, seq)) +
68 +
69 -def normalize_crlf(tree): +
70 for elem in tree.getiterator(): + 71 if elem.text: elem.text = elem.text.replace("\r\n", "\n") + 72 if elem.tail: elem.tail = elem.tail.replace("\r\n", "\n") +
73 + 74 SAMPLE_XML = ElementTree.XML(""" + 75 <body> + 76 <tag class='a'>text</tag> + 77 <tag class='b' /> + 78 <section> + 79 <tag class='b' id='inner'>subtext</tag> + 80 </section> + 81 </body> + 82 """) + 83 + 84 # + 85 # interface tests + 86 +
87 -def check_string(string): +
88 len(string) + 89 for char in string: + 90 if len(char) != 1: + 91 print("expected one-character string, got %r" % char) + 92 new_string = string + "" + 93 new_string = string + " " + 94 string[:0] +
95 +
96 -def check_string_or_none(value): +
97 if value is None: + 98 return + 99 return check_string(value) +
100 +
101 -def check_mapping(mapping): +
102 len(mapping) + 103 keys = mapping.keys() + 104 items = mapping.items() + 105 for key in keys: + 106 item = mapping[key] + 107 mapping["key"] = "value" + 108 if mapping["key"] != "value": + 109 print("expected value string, got %r" % mapping["key"]) +
110 +
111 -def check_element(element): +
112 if not hasattr(element, "tag"): + 113 print("no tag member") + 114 if not hasattr(element, "attrib"): + 115 print("no attrib member") + 116 if not hasattr(element, "text"): + 117 print("no text member") + 118 if not hasattr(element, "tail"): + 119 print("no tail member") + 120 check_string(element.tag) + 121 check_mapping(element.attrib) + 122 check_string_or_none(element.text) + 123 check_string_or_none(element.tail) + 124 for elem in element: + 125 check_element(elem) +
126 +
127 -def check_element_tree(tree): +
128 check_element(tree.getroot()) +
129 + 130 # -------------------------------------------------------------------- + 131 # element tree tests + 132 +
133 -def sanity(): +
134 """ + 135 >>> from elementtree.ElementTree import * + 136 >>> from elementtree.ElementInclude import * + 137 >>> from elementtree.ElementPath import * + 138 >>> from elementtree.HTMLTreeBuilder import * + 139 >>> from elementtree.SimpleXMLWriter import * + 140 >>> from elementtree.TidyTools import * + 141 """ +
142 + 143 # doesn't work with lxml.etree + 144 del sanity + 145 +
146 -def version(): +
147 """ + 148 >>> ElementTree.VERSION + 149 '1.3a2' + 150 """ +
151 + 152 # doesn't work with lxml.etree + 153 del version + 154 +
155 -def interface(): +
156 """ + 157 Test element tree interface. + 158 + 159 >>> element = ElementTree.Element("tag") + 160 >>> check_element(element) + 161 >>> tree = ElementTree.ElementTree(element) + 162 >>> check_element_tree(tree) + 163 """ +
164 +
165 -def simpleops(): +
166 """ + 167 >>> elem = ElementTree.XML("<body><tag/></body>") + 168 >>> serialize(elem) + 169 '<body><tag/></body>' + 170 >>> e = ElementTree.Element("tag2") + 171 >>> elem.append(e) + 172 >>> serialize(elem) + 173 '<body><tag/><tag2/></body>' + 174 >>> elem.remove(e) + 175 >>> serialize(elem) + 176 '<body><tag/></body>' + 177 >>> elem.insert(0, e) + 178 >>> serialize(elem) + 179 '<body><tag2/><tag/></body>' + 180 >>> elem.remove(e) + 181 >>> elem.extend([e]) + 182 >>> serialize(elem) + 183 '<body><tag/><tag2/></body>' + 184 >>> elem.remove(e) + 185 """ +
186 +
187 -def simplefind(): +
188 """ + 189 Test find methods using the elementpath fallback. + 190 + 191 >>> CurrentElementPath = ElementTree.ElementPath + 192 >>> ElementTree.ElementPath = ElementTree._SimpleElementPath() + 193 >>> elem = SAMPLE_XML + 194 >>> elem.find("tag").tag + 195 'tag' + 196 >>> ElementTree.ElementTree(elem).find("tag").tag + 197 'tag' + 198 >>> elem.findtext("tag") + 199 'text' + 200 >>> elem.findtext("tog") + 201 >>> elem.findtext("tog", "default") + 202 'default' + 203 >>> ElementTree.ElementTree(elem).findtext("tag") + 204 'text' + 205 >>> summarize_list(elem.findall("tag")) + 206 ['tag', 'tag'] + 207 >>> summarize_list(elem.findall(".//tag")) + 208 ['tag', 'tag', 'tag'] + 209 + 210 Path syntax doesn't work in this case. + 211 + 212 >>> elem.find("section/tag") + 213 >>> elem.findtext("section/tag") + 214 >>> elem.findall("section/tag") + 215 [] + 216 + 217 >>> ElementTree.ElementPath = CurrentElementPath + 218 """ +
219 + 220 # doesn't work with lxml.etree + 221 del simplefind + 222 +
223 -def find(): +
224 """ + 225 Test find methods (including xpath syntax). + 226 + 227 >>> elem = SAMPLE_XML + 228 >>> elem.find("tag").tag + 229 'tag' + 230 >>> ElementTree.ElementTree(elem).find("tag").tag + 231 'tag' + 232 >>> elem.find("section/tag").tag + 233 'tag' + 234 >>> ElementTree.ElementTree(elem).find("section/tag").tag + 235 'tag' + 236 >>> elem.findtext("tag") + 237 'text' + 238 >>> elem.findtext("tog") + 239 >>> elem.findtext("tog", "default") + 240 'default' + 241 >>> ElementTree.ElementTree(elem).findtext("tag") + 242 'text' + 243 >>> elem.findtext("section/tag") + 244 'subtext' + 245 >>> ElementTree.ElementTree(elem).findtext("section/tag") + 246 'subtext' + 247 >>> summarize_list(elem.findall("tag")) + 248 ['tag', 'tag'] + 249 >>> summarize_list(elem.findall("*")) + 250 ['tag', 'tag', 'section'] + 251 >>> summarize_list(elem.findall(".//tag")) + 252 ['tag', 'tag', 'tag'] + 253 >>> summarize_list(elem.findall("section/tag")) + 254 ['tag'] + 255 >>> summarize_list(elem.findall("section//tag")) + 256 ['tag'] + 257 >>> summarize_list(elem.findall("section/*")) + 258 ['tag'] + 259 >>> summarize_list(elem.findall("section//*")) + 260 ['tag'] + 261 >>> summarize_list(elem.findall("section/.//*")) + 262 ['tag'] + 263 >>> summarize_list(elem.findall("*/*")) + 264 ['tag'] + 265 >>> summarize_list(elem.findall("*//*")) + 266 ['tag'] + 267 >>> summarize_list(elem.findall("*/tag")) + 268 ['tag'] + 269 >>> summarize_list(elem.findall("*/./tag")) + 270 ['tag'] + 271 >>> summarize_list(elem.findall("./tag")) + 272 ['tag', 'tag'] + 273 >>> summarize_list(elem.findall(".//tag")) + 274 ['tag', 'tag', 'tag'] + 275 >>> summarize_list(elem.findall("././tag")) + 276 ['tag', 'tag'] + 277 >>> summarize_list(elem.findall(".//tag[@class]")) + 278 ['tag', 'tag', 'tag'] + 279 >>> summarize_list(elem.findall(".//tag[@class='a']")) + 280 ['tag'] + 281 >>> summarize_list(elem.findall(".//tag[@class='b']")) + 282 ['tag', 'tag'] + 283 >>> summarize_list(elem.findall(".//tag[@id]")) + 284 ['tag'] + 285 >>> summarize_list(elem.findall(".//section[tag]")) + 286 ['section'] + 287 >>> summarize_list(elem.findall(".//section[element]")) + 288 [] + 289 >>> summarize_list(elem.findall("../tag")) + 290 [] + 291 >>> summarize_list(elem.findall("section/../tag")) + 292 ['tag', 'tag'] + 293 >>> summarize_list(ElementTree.ElementTree(elem).findall("./tag")) + 294 ['tag', 'tag'] + 295 + 296 FIXME: ET's Path module handles this case incorrectly; this gives + 297 a warning in 1.3, and the behaviour will be modified in 1.4. + 298 + 299 >>> summarize_list(ElementTree.ElementTree(elem).findall("/tag")) + 300 ['tag', 'tag'] + 301 """ +
302 +
303 -def bad_find(): +
304 """ + 305 Check bad or unsupported path expressions. + 306 + 307 >>> elem = SAMPLE_XML + 308 >>> elem.findall("/tag") + 309 Traceback (most recent call last): + 310 SyntaxError: cannot use absolute path on element + 311 + 312 # this is supported in ET 1.3: + 313 #>>> elem.findall("section//") + 314 #Traceback (most recent call last): + 315 #SyntaxError: invalid path + 316 """ +
317 +
318 -def parsefile(): +
319 """ + 320 Test parsing from file. + 321 + 322 >>> tree = ElementTree.parse("samples/simple.xml") + 323 >>> normalize_crlf(tree) + 324 >>> tree.write(stdout()) + 325 <root> + 326 <element key="value">text</element> + 327 <element>text</element>tail + 328 <empty-element/> + 329 </root> + 330 >>> tree = ElementTree.parse("samples/simple-ns.xml") + 331 >>> normalize_crlf(tree) + 332 >>> tree.write(stdout()) + 333 <root xmlns="http://namespace/"> + 334 <element key="value">text</element> + 335 <element>text</element>tail + 336 <empty-element/> + 337 </root> + 338 + 339 ## <ns0:root xmlns:ns0="http://namespace/"> + 340 ## <ns0:element key="value">text</ns0:element> + 341 ## <ns0:element>text</ns0:element>tail + 342 ## <ns0:empty-element/> + 343 ## </ns0:root> + 344 """ +
345 +
346 -def parsehtml(): +
347 """ + 348 Test HTML parsing. + 349 + 350 >>> # p = HTMLTreeBuilder.TreeBuilder() + 351 >>> p = ElementTree.HTMLParser() + 352 >>> p.feed("<p><p>spam<b>egg</b></p>") + 353 >>> serialize(p.close()) + 354 '<p>spam<b>egg</b></p>' + 355 """ +
356 + 357 # doesn't work with lxml.etree + 358 del parsehtml + 359 +
360 -def parseliteral(): +
361 r""" + 362 >>> element = ElementTree.XML("<html><body>text</body></html>") + 363 >>> ElementTree.ElementTree(element).write(stdout()) + 364 <html><body>text</body></html> + 365 >>> element = ElementTree.fromstring("<html><body>text</body></html>") + 366 >>> ElementTree.ElementTree(element).write(stdout()) + 367 <html><body>text</body></html> + 368 + 369 ## >>> sequence = ["<html><body>", "text</bo", "dy></html>"] + 370 ## >>> element = ElementTree.fromstringlist(sequence) + 371 ## >>> ElementTree.ElementTree(element).write(stdout()) + 372 ## <html><body>text</body></html> + 373 + 374 >>> print(repr(ElementTree.tostring(element)).lstrip('b')) + 375 '<html><body>text</body></html>' + 376 + 377 # looks different in lxml + 378 # >>> print(ElementTree.tostring(element, "ascii")) + 379 # <?xml version='1.0' encoding='ascii'?> + 380 # <html><body>text</body></html> + 381 + 382 >>> _, ids = ElementTree.XMLID("<html><body>text</body></html>") + 383 >>> len(ids) + 384 0 + 385 >>> _, ids = ElementTree.XMLID("<html><body id='body'>text</body></html>") + 386 >>> len(ids) + 387 1 + 388 >>> ids["body"].tag + 389 'body' + 390 """ +
391 +
392 -def simpleparsefile(): +
393 """ + 394 Test the xmllib-based parser. + 395 + 396 >>> from elementtree import SimpleXMLTreeBuilder + 397 >>> parser = SimpleXMLTreeBuilder.TreeBuilder() + 398 >>> tree = ElementTree.parse("samples/simple.xml", parser) + 399 >>> normalize_crlf(tree) + 400 >>> tree.write(sys.stdout) + 401 <root> + 402 <element key="value">text</element> + 403 <element>text</element>tail + 404 <empty-element /> + 405 </root> + 406 """ +
407 + 408 # doesn't work with lxml.etree + 409 del simpleparsefile + 410 +
411 -def iterparse(): +
412 """ + 413 Test iterparse interface. + 414 + 415 >>> iterparse = ElementTree.iterparse + 416 + 417 >>> context = iterparse("samples/simple.xml") + 418 >>> for action, elem in context: + 419 ... print("%s %s" % (action, elem.tag)) + 420 end element + 421 end element + 422 end empty-element + 423 end root + 424 >>> context.root.tag + 425 'root' + 426 + 427 >>> context = iterparse("samples/simple-ns.xml") + 428 >>> for action, elem in context: + 429 ... print("%s %s" % (action, elem.tag)) + 430 end {http://namespace/}element + 431 end {http://namespace/}element + 432 end {http://namespace/}empty-element + 433 end {http://namespace/}root + 434 + 435 >>> events = () + 436 >>> context = iterparse("samples/simple.xml", events) + 437 >>> for action, elem in context: + 438 ... print("%s %s" % (action, elem.tag)) + 439 + 440 >>> events = () + 441 >>> context = iterparse("samples/simple.xml", events=events) + 442 >>> for action, elem in context: + 443 ... print("%s %s" % (action, elem.tag)) + 444 + 445 >>> events = ("start", "end") + 446 >>> context = iterparse("samples/simple.xml", events) + 447 >>> for action, elem in context: + 448 ... print("%s %s" % (action, elem.tag)) + 449 start root + 450 start element + 451 end element + 452 start element + 453 end element + 454 start empty-element + 455 end empty-element + 456 end root + 457 + 458 >>> events = ("start", "end", "start-ns", "end-ns") + 459 >>> context = iterparse("samples/simple-ns.xml", events) + 460 >>> for action, elem in context: + 461 ... if action in ("start", "end"): + 462 ... print("%s %s" % (action, elem.tag)) + 463 ... else: + 464 ... print("%s %s" % (action, elem)) + 465 start-ns ('', 'http://namespace/') + 466 start {http://namespace/}root + 467 start {http://namespace/}element + 468 end {http://namespace/}element + 469 start {http://namespace/}element + 470 end {http://namespace/}element + 471 start {http://namespace/}empty-element + 472 end {http://namespace/}empty-element + 473 end {http://namespace/}root + 474 end-ns None + 475 + 476 """ +
477 +
478 -def fancyparsefile(): +
479 """ + 480 Test the "fancy" parser. + 481 + 482 Sanity check. + 483 >>> from elementtree import XMLTreeBuilder + 484 >>> parser = XMLTreeBuilder.FancyTreeBuilder() + 485 >>> tree = ElementTree.parse("samples/simple.xml", parser) + 486 >>> normalize_crlf(tree) + 487 >>> tree.write(sys.stdout) + 488 <root> + 489 <element key="value">text</element> + 490 <element>text</element>tail + 491 <empty-element /> + 492 </root> + 493 + 494 Callback check. + 495 >>> class MyFancyParser(XMLTreeBuilder.FancyTreeBuilder): + 496 ... def start(self, elem): + 497 ... print("START %s" % elem.tag) + 498 ... def end(self, elem): + 499 ... print("END %s" % elem.tag) + 500 >>> parser = MyFancyParser() + 501 >>> tree = ElementTree.parse("samples/simple.xml", parser) + 502 START root + 503 START element + 504 END element + 505 START element + 506 END element + 507 START empty-element + 508 END empty-element + 509 END root + 510 """ +
511 + 512 # doesn't work with lxml.etree + 513 del fancyparsefile + 514 +
515 -def writefile(): +
516 """ + 517 >>> elem = ElementTree.Element("tag") + 518 >>> elem.text = "text" + 519 >>> serialize(elem) + 520 '<tag>text</tag>' + 521 >>> ElementTree.SubElement(elem, "subtag").text = "subtext" + 522 >>> serialize(elem) + 523 '<tag>text<subtag>subtext</subtag></tag>' + 524 + 525 ## Test tag suppression + 526 ## >>> elem.tag = None + 527 ## >>> serialize(elem) + 528 ## 'text<subtag>subtext</subtag>' + 529 """ +
530 +
531 -def writestring(): +
532 """ + 533 >>> elem = ElementTree.XML("<html><body>text</body></html>") + 534 >>> print(repr(ElementTree.tostring(elem)).lstrip('b')) + 535 '<html><body>text</body></html>' + 536 >>> elem = ElementTree.fromstring("<html><body>text</body></html>") + 537 >>> print(repr(ElementTree.tostring(elem)).lstrip('b')) + 538 '<html><body>text</body></html>' + 539 """ +
540 +
541 -def encoding(): +
542 r""" + 543 Test encoding issues. + 544 + 545 >>> elem = ElementTree.Element("tag") + 546 >>> elem.text = u'abc' + 547 >>> serialize(elem) + 548 '<tag>abc</tag>' + 549 >>> serialize(elem, encoding="utf-8") + 550 '<tag>abc</tag>' + 551 >>> serialize(elem, encoding="us-ascii") + 552 '<tag>abc</tag>' + 553 >>> serialize(elem, encoding="iso-8859-1").lower() + 554 "<?xml version='1.0' encoding='iso-8859-1'?>\n<tag>abc</tag>" + 555 + 556 >>> elem.text = "<&\"\'>" + 557 >>> serialize(elem) + 558 '<tag>&lt;&amp;"\'&gt;</tag>' + 559 >>> serialize(elem, encoding="utf-8") + 560 '<tag>&lt;&amp;"\'&gt;</tag>' + 561 >>> serialize(elem, encoding="us-ascii") # cdata characters + 562 '<tag>&lt;&amp;"\'&gt;</tag>' + 563 >>> serialize(elem, encoding="iso-8859-1").lower() + 564 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag>&lt;&amp;"\'&gt;</tag>' + 565 + 566 >>> elem.attrib["key"] = "<&\"\'>" + 567 >>> elem.text = None + 568 >>> serialize(elem) + 569 '<tag key="&lt;&amp;&quot;\'&gt;"/>' + 570 >>> serialize(elem, encoding="utf-8") + 571 '<tag key="&lt;&amp;&quot;\'&gt;"/>' + 572 >>> serialize(elem, encoding="us-ascii") + 573 '<tag key="&lt;&amp;&quot;\'&gt;"/>' + 574 >>> serialize(elem, encoding="iso-8859-1").lower() + 575 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="&lt;&amp;&quot;\'&gt;"/>' + 576 + 577 >>> elem.text = u'\xe5\xf6\xf6<>' + 578 >>> elem.attrib.clear() + 579 >>> serialize(elem) + 580 '<tag>&#229;&#246;&#246;&lt;&gt;</tag>' + 581 >>> serialize(elem, encoding="utf-8") + 582 '<tag>\xc3\xa5\xc3\xb6\xc3\xb6&lt;&gt;</tag>' + 583 >>> serialize(elem, encoding="us-ascii") + 584 '<tag>&#229;&#246;&#246;&lt;&gt;</tag>' + 585 >>> serialize(elem, encoding="iso-8859-1").lower() + 586 "<?xml version='1.0' encoding='iso-8859-1'?>\n<tag>\xe5\xf6\xf6&lt;&gt;</tag>" + 587 + 588 >>> elem.attrib["key"] = u'\xe5\xf6\xf6<>' + 589 >>> elem.text = None + 590 >>> serialize(elem) + 591 '<tag key="&#229;&#246;&#246;&lt;&gt;"/>' + 592 >>> serialize(elem, encoding="utf-8") + 593 '<tag key="\xc3\xa5\xc3\xb6\xc3\xb6&lt;&gt;"/>' + 594 >>> serialize(elem, encoding="us-ascii") + 595 '<tag key="&#229;&#246;&#246;&lt;&gt;"/>' + 596 >>> serialize(elem, encoding="iso-8859-1").lower() + 597 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="\xe5\xf6\xf6&lt;&gt;"/>' + 598 """ +
599 + 600 if sys.version_info[0] >= 3: + 601 encoding.__doc__ = encoding.__doc__.replace("u'", "'") + 602 +
603 -def methods(): +
604 r""" + 605 Test serialization methods. + 606 + 607 >>> e = ET.XML("<html><link/><script>1 &lt; 2</script></html>") + 608 >>> e.tail = "\n" + 609 >>> serialize(e) + 610 '<html><link /><script>1 &lt; 2</script></html>\n' + 611 >>> serialize(e, method=None) + 612 '<html><link /><script>1 &lt; 2</script></html>\n' + 613 >>> serialize(e, method="xml") + 614 '<html><link /><script>1 &lt; 2</script></html>\n' + 615 >>> serialize(e, method="html") + 616 '<html><link><script>1 < 2</script></html>\n' + 617 >>> serialize(e, method="text") + 618 '1 < 2\n' + 619 + 620 """ +
621 + 622 # doesn't work with lxml.etree + 623 del methods + 624 +
625 -def iterators(): +
626 """ + 627 Test iterators. + 628 + 629 >>> e = ET.XML("<html><body>this is a <i>paragraph</i>.</body>..</html>") + 630 >>> summarize_list(e.iter()) + 631 ['html', 'body', 'i'] + 632 >>> summarize_list(e.find("body").iter()) + 633 ['body', 'i'] + 634 >>> "".join(e.itertext()) + 635 'this is a paragraph...' + 636 >>> "".join(e.find("body").itertext()) + 637 'this is a paragraph.' + 638 """ +
639 + 640 ENTITY_XML = """\ + 641 <!DOCTYPE points [ + 642 <!ENTITY % user-entities SYSTEM 'user-entities.xml'> + 643 %user-entities; + 644 ]> + 645 <document>&entity;</document> + 646 """ + 647 +
648 -def entity(): +
649 """ + 650 Test entity handling. + 651 + 652 1) bad entities + 653 + 654 >>> ElementTree.XML("<document>&entity;</document>") + 655 Traceback (most recent call last): + 656 ExpatError: undefined entity: line 1, column 10 + 657 + 658 >>> ElementTree.XML(ENTITY_XML) + 659 Traceback (most recent call last): + 660 ExpatError: undefined entity &entity;: line 5, column 10 + 661 + 662 (add more tests here) + 663 + 664 """ +
665 + 666 # doesn't work with lxml.etree + 667 del entity + 668 +
669 -def error(xml): +
670 """ + 671 Test error handling. + 672 + 673 >>> error("foo").position + 674 (1, 0) + 675 >>> error("<tag>&foo;</tag>").position + 676 (1, 5) + 677 >>> error("foobar<").position + 678 (1, 6) + 679 + 680 """ + 681 try: + 682 ET.XML(xml) + 683 except ET.ParseError: + 684 return sys.exc_value +
685 + 686 # doesn't work with lxml.etree -> different positions + 687 del error + 688 +
689 -def namespace(): +
690 """ + 691 Test namespace issues. + 692 + 693 1) xml namespace + 694 + 695 >>> elem = ElementTree.XML("<tag xml:lang='en' />") + 696 >>> serialize(elem) # 1.1 + 697 '<tag xml:lang="en"/>' + 698 + 699 2) other "well-known" namespaces + 700 + 701 >>> elem = ElementTree.XML("<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' />") + 702 >>> serialize(elem) # 2.1 + 703 '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>' + 704 + 705 >>> elem = ElementTree.XML("<html:html xmlns:html='http://www.w3.org/1999/xhtml' />") + 706 >>> serialize(elem) # 2.2 + 707 '<html:html xmlns:html="http://www.w3.org/1999/xhtml"/>' + 708 + 709 >>> elem = ElementTree.XML("<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope' />") + 710 >>> serialize(elem) # 2.3 + 711 '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"/>' + 712 + 713 3) unknown namespaces + 714 + 715 """ +
716 +
717 -def qname(): +
718 """ + 719 Test QName handling. + 720 + 721 1) decorated tags + 722 + 723 >>> elem = ElementTree.Element("{uri}tag") + 724 >>> serialize(elem) # 1.1 + 725 '<ns0:tag xmlns:ns0="uri"/>' + 726 >>> elem = ElementTree.Element(ElementTree.QName("{uri}tag")) + 727 >>> serialize(elem) # 1.2 + 728 '<ns0:tag xmlns:ns0="uri"/>' + 729 >>> elem = ElementTree.Element(ElementTree.QName("uri", "tag")) + 730 >>> serialize(elem) # 1.3 + 731 '<ns0:tag xmlns:ns0="uri"/>' + 732 + 733 # ns/attribute order ... + 734 + 735 ## 2) decorated attributes + 736 + 737 ## >>> elem.clear() + 738 ## >>> elem.attrib["{uri}key"] = "value" + 739 ## >>> serialize(elem) # 2.1 + 740 ## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>' + 741 + 742 ## >>> elem.clear() + 743 ## >>> elem.attrib[ElementTree.QName("{uri}key")] = "value" + 744 ## >>> serialize(elem) # 2.2 + 745 ## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>' + 746 + 747 ## 3) decorated values are not converted by default, but the + 748 ## QName wrapper can be used for values + 749 + 750 ## >>> elem.clear() + 751 ## >>> elem.attrib["{uri}key"] = "{uri}value" + 752 ## >>> serialize(elem) # 3.1 + 753 ## '<ns0:tag ns0:key="{uri}value" xmlns:ns0="uri"/>' + 754 + 755 ## >>> elem.clear() + 756 ## >>> elem.attrib["{uri}key"] = ElementTree.QName("{uri}value") + 757 ## >>> serialize(elem) # 3.2 + 758 ## '<ns0:tag ns0:key="ns0:value" xmlns:ns0="uri"/>' + 759 + 760 ## >>> elem.clear() + 761 ## >>> subelem = ElementTree.Element("tag") + 762 ## >>> subelem.attrib["{uri1}key"] = ElementTree.QName("{uri2}value") + 763 ## >>> elem.append(subelem) + 764 ## >>> elem.append(subelem) + 765 ## >>> serialize(elem) # 3.3 + 766 ## '<ns0:tag xmlns:ns0="uri"><tag ns1:key="ns2:value" xmlns:ns1="uri1" xmlns:ns2="uri2"/><tag ns1:key="ns2:value" xmlns:ns1="uri1" xmlns:ns2="uri2"/></ns0:tag>' + 767 + 768 """ +
769 +
770 -def xpath_tokenizer(p): +
771 """ + 772 Test the XPath tokenizer. + 773 + 774 >>> # tests from the xml specification + 775 >>> xpath_tokenizer("*") + 776 ['*'] + 777 >>> xpath_tokenizer("text()") + 778 ['text', '()'] + 779 >>> xpath_tokenizer("@name") + 780 ['@', 'name'] + 781 >>> xpath_tokenizer("@*") + 782 ['@', '*'] + 783 >>> xpath_tokenizer("para[1]") + 784 ['para', '[', '1', ']'] + 785 >>> xpath_tokenizer("para[last()]") + 786 ['para', '[', 'last', '()', ']'] + 787 >>> xpath_tokenizer("*/para") + 788 ['*', '/', 'para'] + 789 >>> xpath_tokenizer("/doc/chapter[5]/section[2]") + 790 ['/', 'doc', '/', 'chapter', '[', '5', ']', '/', 'section', '[', '2', ']'] + 791 >>> xpath_tokenizer("chapter//para") + 792 ['chapter', '//', 'para'] + 793 >>> xpath_tokenizer("//para") + 794 ['//', 'para'] + 795 >>> xpath_tokenizer("//olist/item") + 796 ['//', 'olist', '/', 'item'] + 797 >>> xpath_tokenizer(".") + 798 ['.'] + 799 >>> xpath_tokenizer(".//para") + 800 ['.', '//', 'para'] + 801 >>> xpath_tokenizer("..") + 802 ['..'] + 803 >>> xpath_tokenizer("../@lang") + 804 ['..', '/', '@', 'lang'] + 805 >>> xpath_tokenizer("chapter[title]") + 806 ['chapter', '[', 'title', ']'] + 807 >>> xpath_tokenizer("employee[@secretary and @assistant]") + 808 ['employee', '[', '@', 'secretary', '', 'and', '', '@', 'assistant', ']'] + 809 + 810 >>> # additional tests + 811 >>> xpath_tokenizer("{http://spam}egg") + 812 ['{http://spam}egg'] + 813 >>> xpath_tokenizer("./spam.egg") + 814 ['.', '/', 'spam.egg'] + 815 >>> xpath_tokenizer(".//{http://spam}egg") + 816 ['.', '//', '{http://spam}egg'] + 817 """ + 818 out = [] + 819 for op, tag in ElementPath.xpath_tokenizer(p): + 820 out.append(op or tag) + 821 return out +
822 + 823 # + 824 # xinclude tests (samples from appendix C of the xinclude specification) + 825 + 826 XINCLUDE = { + 827 "C1.xml": """\ + 828 <?xml version='1.0'?> + 829 <document xmlns:xi="http://www.w3.org/2001/XInclude"> + 830 <p>120 Mz is adequate for an average home user.</p> + 831 <xi:include href="disclaimer.xml"/> + 832 </document> + 833 """, "disclaimer.xml": """\ + 834 <?xml version='1.0'?> + 835 <disclaimer> + 836 <p>The opinions represented herein represent those of the individual + 837 and should not be interpreted as official policy endorsed by this + 838 organization.</p> + 839 </disclaimer> + 840 """, + 841 "C2.xml": """\ + 842 <?xml version='1.0'?> + 843 <document xmlns:xi="http://www.w3.org/2001/XInclude"> + 844 <p>This document has been accessed + 845 <xi:include href="count.txt" parse="text"/> times.</p> + 846 </document> + 847 """, "count.txt": "324387", "C3.xml": """\ + 848 <?xml version='1.0'?> + 849 <document xmlns:xi="http://www.w3.org/2001/XInclude"> + 850 <p>The following is the source of the "data.xml" resource:</p> + 851 <example><xi:include href="data.xml" parse="text"/></example> + 852 </document> + 853 """, "data.xml": """\ + 854 <?xml version='1.0'?> + 855 <data> + 856 <item><![CDATA[Brooks & Shields]]></item> + 857 </data> + 858 """, + 859 "C5.xml": """\ + 860 <?xml version='1.0'?> + 861 <div xmlns:xi="http://www.w3.org/2001/XInclude"> + 862 <xi:include href="example.txt" parse="text"> + 863 <xi:fallback> + 864 <xi:include href="fallback-example.txt" parse="text"> + 865 <xi:fallback><a href="mailto:bob@example.org">Report error</a></xi:fallback> + 866 </xi:include> + 867 </xi:fallback> + 868 </xi:include> + 869 </div> + 870 """, + 871 "default.xml": """\ + 872 <?xml version='1.0'?> + 873 <document xmlns:xi="http://www.w3.org/2001/XInclude"> + 874 <p>Example.</p> + 875 <xi:include href="samples/simple.xml"/> + 876 </document> + 877 """} + 878 + 879 +
880 -def xinclude_loader(href, parse="xml", encoding=None): +
881 try: + 882 data = XINCLUDE[href] + 883 except KeyError: + 884 raise IOError("resource not found") + 885 if parse == "xml": + 886 return ElementTree.XML(data) + 887 return data +
888 +
889 -def xinclude(): +
890 r""" + 891 Basic inclusion example (XInclude C.1) + 892 + 893 >>> document = xinclude_loader("C1.xml") + 894 >>> ElementInclude.include(document, xinclude_loader) + 895 >>> print(serialize(document)) # C1 + 896 <document> + 897 <p>120 Mz is adequate for an average home user.</p> + 898 <disclaimer> + 899 <p>The opinions represented herein represent those of the individual + 900 and should not be interpreted as official policy endorsed by this + 901 organization.</p> + 902 </disclaimer> + 903 </document> + 904 + 905 Textual inclusion example (XInclude C.2) + 906 + 907 >>> document = xinclude_loader("C2.xml") + 908 >>> ElementInclude.include(document, xinclude_loader) + 909 >>> print(serialize(document)) # C2 + 910 <document> + 911 <p>This document has been accessed + 912 324387 times.</p> + 913 </document> + 914 + 915 Textual inclusion of XML example (XInclude C.3) + 916 + 917 >>> document = xinclude_loader("C3.xml") + 918 >>> ElementInclude.include(document, xinclude_loader) + 919 >>> print(serialize(document)) # C3 + 920 <document> + 921 <p>The following is the source of the "data.xml" resource:</p> + 922 <example>&lt;?xml version='1.0'?&gt; + 923 &lt;data&gt; + 924 &lt;item&gt;&lt;![CDATA[Brooks &amp; Shields]]&gt;&lt;/item&gt; + 925 &lt;/data&gt; + 926 </example> + 927 </document> + 928 + 929 ## Fallback example (XInclude C.5) + 930 ## Note! Fallback support is not yet implemented + 931 + 932 ## >>> document = xinclude_loader("C5.xml") + 933 ## >>> ElementInclude.include(document, xinclude_loader) + 934 ## Traceback (most recent call last): + 935 ## IOError: resource not found + 936 ## >>> # print(serialize(document)) # C5 + 937 + 938 """ +
939 +
940 -def xinclude_default(): +
941 """ + 942 >>> document = xinclude_loader("default.xml") + 943 >>> ElementInclude.include(document) + 944 >>> print(serialize(document)) # default + 945 <document> + 946 <p>Example.</p> + 947 <root> + 948 <element key="value">text</element> + 949 <element>text</element>tail + 950 <empty-element/> + 951 </root> + 952 </document> + 953 """ +
954 + 955 # + 956 # xmlwriter + 957 +
958 -def xmlwriter(): +
959 r""" + 960 >>> file = BytesIO() + 961 >>> w = SimpleXMLWriter.XMLWriter(file) + 962 >>> html = w.start("html") + 963 >>> x = w.start("head") + 964 >>> w.element("title", "my document") + 965 >>> w.data("\n") + 966 >>> w.element("meta", name="hello", value="goodbye") + 967 >>> w.data("\n") + 968 >>> w.end() + 969 >>> x = w.start("body") + 970 >>> w.element("h1", "this is a heading") + 971 >>> w.data("\n") + 972 >>> w.element("p", u"this is a paragraph") + 973 >>> w.data("\n") + 974 >>> w.element("p", u"reserved characters: <&>") + 975 >>> w.data("\n") + 976 >>> w.element("p", u"detta är också ett stycke") + 977 >>> w.data("\n") + 978 >>> w.close(html) + 979 >>> print(file.getvalue()) + 980 <html><head><title>my document</title> + 981 <meta name="hello" value="goodbye" /> + 982 </head><body><h1>this is a heading</h1> + 983 <p>this is a paragraph</p> + 984 <p>reserved characters: &lt;&amp;&gt;</p> + 985 <p>detta &#228;r ocks&#229; ett stycke</p> + 986 </body></html> + 987 """ +
988 + 989 # doesn't work with lxml.etree + 990 del xmlwriter + 991 + 992 # -------------------------------------------------------------------- + 993 # reported bugs + 994 +
995 -def bug_xmltoolkit21(): +
996 """ + 997 marshaller gives obscure errors for non-string values + 998 + 999 >>> elem = ElementTree.Element(123) +1000 >>> serialize(elem) # tag +1001 Traceback (most recent call last): +1002 TypeError: cannot serialize 123 (type int) +1003 >>> elem = ElementTree.Element("elem") +1004 >>> elem.text = 123 +1005 >>> serialize(elem) # text +1006 Traceback (most recent call last): +1007 TypeError: cannot serialize 123 (type int) +1008 >>> elem = ElementTree.Element("elem") +1009 >>> elem.tail = 123 +1010 >>> serialize(elem) # tail +1011 Traceback (most recent call last): +1012 TypeError: cannot serialize 123 (type int) +1013 >>> elem = ElementTree.Element("elem") +1014 >>> elem.set(123, "123") +1015 >>> serialize(elem) # attribute key +1016 Traceback (most recent call last): +1017 TypeError: cannot serialize 123 (type int) +1018 >>> elem = ElementTree.Element("elem") +1019 >>> elem.set("123", 123) +1020 >>> serialize(elem) # attribute value +1021 Traceback (most recent call last): +1022 TypeError: cannot serialize 123 (type int) +1023 +1024 """ +
1025 +1026 # doesn't work with lxml.etree +1027 del bug_xmltoolkit21 +1028 +
1029 -def bug_xmltoolkit25(): +
1030 """ +1031 typo in ElementTree.findtext +1032 +1033 >>> tree = ElementTree.ElementTree(SAMPLE_XML) +1034 >>> tree.findtext("tag") +1035 'text' +1036 >>> tree.findtext("section/tag") +1037 'subtext' +1038 """ +
1039 +
1040 -def bug_xmltoolkit28(): +
1041 """ +1042 .//tag causes exceptions +1043 +1044 >>> tree = ElementTree.XML("<doc><table><tbody/></table></doc>") +1045 >>> summarize_list(tree.findall(".//thead")) +1046 [] +1047 >>> summarize_list(tree.findall(".//tbody")) +1048 ['tbody'] +1049 """ +
1050 +
1051 -def bug_xmltoolkitX1(): +
1052 """ +1053 dump() doesn't flush the output buffer +1054 +1055 >>> tree = ElementTree.XML("<doc><table><tbody/></table></doc>") +1056 >>> ElementTree.dump(tree); sys.stdout.write("tail") +1057 <doc><table><tbody /></table></doc> +1058 tail +1059 """ +
1060 +1061 # doesn't work with lxml.etree +1062 del bug_xmltoolkitX1 +1063 +
1064 -def bug_xmltoolkit39(): +
1065 """ +1066 non-ascii element and attribute names doesn't work +1067 +1068 >>> tree = ElementTree.XML("<?xml version='1.0' encoding='iso-8859-1'?><täg />") +1069 >>> ElementTree.tostring(tree, "utf-8") +1070 '<t\\xc3\\xa4g />' +1071 +1072 >>> tree = ElementTree.XML("<?xml version='1.0' encoding='iso-8859-1'?><tag ättr='v&#228;lue' />") +1073 >>> tree.attrib +1074 {u'\\xe4ttr': u'v\\xe4lue'} +1075 >>> ElementTree.tostring(tree, "utf-8") +1076 '<tag \\xc3\\xa4ttr="v\\xc3\\xa4lue" />' +1077 +1078 >>> tree = ElementTree.XML("<?xml version='1.0' encoding='iso-8859-1'?><täg>text</täg>") +1079 >>> ElementTree.tostring(tree, "utf-8") +1080 '<t\\xc3\\xa4g>text</t\\xc3\\xa4g>' +1081 +1082 >>> tree = ElementTree.Element(u"täg") +1083 >>> ElementTree.tostring(tree, "utf-8") +1084 '<t\\xc3\\xa4g />' +1085 +1086 >>> tree = ElementTree.Element("tag") +1087 >>> tree.set(u"ättr", u"välue") +1088 >>> ElementTree.tostring(tree, "utf-8") +1089 '<tag \\xc3\\xa4ttr="v\\xc3\\xa4lue" />' +1090 +1091 """ +
1092 +1093 # doesn't work with lxml.etree +1094 del bug_xmltoolkit39 +1095 +
1096 -def bug_xmltoolkit45(): +
1097 """ +1098 problems parsing mixed unicode/non-ascii html documents +1099 +1100 latin-1 text +1101 >>> p = HTMLTreeBuilder.TreeBuilder() +1102 >>> p.feed("<p>välue</p>") +1103 >>> serialize(p.close()) +1104 '<p>v&#228;lue</p>' +1105 +1106 utf-8 text +1107 >>> p = HTMLTreeBuilder.TreeBuilder(encoding="utf-8") +1108 >>> p.feed("<p>v\xc3\xa4lue</p>") +1109 >>> serialize(p.close()) +1110 '<p>v&#228;lue</p>' +1111 +1112 utf-8 text using meta tag +1113 >>> p = HTMLTreeBuilder.TreeBuilder() +1114 >>> p.feed("<html><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><p>v\xc3\xa4lue</p></html>") +1115 >>> serialize(p.close().find("p")) +1116 '<p>v&#228;lue</p>' +1117 +1118 latin-1 character references +1119 >>> p = HTMLTreeBuilder.TreeBuilder() +1120 >>> p.feed("<p>v&#228;lue</p>") +1121 >>> serialize(p.close()) +1122 '<p>v&#228;lue</p>' +1123 +1124 latin-1 character entities +1125 >>> p = HTMLTreeBuilder.TreeBuilder() +1126 >>> p.feed("<p>v&auml;lue</p>") +1127 >>> serialize(p.close()) +1128 '<p>v&#228;lue</p>' +1129 +1130 mixed latin-1 text and unicode entities +1131 >>> p = HTMLTreeBuilder.TreeBuilder() +1132 >>> p.feed("<p>&#8221;välue&#8221;</p>") +1133 >>> serialize(p.close()) +1134 '<p>&#8221;v&#228;lue&#8221;</p>' +1135 +1136 mixed unicode and latin-1 entities +1137 >>> p = HTMLTreeBuilder.TreeBuilder() +1138 >>> p.feed("<p>&#8221;v&auml;lue&#8221;</p>") +1139 >>> serialize(p.close()) +1140 '<p>&#8221;v&#228;lue&#8221;</p>' +1141 +1142 """ +
1143 +1144 # doesn't work with lxml.etree +1145 del bug_xmltoolkit45 +1146 +
1147 -def bug_xmltoolkit46(): +
1148 """ +1149 problems parsing open BR tags +1150 +1151 >>> p = HTMLTreeBuilder.TreeBuilder() +1152 >>> p.feed("<p>key<br>value</p>") +1153 >>> serialize(p.close()) +1154 '<p>key<br />value</p>' +1155 +1156 """ +
1157 +1158 # doesn't work with lxml.etree +1159 del bug_xmltoolkit46 +1160 +
1161 -def bug_xmltoolkit54(): +
1162 """ +1163 problems handling internally defined entities +1164 +1165 >>> e = ElementTree.XML("<!DOCTYPE doc [<!ENTITY ldots '&#x8230;'>]><doc>&ldots;</doc>") +1166 >>> serialize(e) +1167 '<doc>&#33328;</doc>' +1168 """ +
1169 +1170 # doesn't work with lxml.etree +1171 del bug_xmltoolkit54 +1172 +
1173 -def bug_xmltoolkit55(): +
1174 """ +1175 make sure we're reporting the first error, not the last +1176 +1177 >>> e = ElementTree.XML("<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>") +1178 Traceback (most recent call last): +1179 ParseError: undefined entity &ldots;: line 1, column 36 +1180 """ +
1181 +1182 # doesn't work with lxml.etree +1183 del bug_xmltoolkit55 +1184 +
1185 -def bug_200708_version(): +
1186 """ +1187 >>> parser = ET.XMLParser() +1188 >>> parser.version +1189 'Expat 2.0.0' +1190 >>> parser.feed(open("samples/simple.xml").read()) +1191 >>> print(serialize(parser.close())) +1192 <root> +1193 <element key="value">text</element> +1194 <element>text</element>tail +1195 <empty-element /> +1196 </root> +1197 """ +
1198 +1199 # doesn't work with lxml.etree +1200 del bug_200708_version +1201 +
1202 -def bug_200708_newline(): +
1203 r""" +1204 +1205 Preserve newlines in attributes. +1206 +1207 >>> e = ET.Element('SomeTag', text="def _f():\n return 3\n") +1208 >>> ET.tostring(e) +1209 '<SomeTag text="def _f():&#10; return 3&#10;" />' +1210 >>> ET.XML(ET.tostring(e)).get("text") +1211 'def _f():\n return 3\n' +1212 >>> ET.tostring(ET.XML(ET.tostring(e))) +1213 '<SomeTag text="def _f():&#10; return 3&#10;" />' +1214 """ +
1215 +1216 # doesn't work with lxml.etree +1217 del bug_200708_newline +1218 +
1220 """ +1221 +1222 >>> e = ET.Element("{default}elem") +1223 >>> s = ET.SubElement(e, "{default}elem") +1224 >>> serialize(e, default_namespace="default") # 1 +1225 '<elem xmlns="default"><elem /></elem>' +1226 +1227 >>> e = ET.Element("{default}elem") +1228 >>> s = ET.SubElement(e, "{default}elem") +1229 >>> s = ET.SubElement(e, "{not-default}elem") +1230 >>> serialize(e, default_namespace="default") # 2 +1231 '<elem xmlns="default" xmlns:ns1="not-default"><elem /><ns1:elem /></elem>' +1232 +1233 >>> e = ET.Element("{default}elem") +1234 >>> s = ET.SubElement(e, "{default}elem") +1235 >>> s = ET.SubElement(e, "elem") # unprefixed name +1236 >>> serialize(e, default_namespace="default") # 3 +1237 Traceback (most recent call last): +1238 ValueError: cannot use non-qualified names with default_namespace option +1239 +1240 """ +
1241 +1242 # doesn't work with lxml.etree +1243 del bug_200709_default_namespace +1244 +1245 # -------------------------------------------------------------------- +1246 +1247 if __name__ == "__main__": +1248 import doctest, selftest +1249 failed, tested = doctest.testmod(selftest) +1250 print("%d tests ok." % (tested - failed)) +1251 if failed > 0: +1252 print("%d tests failed. Exiting with non-zero return code." % failed) +1253 sys.exit(1) +1254 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.selftest2-module.html b/doc/html/api/lxml.tests.selftest2-module.html new file mode 100644 index 00000000..3306a250 --- /dev/null +++ b/doc/html/api/lxml.tests.selftest2-module.html @@ -0,0 +1,699 @@ + + + + + lxml.tests.selftest2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module selftest2 + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module selftest2

source code

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
stdout() + source code + +
+ +
+   + + + + + + +
unserialize(text) + source code + +
+ +
+   + + + + + + +
serialize(elem, + encoding=None) + source code + +
+ +
+   + + + + + + +
summarize(elem) + source code + +
+ +
+   + + + + + + +
summarize_list(seq) + source code + +
+ +
+   + + + + + + +
check_string(string) + source code + +
+ +
+   + + + + + + +
check_mapping(mapping) + source code + +
+ +
+   + + + + + + +
check_element(element) + source code + +
+ +
+   + + + + + + +
check_element_tree(tree) + source code + +
+ +
+   + + + + + + +
element()
+ Test element tree interface.
+ source code + +
+ +
+   + + + + + + +
parsefile()
+ Test parsing from file. Note that we're opening the files in +here; by default, the 'parse' function opens the file in binary +mode, and doctest doesn't filter out carriage returns.
+ source code + +
+ +
+   + + + + + + +
writefile() + source code + +
+ +
+   + + + + + + +
encoding()
+ Test encoding issues.
+ source code + +
+ +
+   + + + + + + +
qname()
+ Test QName handling.
+ source code + +
+ +
+   + + + + + + +
cdata()
+ Test CDATA handling (etc).
+ source code + +
+ +
+   + + + + + + +
find()
+ Test find methods (including xpath syntax).
+ source code + +
+ +
+   + + + + + + +
copy()
+ Test copy handling (etc).
+ source code + +
+ +
+   + + + + + + +
attrib()
+ Test attribute handling.
+ source code + +
+ +
+   + + + + + + +
makeelement()
+ Test makeelement handling.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + SAMPLE_XML = unserialize(... +
+   + + SAMPLE_XML_NS = unserialize(... +
+   + + ENTITY_XML = '<!DOCTYPE points [\n<!ENTITY % user-entities SYS... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

qname() +

+
source code  +
+ +
+

Test QName handling.

+
    +
  1. decorated tags
  2. +
+
+>>> elem = ElementTree.Element("{uri}tag")
+>>> serialize(elem) # 1.1
+'<ns0:tag xmlns:ns0="uri"/>'
+
+

## 2) decorated attributes

+

## >>> elem.attrib["{uri}key"] = "value" +## >>> serialize(elem) # 2.1 +## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>'

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

copy() +

+
source code  +
+ +
+

Test copy handling (etc).

+
+>>> import copy
+>>> e1 = unserialize("<tag>hello<foo/></tag>")
+>>> # e2 = copy.copy(e1)
+>>> e3 = copy.deepcopy(e1)
+>>> e1.find("foo").tag = "bar"
+
+>>> serialize(e1).replace(' ', '')
+'<tag>hello<bar/></tag>'
+
+

## >>> serialize(e2).replace(' ', '') +## '<tag>hello<bar/></tag>'

+
+
+>>> serialize(e3).replace(' ', '')
+'<tag>hello<foo/></tag>'
+
+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

SAMPLE_XML

+ +
+
+
+
Value:
+
+unserialize("""
+<body>
+  <tag>text</tag>
+  <tag />
+  <section>
+    <tag>subtext</tag>
+  </section>
+</body>
+...
+
+
+
+
+
+ +
+ +
+

SAMPLE_XML_NS

+ +
+
+
+
Value:
+
+unserialize("""
+<body xmlns="http://effbot.org/ns">
+  <tag>text</tag>
+  <tag />
+  <section>
+    <tag>subtext</tag>
+  </section>
+</body>
+...
+
+
+
+
+
+ +
+ +
+

ENTITY_XML

+ +
+
+
+
Value:
+
+'''<!DOCTYPE points [
+<!ENTITY % user-entities SYSTEM \'user-entities.xml\'>
+%user-entities;
+]>
+<document>&entity;</document>
+'''
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.selftest2-pysrc.html b/doc/html/api/lxml.tests.selftest2-pysrc.html new file mode 100644 index 00000000..2b15ba3c --- /dev/null +++ b/doc/html/api/lxml.tests.selftest2-pysrc.html @@ -0,0 +1,666 @@ + + + + + lxml.tests.selftest2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module selftest2 + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.selftest2

+
+  1  # $Id: selftest.py 2213 2005-01-11 18:49:47Z fredrik $ 
+  2  # elementtree selftest program 
+  3   
+  4  # this test script uses Python's "doctest" module to check that the 
+  5  # *test script* works as expected. 
+  6   
+  7  import sys 
+  8   
+  9  try: 
+ 10      from StringIO import StringIO 
+ 11      BytesIO = StringIO 
+ 12  except ImportError: 
+ 13      from io import BytesIO, StringIO 
+ 14   
+ 15  from lxml import etree as ElementTree 
+ 16   
+
17 -def stdout(): +
18 if sys.version_info[0] < 3: + 19 return sys.stdout + 20 class bytes_stdout(object): + 21 def write(self, data): + 22 if isinstance(data, bytes): + 23 data = data.decode('ISO8859-1') + 24 sys.stdout.write(data) +
25 return bytes_stdout() + 26 +
27 -def unserialize(text): +
28 file = StringIO(text) + 29 tree = ElementTree.parse(file) + 30 return tree.getroot() +
31 +
32 -def serialize(elem, encoding=None): +
33 file = BytesIO() + 34 tree = ElementTree.ElementTree(elem) + 35 if encoding: + 36 tree.write(file, encoding=encoding) + 37 else: + 38 tree.write(file) + 39 result = file.getvalue() + 40 if sys.version_info[0] >= 3: + 41 result = result.decode('ISO8859-1') + 42 result = result.replace(' />', '/>') + 43 if result[-1:] == '\n': + 44 result = result[:-1] + 45 return result +
46 +
47 -def summarize(elem): +
48 return elem.tag +
49 +
50 -def summarize_list(seq): +
51 return list(map(summarize, seq)) +
52 + 53 SAMPLE_XML = unserialize(""" + 54 <body> + 55 <tag>text</tag> + 56 <tag /> + 57 <section> + 58 <tag>subtext</tag> + 59 </section> + 60 </body> + 61 """) + 62 + 63 SAMPLE_XML_NS = unserialize(""" + 64 <body xmlns="http://effbot.org/ns"> + 65 <tag>text</tag> + 66 <tag /> + 67 <section> + 68 <tag>subtext</tag> + 69 </section> + 70 </body> + 71 """) + 72 + 73 # interface tests + 74 +
75 -def check_string(string): +
76 len(string) + 77 for char in string: + 78 if len(char) != 1: + 79 print("expected one-character string, got %r" % char) + 80 new_string = string + "" + 81 new_string = string + " " + 82 string[:0] +
83 +
84 -def check_mapping(mapping): +
85 len(mapping) + 86 keys = mapping.keys() + 87 items = mapping.items() + 88 for key in keys: + 89 item = mapping[key] + 90 mapping["key"] = "value" + 91 if mapping["key"] != "value": + 92 print("expected value string, got %r" % mapping["key"]) +
93 +
94 -def check_element(element): +
95 if not hasattr(element, "tag"): + 96 print("no tag member") + 97 if not hasattr(element, "attrib"): + 98 print("no attrib member") + 99 if not hasattr(element, "text"): +100 print("no text member") +101 if not hasattr(element, "tail"): +102 print("no tail member") +103 check_string(element.tag) +104 check_mapping(element.attrib) +105 if element.text is not None: +106 check_string(element.text) +107 if element.tail is not None: +108 check_string(element.tail) +
109 +
110 -def check_element_tree(tree): +
111 check_element(tree.getroot()) +
112 +
113 -def element(): +
114 """ +115 Test element tree interface. +116 +117 >>> element = ElementTree.Element("tag") +118 >>> check_element(element) +119 >>> tree = ElementTree.ElementTree(element) +120 >>> check_element_tree(tree) +121 """ +
122 +
123 -def parsefile(): +
124 """ +125 Test parsing from file. Note that we're opening the files in +126 here; by default, the 'parse' function opens the file in binary +127 mode, and doctest doesn't filter out carriage returns. +128 +129 >>> file = open("samples/simple.xml", "rb") +130 >>> tree = ElementTree.parse(file) +131 >>> file.close() +132 >>> tree.write(stdout()) +133 <root> +134 <element key="value">text</element> +135 <element>text</element>tail +136 <empty-element/> +137 </root> +138 >>> file = open("samples/simple-ns.xml", "rb") +139 >>> tree = ElementTree.parse(file) +140 >>> file.close() +141 >>> tree.write(stdout()) +142 <root xmlns="http://namespace/"> +143 <element key="value">text</element> +144 <element>text</element>tail +145 <empty-element/> +146 </root> +147 """ +
148 +
149 -def writefile(): +
150 """ +151 >>> elem = ElementTree.Element("tag") +152 >>> elem.text = "text" +153 >>> serialize(elem) +154 '<tag>text</tag>' +155 >>> ElementTree.SubElement(elem, "subtag").text = "subtext" +156 >>> serialize(elem) +157 '<tag>text<subtag>subtext</subtag></tag>' +158 """ +
159 +
160 -def encoding(): +
161 r""" +162 Test encoding issues. +163 +164 >>> elem = ElementTree.Element("tag") +165 >>> elem.text = u'abc' +166 >>> serialize(elem) +167 '<tag>abc</tag>' +168 >>> serialize(elem, "utf-8") +169 '<tag>abc</tag>' +170 >>> serialize(elem, "us-ascii") +171 '<tag>abc</tag>' +172 >>> serialize(elem, "iso-8859-1").lower() +173 "<?xml version='1.0' encoding='iso-8859-1'?>\n<tag>abc</tag>" +174 +175 >>> elem.text = "<&\"\'>" +176 >>> serialize(elem) +177 '<tag>&lt;&amp;"\'&gt;</tag>' +178 >>> serialize(elem, "utf-8") +179 '<tag>&lt;&amp;"\'&gt;</tag>' +180 >>> serialize(elem, "us-ascii") # cdata characters +181 '<tag>&lt;&amp;"\'&gt;</tag>' +182 >>> serialize(elem, "iso-8859-1").lower() +183 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag>&lt;&amp;"\'&gt;</tag>' +184 +185 >>> elem.attrib["key"] = "<&\"\'>" +186 >>> elem.text = None +187 >>> serialize(elem) +188 '<tag key="&lt;&amp;&quot;\'&gt;"/>' +189 >>> serialize(elem, "utf-8") +190 '<tag key="&lt;&amp;&quot;\'&gt;"/>' +191 >>> serialize(elem, "us-ascii") +192 '<tag key="&lt;&amp;&quot;\'&gt;"/>' +193 >>> serialize(elem, "iso-8859-1").lower() +194 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="&lt;&amp;&quot;\'&gt;"/>' +195 +196 >>> elem.text = u'\xe5\xf6\xf6<>' +197 >>> elem.attrib.clear() +198 >>> serialize(elem) +199 '<tag>&#229;&#246;&#246;&lt;&gt;</tag>' +200 >>> serialize(elem, "utf-8") +201 '<tag>\xc3\xa5\xc3\xb6\xc3\xb6&lt;&gt;</tag>' +202 >>> serialize(elem, "us-ascii") +203 '<tag>&#229;&#246;&#246;&lt;&gt;</tag>' +204 >>> serialize(elem, "iso-8859-1").lower() +205 "<?xml version='1.0' encoding='iso-8859-1'?>\n<tag>\xe5\xf6\xf6&lt;&gt;</tag>" +206 +207 >>> elem.attrib["key"] = u'\xe5\xf6\xf6<>' +208 >>> elem.text = None +209 >>> serialize(elem) +210 '<tag key="&#229;&#246;&#246;&lt;&gt;"/>' +211 >>> serialize(elem, "utf-8") +212 '<tag key="\xc3\xa5\xc3\xb6\xc3\xb6&lt;&gt;"/>' +213 >>> serialize(elem, "us-ascii") +214 '<tag key="&#229;&#246;&#246;&lt;&gt;"/>' +215 >>> serialize(elem, "iso-8859-1").lower() +216 '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="\xe5\xf6\xf6&lt;&gt;"/>' +217 +218 """ +
219 +220 if sys.version_info[0] >= 3: +221 encoding.__doc__ = encoding.__doc__.replace("u'", "'") +222 +
223 -def qname(): +
224 """ +225 Test QName handling. +226 +227 1) decorated tags +228 +229 >>> elem = ElementTree.Element("{uri}tag") +230 >>> serialize(elem) # 1.1 +231 '<ns0:tag xmlns:ns0="uri"/>' +232 +233 ## 2) decorated attributes +234 +235 ## >>> elem.attrib["{uri}key"] = "value" +236 ## >>> serialize(elem) # 2.1 +237 ## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>' +238 +239 """ +
240 +
241 -def cdata(): +
242 """ +243 Test CDATA handling (etc). +244 +245 >>> serialize(unserialize("<tag>hello</tag>")) +246 '<tag>hello</tag>' +247 >>> serialize(unserialize("<tag>&#104;&#101;&#108;&#108;&#111;</tag>")) +248 '<tag>hello</tag>' +249 >>> serialize(unserialize("<tag><![CDATA[hello]]></tag>")) +250 '<tag>hello</tag>' +251 +252 """ +
253 +
254 -def find(): +
255 """ +256 Test find methods (including xpath syntax). +257 +258 >>> elem = SAMPLE_XML +259 >>> elem.find("tag").tag +260 'tag' +261 >>> ElementTree.ElementTree(elem).find("tag").tag +262 'tag' +263 >>> elem.find("section/tag").tag +264 'tag' +265 >>> ElementTree.ElementTree(elem).find("section/tag").tag +266 'tag' +267 >>> elem.findtext("tag") +268 'text' +269 >>> elem.findtext("tog", "default") +270 'default' +271 >>> ElementTree.ElementTree(elem).findtext("tag") +272 'text' +273 >>> elem.findtext("section/tag") +274 'subtext' +275 >>> ElementTree.ElementTree(elem).findtext("section/tag") +276 'subtext' +277 >>> summarize_list(elem.findall("tag")) +278 ['tag', 'tag'] +279 >>> summarize_list(elem.findall("*")) +280 ['tag', 'tag', 'section'] +281 >>> summarize_list(elem.findall(".//tag")) +282 ['tag', 'tag', 'tag'] +283 >>> summarize_list(elem.findall("section/tag")) +284 ['tag'] +285 >>> summarize_list(elem.findall("section//tag")) +286 ['tag'] +287 >>> summarize_list(elem.findall("section/*")) +288 ['tag'] +289 >>> summarize_list(elem.findall("section//*")) +290 ['tag'] +291 >>> summarize_list(elem.findall("section/.//*")) +292 ['tag'] +293 >>> summarize_list(elem.findall("*/*")) +294 ['tag'] +295 >>> summarize_list(elem.findall("*//*")) +296 ['tag'] +297 >>> summarize_list(elem.findall("*/tag")) +298 ['tag'] +299 >>> summarize_list(elem.findall("*/./tag")) +300 ['tag'] +301 >>> summarize_list(elem.findall("./tag")) +302 ['tag', 'tag'] +303 >>> summarize_list(elem.findall(".//tag")) +304 ['tag', 'tag', 'tag'] +305 >>> summarize_list(elem.findall("././tag")) +306 ['tag', 'tag'] +307 >>> summarize_list(ElementTree.ElementTree(elem).findall("/tag")) +308 ['tag', 'tag'] +309 >>> summarize_list(ElementTree.ElementTree(elem).findall("./tag")) +310 ['tag', 'tag'] +311 >>> elem = SAMPLE_XML_NS +312 >>> summarize_list(elem.findall("tag")) +313 [] +314 >>> summarize_list(elem.findall("{http://effbot.org/ns}tag")) +315 ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] +316 >>> summarize_list(elem.findall(".//{http://effbot.org/ns}tag")) +317 ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] +318 """ +
319 +320 # XXX only deep copying is supported +321 +
322 -def copy(): +
323 """ +324 Test copy handling (etc). +325 +326 >>> import copy +327 >>> e1 = unserialize("<tag>hello<foo/></tag>") +328 >>> # e2 = copy.copy(e1) +329 >>> e3 = copy.deepcopy(e1) +330 >>> e1.find("foo").tag = "bar" +331 +332 >>> serialize(e1).replace(' ', '') +333 '<tag>hello<bar/></tag>' +334 +335 ## >>> serialize(e2).replace(' ', '') +336 ## '<tag>hello<bar/></tag>' +337 +338 >>> serialize(e3).replace(' ', '') +339 '<tag>hello<foo/></tag>' +340 +341 """ +
342 +
343 -def attrib(): +
344 """ +345 Test attribute handling. +346 +347 >>> elem = ElementTree.Element("tag") +348 >>> elem.get("key") # 1.1 +349 >>> elem.get("key", "default") # 1.2 +350 'default' +351 >>> elem.set("key", "value") +352 >>> elem.get("key") # 1.3 +353 'value' +354 +355 >>> elem = ElementTree.Element("tag", key="value") +356 >>> elem.get("key") # 2.1 +357 'value' +358 >>> elem.attrib # 2.2 +359 {'key': 'value'} +360 +361 >>> elem = ElementTree.Element("tag", {"key": "value"}) +362 >>> elem.get("key") # 3.1 +363 'value' +364 >>> elem.attrib # 3.2 +365 {'key': 'value'} +366 +367 >>> elem = ElementTree.Element("tag", {"key": "other"}, key="value") +368 >>> elem.get("key") # 4.1 +369 'value' +370 >>> elem.attrib # 4.2 +371 {'key': 'value'} +372 +373 """ +
374 +
375 -def makeelement(): +
376 """ +377 Test makeelement handling. +378 +379 >>> elem = ElementTree.Element("tag") +380 >>> subelem = elem.makeelement("subtag", {"key": "value"}) +381 >>> elem.append(subelem) +382 >>> serialize(elem) +383 '<tag><subtag key="value"/></tag>' +384 +385 >>> elem.clear() +386 >>> serialize(elem) +387 '<tag/>' +388 >>> elem.append(subelem) +389 >>> serialize(elem) +390 '<tag><subtag key="value"/></tag>' +391 +392 """ +
393 +394 ## def observer(): +395 ## """ +396 ## Test observers. +397 +398 ## >>> def observer(action, elem): +399 ## ... print("%s %s" % (action, elem.tag)) +400 ## >>> builder = ElementTree.TreeBuilder() +401 ## >>> builder.addobserver(observer) +402 ## >>> parser = ElementTree.XMLParser(builder) +403 ## >>> file = open("samples/simple.xml", "rb") +404 ## >>> parser.feed(file.read()) +405 ## start root +406 ## start element +407 ## end element +408 ## start element +409 ## end element +410 ## start empty-element +411 ## end empty-element +412 ## end root +413 ## >>> file.close() +414 +415 ## """ +416 +417 ENTITY_XML = """\ +418 <!DOCTYPE points [ +419 <!ENTITY % user-entities SYSTEM 'user-entities.xml'> +420 %user-entities; +421 ]> +422 <document>&entity;</document> +423 """ +424 +425 ## def entity(): +426 ## """ +427 ## Test entity handling. +428 +429 ## 1) bad entities +430 +431 ## >>> ElementTree.XML("<document>&entity;</document>") +432 ## Traceback (most recent call last): +433 ## SyntaxError: undefined entity: line 1, column 10 +434 +435 ## 2) custom entity +436 +437 ## >>> parser = ElementTree.XMLParser() +438 ## >>> parser.entity["entity"] = "text" +439 ## >>> parser.feed(ENTITY_XML) +440 ## >>> root = parser.close() +441 ## >>> serialize(root) +442 ## '<document>text</document>' +443 +444 ## """ +445 +446 if __name__ == "__main__": +447 import doctest, selftest2 +448 failed, tested = doctest.testmod(selftest2) +449 print("%d tests ok." % (tested - failed)) +450 if failed > 0: +451 print("%d tests failed. Exiting with non-zero return code." % failed) +452 sys.exit(1) +453 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_builder-module.html b/doc/html/api/lxml.tests.test_builder-module.html new file mode 100644 index 00000000..5c089ce5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_builder-module.html @@ -0,0 +1,244 @@ + + + + + lxml.tests.test_builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_builder + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_builder

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + BuilderTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_builder-pysrc.html b/doc/html/api/lxml.tests.test_builder-pysrc.html new file mode 100644 index 00000000..051b7c6c --- /dev/null +++ b/doc/html/api/lxml.tests.test_builder-pysrc.html @@ -0,0 +1,299 @@ + + + + + lxml.tests.test_builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_builder + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_builder

+
+ 1  # -*- coding: utf-8 -*- 
+ 2  import unittest 
+ 3   
+ 4  """ 
+ 5  Tests that ElementMaker works properly. 
+ 6  """ 
+ 7   
+ 8  import sys, os.path 
+ 9  from lxml import etree 
+10  from lxml.builder import E 
+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 HelperTestCase, BytesIO, _bytes 
+17   
+18   
+
19 -class BuilderTestCase(HelperTestCase): +
20 etree = etree +21 +
23 class StringSubclass(str): pass +24 wrapped = E.b(StringSubclass('Hello')) +25 self.assertEqual(_bytes('<b>Hello</b>'), etree.tostring(wrapped)) +
26 +
27 - def test_unknown_type_raises(self): +
28 class UnknownType(object): +29 pass +
30 self.assertRaises(TypeError, E.b, UnknownType()) +
31 +
32 - def test_cdata(self): +
33 wrapped = E.b(etree.CDATA('Hello')) +34 self.assertEqual(_bytes('<b><![CDATA[Hello]]></b>'), etree.tostring(wrapped)) +
35 +
36 - def test_cdata_solo(self): +
37 self.assertRaises(ValueError, E.b, 'Hello', etree.CDATA('World')) +
38 +39 +
40 -def test_suite(): +
41 suite = unittest.TestSuite() +42 suite.addTests([unittest.makeSuite(BuilderTestCase)]) +43 return suite +
44 +45 if __name__ == '__main__': +46 print('to test use test.py %s' % __file__) +47 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_builder.BuilderTestCase-class.html b/doc/html/api/lxml.tests.test_builder.BuilderTestCase-class.html new file mode 100644 index 00000000..32cf6fa1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_builder.BuilderTestCase-class.html @@ -0,0 +1,451 @@ + + + + + lxml.tests.test_builder.BuilderTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_builder :: + Class BuilderTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class BuilderTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               BuilderTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_build_from_xpath_result(self) + source code + +
+ +
+   + + + + + + +
test_unknown_type_raises(self) + source code + +
+ +
+   + + + + + + +
test_cdata(self) + source code + +
+ +
+   + + + + + + +
test_cdata_solo(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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_classlookup-module.html b/doc/html/api/lxml.tests.test_classlookup-module.html new file mode 100644 index 00000000..449999dc --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup-module.html @@ -0,0 +1,292 @@ + + + + + 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]
+
+   + + ProxyTestCase
+ Basic tests for element proxy behaviour. +
+   + + ClassLookupTestCase
+ Test cases for different Element class lookup mechanisms. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + xml_str = '<root xmlns="myNS" xmlns:other="otherNS">\n <c1 a1... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..cf9ec7e9 --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup-pysrc.html @@ -0,0 +1,1496 @@ + + + + + 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, os.path, sys, gc 
+  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   
+
27 -class ProxyTestCase(HelperTestCase): +
28 """Basic tests for element proxy behaviour. + 29 """ + 30 etree = etree + 31 +
32 - def test_proxy_reuse(self): +
33 root = etree.XML('<a><b><c/></b></a>') + 34 b = root.find('b') + 35 self.assertTrue(b is root[0]) +
36 +
37 - def test_proxy_reuse_after_gc(self): +
38 root = etree.XML('<a><b><c/></b></a>') + 39 b = root.find('b') + 40 self.assertTrue(self.etree.iselement(b)) + 41 gc.collect() + 42 self.assertTrue(b is root[0]) +
43 +
45 root = etree.XML('<a><b><c/></b></a>') + 46 b = root.find('b') + 47 self.assertTrue(self.etree.iselement(b)) + 48 c = b.find('c') + 49 self.assertTrue(self.etree.iselement(c)) + 50 del root + 51 gc.collect() + 52 self.assertTrue(b[0] is c) +
53 +
54 - def test_proxy_hashing(self): +
55 root = etree.XML('<a><b><c/></b></a>') + 56 old_elements = set(root.iter()) + 57 elements = root.iter() + 58 del root + 59 gc.collect() + 60 + 61 missing = len(old_elements) + 62 self.assertEqual(3, missing) + 63 for new in elements: + 64 for old in old_elements: + 65 if old == new: + 66 self.assertTrue(old is new) + 67 missing -= 1 + 68 break + 69 else: + 70 self.assertTrue(False, "element '%s' is missing" % new.tag) + 71 self.assertEqual(0, missing) +
72 +
73 - def test_element_base(self): +
74 el = self.etree.ElementBase() + 75 self.assertEqual('ElementBase', el.tag) + 76 root = self.etree.ElementBase() + 77 root.append(el) + 78 self.assertEqual('ElementBase', root[0].tag) +
79 +
80 - def test_element_base_children(self): +
81 el = self.etree.ElementBase(etree.ElementBase()) + 82 self.assertEqual('ElementBase', el.tag) + 83 self.assertEqual(1, len(el)) + 84 self.assertEqual('ElementBase', el[0].tag) + 85 + 86 root = self.etree.ElementBase() + 87 root.append(el) + 88 self.assertEqual('ElementBase', root[0].tag) + 89 self.assertEqual('ElementBase', root[0][0].tag) +
90 +
91 - def test_comment_base(self): +
92 el = self.etree.CommentBase('some text') + 93 self.assertEqual(self.etree.Comment, el.tag) + 94 self.assertEqual('some text', el.text) + 95 root = self.etree.Element('root') + 96 root.append(el) + 97 self.assertEqual('some text', root[0].text) +
98 +
99 - def test_pi_base(self): +
100 el = self.etree.PIBase('the target', 'some text') +101 self.assertEqual(self.etree.ProcessingInstruction, el.tag) +102 self.assertEqual('some text', el.text) +103 root = self.etree.Element('root') +104 root.append(el) +105 self.assertEqual('some text', root[0].text) +
106 +107 +
108 -class ClassLookupTestCase(HelperTestCase): +
109 """Test cases for different Element class lookup mechanisms. +110 """ +111 etree = etree +112 +
113 - def tearDown(self): +
116 +
117 - def test_namespace_lookup(self): +
118 class TestElement(etree.ElementBase): +119 FIND_ME = "namespace class" +
120 +121 lookup = etree.ElementNamespaceClassLookup() +122 etree.set_element_class_lookup(lookup) +123 +124 ns = lookup.get_namespace("myNS") +125 ns[None] = TestElement +126 +127 root = etree.XML(xml_str) +128 self.assertEqual(root.FIND_ME, +129 TestElement.FIND_ME) +130 self.assertEqual(root[0].FIND_ME, +131 TestElement.FIND_ME) +132 self.assertFalse(hasattr(root[0][-1], 'FIND_ME')) +
133 +
134 - def test_default_class_lookup(self): +
135 class TestElement(etree.ElementBase): +136 FIND_ME = "default element" +
137 class TestComment(etree.CommentBase): +138 FIND_ME = "default comment" +139 class TestPI(etree.PIBase): +140 FIND_ME = "default pi" +141 +142 parser = etree.XMLParser() +143 +144 lookup = etree.ElementDefaultClassLookup( +145 element=TestElement, comment=TestComment, pi=TestPI) +146 parser.set_element_class_lookup(lookup) +147 +148 root = etree.XML(_bytes("""<?xml version='1.0'?> +149 <root> +150 <?myPI?> +151 <!-- hi --> +152 </root> +153 """), parser) +154 +155 self.assertEqual("default element", root.FIND_ME) +156 self.assertEqual("default pi", root[0].FIND_ME) +157 self.assertEqual("default comment", root[1].FIND_ME) +158 +
160 class TestElement(etree.ElementBase): +161 FIND_ME = "default element" +
162 class TestComment(etree.CommentBase): +163 FIND_ME = "default comment" +164 class TestPI(etree.PIBase): +165 FIND_ME = "default pi" +166 +167 parser = etree.XMLPullParser(events=('start', 'end', 'comment', 'pi')) +168 lookup = etree.ElementDefaultClassLookup( +169 element=TestElement, comment=TestComment, pi=TestPI) +170 parser.set_element_class_lookup(lookup) +171 +172 events_seen = [] +173 +174 def add_events(events): +175 for ev, el in events: +176 events_seen.append((ev, el.FIND_ME)) +177 +178 parser.feed("""<?xml version='1.0'?> +179 <root> +180 <?myPI?> +181 """) +182 add_events(parser.read_events()) +183 +184 parser.feed("<!-- hi -->") +185 add_events(parser.read_events()) +186 +187 parser.feed("</root>") +188 root = parser.close() +189 add_events(parser.read_events()) +190 +191 self.assertEqual([ +192 ('start', "default element"), +193 ('pi', "default pi"), +194 ('comment', "default comment"), +195 ('end', "default element"), +196 ], events_seen) +197 +198 self.assertEqual("default element", root.FIND_ME) +199 self.assertEqual("default pi", root[0].FIND_ME) +200 self.assertEqual("default comment", root[1].FIND_ME) +201 +
202 - def test_evil_class_lookup(self): +
203 class MyLookup(etree.CustomElementClassLookup): +204 def lookup(self, t, d, ns, name): +205 if name == 'none': +206 return None +207 elif name == 'obj': +208 return object() +209 else: +210 return etree.ElementBase +
211 +212 parser = etree.XMLParser() +213 parser.set_element_class_lookup(MyLookup()) +214 +215 root = etree.XML(_bytes('<none/>'), parser) +216 self.assertEqual('none', root.tag) +217 +218 self.assertRaises( +219 TypeError, +220 etree.XML, _bytes("<obj />"), parser) +221 +222 root = etree.XML(_bytes('<root/>'), parser) +223 self.assertEqual('root', root.tag) +224 +
226 class MyLookup(etree.CustomElementClassLookup): +227 def lookup(self, t, d, ns, name): +228 if t == 'element': +229 if name == 'root': +230 return etree.ElementBase +231 return etree.CommentBase +232 elif t == 'comment': +233 return etree.PIBase +234 elif t == 'PI': +235 return etree.EntityBase +236 elif t == 'entity': +237 return etree.ElementBase +238 else: +239 raise ValueError('got type %s' % t) +
240 +241 parser = etree.XMLParser(resolve_entities=False) +242 parser.set_element_class_lookup(MyLookup()) +243 +244 root = etree.XML(_bytes('<root></root>'), parser) +245 self.assertEqual('root', root.tag) +246 self.assertEqual(etree.ElementBase, type(root)) +247 +248 root = etree.XML(_bytes("<root><test/></root>"), parser) +249 self.assertRaises(TypeError, root.__getitem__, 0) +250 +251 root = etree.XML(_bytes("<root><!-- test --></root>"), parser) +252 self.assertRaises(TypeError, root.__getitem__, 0) +253 +254 root = etree.XML(_bytes("<root><?test?></root>"), parser) +255 self.assertRaises(TypeError, root.__getitem__, 0) +256 +257 root = etree.XML( +258 _bytes('<!DOCTYPE root [<!ENTITY myent "ent">]>' +259 '<root>&myent;</root>'), +260 parser) +261 self.assertRaises(TypeError, root.__getitem__, 0) +262 +263 root = etree.XML(_bytes('<root><root/></root>'), parser) +264 self.assertEqual('root', root[0].tag) +265 +
267 class TestElement(etree.ElementBase): +268 FIND_ME = "attribute_based" +
269 +270 class_dict = {"A1" : TestElement} +271 +272 lookup = etree.AttributeBasedElementClassLookup( +273 "a1", class_dict) +274 etree.set_element_class_lookup(lookup) +275 +276 root = etree.XML(xml_str) +277 self.assertFalse(hasattr(root, 'FIND_ME')) +278 self.assertEqual(root[0].FIND_ME, +279 TestElement.FIND_ME) +280 self.assertFalse(hasattr(root[0][0], 'FIND_ME')) +281 +
282 - def test_custom_lookup(self): +
283 class TestElement(etree.ElementBase): +284 FIND_ME = "custom" +
285 +286 class MyLookup(etree.CustomElementClassLookup): +287 def lookup(self, t, d, ns, name): +288 if name == 'c1': +289 return TestElement +290 +291 etree.set_element_class_lookup( MyLookup() ) +292 +293 root = etree.XML(xml_str) +294 self.assertFalse(hasattr(root, 'FIND_ME')) +295 self.assertEqual(root[0].FIND_ME, +296 TestElement.FIND_ME) +297 self.assertFalse(hasattr(root[0][1], 'FIND_ME')) +298 +
300 class TestElement1(etree.ElementBase): +301 FIND_ME = "custom" +
302 +303 class TestElement2(etree.ElementBase): +304 FIND_ME = "nsclasses" +305 +306 class MyLookup(etree.CustomElementClassLookup): +307 def lookup(self, t, d, ns, name): +308 if name == 'c1': +309 return TestElement1 +310 +311 lookup = etree.ElementNamespaceClassLookup( MyLookup() ) +312 etree.set_element_class_lookup(lookup) +313 +314 ns = lookup.get_namespace("otherNS") +315 ns[None] = TestElement2 +316 +317 root = etree.XML(xml_str) +318 self.assertFalse(hasattr(root, 'FIND_ME')) +319 self.assertEqual(root[0].FIND_ME, +320 TestElement1.FIND_ME) +321 self.assertFalse(hasattr(root[0][1], 'FIND_ME')) +322 self.assertEqual(root[0][-1].FIND_ME, +323 TestElement2.FIND_ME) +324 +
325 - def test_parser_based_lookup(self): +
326 class TestElement(etree.ElementBase): +327 FIND_ME = "parser_based" +
328 +329 lookup = etree.ParserBasedElementClassLookup() +330 etree.set_element_class_lookup(lookup) +331 +332 class MyLookup(etree.CustomElementClassLookup): +333 def lookup(self, t, d, ns, name): +334 return TestElement +335 +336 parser = etree.XMLParser() +337 parser.set_element_class_lookup( MyLookup() ) +338 +339 root = etree.parse(BytesIO(xml_str), parser).getroot() +340 self.assertEqual(root.FIND_ME, +341 TestElement.FIND_ME) +342 self.assertEqual(root[0].FIND_ME, +343 TestElement.FIND_ME) +344 +345 root = etree.parse(BytesIO(xml_str)).getroot() +346 self.assertFalse(hasattr(root, 'FIND_ME')) +347 self.assertFalse(hasattr(root[0], 'FIND_ME')) +348 +
349 - def test_class_lookup_reentry(self): +
350 XML = self.etree.XML +351 +352 class TestElement(etree.ElementBase): +353 FIND_ME = "here" +
354 +355 root = None +356 class MyLookup(etree.CustomElementClassLookup): +357 el = None +358 def lookup(self, t, d, ns, name): +359 if root is not None: # not in the parser +360 if self.el is None and name == "a": +361 self.el = [] +362 self.el.append(root.find(name)) +363 return TestElement +364 +365 parser = self.etree.XMLParser() +366 parser.set_element_class_lookup(MyLookup()) +367 +368 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b></root>'), +369 parser) +370 +371 a = root[0] +372 self.assertEqual(a.tag, "a") +373 self.assertEqual(root[0].tag, "a") +374 del a +375 self.assertEqual(root[0].tag, "a") +376 +
378 class Lookup(etree.CustomElementClassLookup): +379 def __init__(self): +380 # no super call here, so no fallback is set +381 pass +
382 +383 def lookup(self, node_type, document, namespace, name): +384 return Foo +385 +386 class Foo(etree.ElementBase): +387 def custom(self): +388 return "test" +389 +390 parser = self.etree.XMLParser() +391 parser.set_element_class_lookup( Lookup() ) +392 +393 root = etree.XML('<foo/>', parser) +394 +395 self.assertEqual("test", root.custom()) +396 +397 +
398 -def test_suite(): +
399 suite = unittest.TestSuite() +400 suite.addTests([unittest.makeSuite(ProxyTestCase)]) +401 suite.addTests([unittest.makeSuite(ClassLookupTestCase)]) +402 return suite +
403 +404 if __name__ == '__main__': +405 print('to test use test.py %s' % __file__) +406 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..18424504 --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup.ClassLookupTestCase-class.html @@ -0,0 +1,623 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ClassLookupTestCase
+
+ +
+Test cases for different Element class lookup mechanisms. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_default_class_lookup_pull_parser(self) + source code + +
+ +
+   + + + + + + +
test_evil_class_lookup(self) + source code + +
+ +
+   + + + + + + +
test_class_lookup_type_mismatch(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.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_classlookup.ProxyTestCase-class.html b/doc/html/api/lxml.tests.test_classlookup.ProxyTestCase-class.html new file mode 100644 index 00000000..76acf25c --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup.ProxyTestCase-class.html @@ -0,0 +1,517 @@ + + + + + lxml.tests.test_classlookup.ProxyTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_classlookup :: + Class ProxyTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ProxyTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ProxyTestCase
+
+ +
+Basic tests for element proxy behaviour. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_proxy_reuse(self) + source code + +
+ +
+   + + + + + + +
test_proxy_reuse_after_gc(self) + source code + +
+ +
+   + + + + + + +
test_proxy_reuse_after_del_root(self) + source code + +
+ +
+   + + + + + + +
test_proxy_hashing(self) + source code + +
+ +
+   + + + + + + +
test_element_base(self) + source code + +
+ +
+   + + + + + + +
test_element_base_children(self) + source code + +
+ +
+   + + + + + + +
test_comment_base(self) + source code + +
+ +
+   + + + + + + +
test_pi_base(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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_css-module.html b/doc/html/api/lxml.tests.test_css-module.html new file mode 100644 index 00000000..872ccb7d --- /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]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + HTML = '\n<div>\n <a href="foo">link</a>\n <a>anchor</a>\n</... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

HTML

+ +
+
+
+
Value:
+
+'''
+<div>
+  <a href="foo">link</a>
+  <a>anchor</a>
+</div>
+'''
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7e7bc801 --- /dev/null +++ b/doc/html/api/lxml.tests.test_css-pysrc.html @@ -0,0 +1,234 @@ + + + + + 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 
+ 2   
+ 3  import lxml.html 
+ 4   
+ 5  from lxml.tests.common_imports import doctest, HelperTestCase, skipif 
+ 6   
+ 7  try: 
+ 8      import cssselect 
+ 9  except ImportError: 
+10      cssselect = None 
+11   
+12   
+13  HTML = ''' 
+14  <div> 
+15    <a href="foo">link</a> 
+16    <a>anchor</a> 
+17  </div> 
+18  ''' 
+19   
+20   
+
21 -class CSSTestCase(HelperTestCase): +
22 +23 pytestmark = skipif('cssselect is None') +24 +
25 - def test_cssselect(self): +
26 div, = lxml.html.fromstring(HTML).xpath('//div') +27 +28 def count(selector, expected_count, **kwargs): +29 result = div.cssselect(selector, **kwargs) +30 self.assertEqual(len(result), expected_count) +
31 +32 count('div', 1) +33 count('a', 2) +34 count('em', 0) +35 # Element names are case-insensitive in HTML +36 count('DIV', 1) +37 # ... but not in XHTML or XML +38 count('DIV', 0, translator='xhtml') +39 count('DIV', 0, translator='xml') +40 +41 # :contains() is case-insensitive in lxml +42 count(':contains("link")', 2) # div, a +43 count(':contains("LInk")', 2) +44 # Whatever the document language +45 count(':contains("LInk")', 2, translator='xhtml') +46 count(':contains("LInk")', 2, translator='xml') +47 # ... but not in upstream cssselect +48 import cssselect +49 count(':contains("link")', 2, translator=cssselect.HTMLTranslator()) +50 count(':contains("LInk")', 0, translator=cssselect.HTMLTranslator()) +
51 +52 +
53 -def test_suite(): +
54 suite = unittest.TestSuite() +55 try: +56 import cssselect +57 except ImportError: +58 # no 'cssselect' installed +59 print("Skipping tests in lxml.cssselect - external cssselect package is not installed") +60 return suite +61 +62 import lxml.cssselect +63 suite.addTests(doctest.DocTestSuite(lxml.cssselect)) +64 suite.addTests([unittest.makeSuite(CSSTestCase)]) +65 return suite +
66 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..2cc8b96d --- /dev/null +++ b/doc/html/api/lxml.tests.test_css.CSSTestCase-class.html @@ -0,0 +1,368 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               CSSTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_cssselect(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + pytestmark = <lxml.tests.common_imports.skipif object> +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_doctestcompare-module.html b/doc/html/api/lxml.tests.test_doctestcompare-module.html new file mode 100644 index 00000000..57321adf --- /dev/null +++ b/doc/html/api/lxml.tests.test_doctestcompare-module.html @@ -0,0 +1,224 @@ + + + + + lxml.tests.test_doctestcompare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_doctestcompare + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_doctestcompare

source code

+ + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + DummyInput +
+   + + DoctestCompareTest +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
indent(elem, + level=0) + source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'lxml.tests' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_doctestcompare-pysrc.html b/doc/html/api/lxml.tests.test_doctestcompare-pysrc.html new file mode 100644 index 00000000..6c643ef2 --- /dev/null +++ b/doc/html/api/lxml.tests.test_doctestcompare-pysrc.html @@ -0,0 +1,363 @@ + + + + + lxml.tests.test_doctestcompare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_doctestcompare + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_doctestcompare

+
+  1  import unittest 
+  2   
+  3  from lxml import etree 
+  4  from lxml.tests.common_imports import HelperTestCase 
+  5  from lxml.doctestcompare import LXMLOutputChecker, PARSE_HTML, PARSE_XML 
+  6   
+  7   
+
8 -class DummyInput: +
9 - def __init__(self, **kw): +
10 for name, value in kw.items(): + 11 setattr(self, name, value) +
12 + 13 +
14 -def indent(elem, level=0): +
15 i = "\n" + level*" " + 16 if len(elem): + 17 if not elem.text or not elem.text.strip(): + 18 elem.text = i + " " + 19 if not elem.tail or not elem.tail.strip(): + 20 elem.tail = i + 21 for elem in elem: + 22 indent(elem, level+1) + 23 if not elem.tail or not elem.tail.strip(): + 24 elem.tail = i + 25 else: + 26 if level and (not elem.tail or not elem.tail.strip()): + 27 elem.tail = i +
28 + 29 +
30 -class DoctestCompareTest(HelperTestCase): +
31 _checker = LXMLOutputChecker() + 32 +
33 - def compare(self, want, got, html=False): +
34 if html: + 35 options = PARSE_HTML + 36 else: + 37 options = PARSE_XML + 38 + 39 parse = self._checker.get_parser(want, got, options) + 40 want_doc = parse(want) + 41 got_doc = parse(got) + 42 return self._checker.collect_diff( + 43 want_doc, got_doc, html, indent=0).lstrip() +
44 +
45 - def assert_diff(self, want, got, diff, html=False): +
46 self.assertEqual(self.compare(want, got, html), diff) +
47 +
48 - def assert_nodiff(self, want, got, html=False): +
49 root = etree.fromstring(want) + 50 root.tail = '\n' + 51 indent(root) + 52 diff = etree.tostring( + 53 root, encoding='unicode', method=html and 'html' or 'xml') + 54 self.assert_diff(want, got, diff, html=html) +
55 +
56 - def test_equal_input(self): +
57 self.assert_nodiff( + 58 '<p title="expected">Expected</p>', + 59 '<p title="expected">Expected</p>') +
60 +
61 - def test_differing_tags(self): +
62 self.assert_diff( + 63 '<p title="expected">Expected</p>', + 64 '<b title="expected">Expected</b>', + 65 '<p (got: b) title="expected">Expected</p (got: b)>\n') +
66 +
67 - def test_tags_upper_lower_case(self): +
68 self.assert_diff( + 69 '<p title="expected">Expected</p>', + 70 '<P title="expected">Expected</P>', + 71 '<p (got: P) title="expected">Expected</p (got: P)>\n') +
72 +
74 self.assert_nodiff( + 75 '<html><body><p title="expected">Expected</p></body></html>', + 76 '<HTML><BODY><P title="expected">Expected</P></BODY></HTML>', + 77 html=True) +
78 +
79 - def test_differing_attributes(self): +
80 self.assert_diff( + 81 '<p title="expected">Expected</p>', + 82 '<p title="actual">Actual</p>', + 83 '<p title="expected (got: actual)">Expected (got: Actual)</p>\n') +
84 +
85 - def test_extra_children(self): +
86 # https://bugs.launchpad.net/lxml/+bug/1238503 + 87 self.assert_diff( + 88 '<p><span>One</span></p>', + 89 '<p><span>One</span><b>Two</b><em>Three</em></p>', + 90 '<p>\n' + 91 ' <span>One</span>\n' + 92 ' +<b>Two</b>\n' + 93 ' +<em>Three</em>\n' + 94 '</p>\n') +
95 +
96 - def test_missing_children(self): +
97 self.assert_diff( + 98 '<p><span>One</span><b>Two</b><em>Three</em></p>', + 99 '<p><span>One</span></p>', +100 '<p>\n' +101 ' <span>One</span>\n' +102 ' -<b>Two</b>\n' +103 ' -<em>Three</em>\n' +104 '</p>\n') +
105 +
106 - def test_extra_attributes(self): +
107 self.assert_diff( +108 '<p><span class="foo">Text</span></p>', +109 '<p><span class="foo" id="bar">Text</span></p>', +110 '<p>\n' +111 ' <span class="foo" +id="bar">Text</span>\n' +112 '</p>\n') +
113 +
114 - def test_missing_attributes(self): +
115 self.assert_diff( +116 '<p><span class="foo" id="bar">Text</span></p>', +117 '<p><span class="foo">Text</span></p>', +118 '<p>\n' +119 ' <span class="foo" -id="bar">Text</span>\n' +120 '</p>\n') +
121 +122 +
123 -def test_suite(): +
124 suite = unittest.TestSuite() +125 suite.addTests([unittest.makeSuite(DoctestCompareTest)]) +126 return suite +
127 +128 +129 if __name__ == '__main__': +130 unittest.main() +131 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_doctestcompare.DoctestCompareTest-class.html b/doc/html/api/lxml.tests.test_doctestcompare.DoctestCompareTest-class.html new file mode 100644 index 00000000..1bb4040d --- /dev/null +++ b/doc/html/api/lxml.tests.test_doctestcompare.DoctestCompareTest-class.html @@ -0,0 +1,554 @@ + + + + + lxml.tests.test_doctestcompare.DoctestCompareTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_doctestcompare :: + Class DoctestCompareTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DoctestCompareTest

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               DoctestCompareTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
compare(self, + want, + got, + html=False) + source code + +
+ +
+   + + + + + + +
assert_diff(self, + want, + got, + diff, + html=False) + source code + +
+ +
+   + + + + + + +
assert_nodiff(self, + want, + got, + html=False) + source code + +
+ +
+   + + + + + + +
test_equal_input(self) + source code + +
+ +
+   + + + + + + +
test_differing_tags(self) + source code + +
+ +
+   + + + + + + +
test_tags_upper_lower_case(self) + source code + +
+ +
+   + + + + + + +
test_tags_upper_lower_case_html(self) + source code + +
+ +
+   + + + + + + +
test_differing_attributes(self) + source code + +
+ +
+   + + + + + + +
test_extra_children(self) + source code + +
+ +
+   + + + + + + +
test_missing_children(self) + source code + +
+ +
+   + + + + + + +
test_extra_attributes(self) + source code + +
+ +
+   + + + + + + +
test_missing_attributes(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _checker = <lxml.doctestcompare.LXMLOutputChecker object> +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_doctestcompare.DummyInput-class.html b/doc/html/api/lxml.tests.test_doctestcompare.DummyInput-class.html new file mode 100644 index 00000000..f4beb9b6 --- /dev/null +++ b/doc/html/api/lxml.tests.test_doctestcompare.DummyInput-class.html @@ -0,0 +1,152 @@ + + + + + lxml.tests.test_doctestcompare.DummyInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_doctestcompare :: + Class DummyInput + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DummyInput

source code

+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kw) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..e4154e77 --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd-module.html @@ -0,0 +1,246 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..474dd670 --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd-pysrc.html @@ -0,0 +1,1459 @@ + + + + + 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, html, BytesIO, _bytes, _str 
+ 14  from common_imports import HelperTestCase, make_doctest, skipIf 
+ 15  from common_imports import fileInTestDir, fileUrlInTestDir 
+
16 + 17 + 18 -class ETreeDtdTestCase(HelperTestCase): +
19 - def test_dtd(self): +
20 pass +
21 +
22 - def test_dtd_file(self): +
23 parse = etree.parse + 24 tree = parse(fileInTestDir("test.xml")) + 25 root = tree.getroot() + 26 + 27 dtd = etree.DTD(fileInTestDir("test.dtd")) + 28 self.assertTrue(dtd.validate(root)) +
29 +
30 - def test_dtd_stringio(self): +
31 root = etree.XML(_bytes("<b/>")) + 32 dtd = etree.DTD(BytesIO("<!ELEMENT b EMPTY>")) + 33 self.assertTrue(dtd.validate(root)) +
34 +
35 - def test_dtd_parse_invalid(self): +
36 fromstring = etree.fromstring + 37 parser = etree.XMLParser(dtd_validation=True) + 38 xml = _bytes('<!DOCTYPE b SYSTEM "%s"><b><a/></b>' % + 39 fileInTestDir("test.dtd")) + 40 self.assertRaises(etree.XMLSyntaxError, + 41 fromstring, xml, parser=parser) +
42 +
44 fromstring = etree.fromstring + 45 dtd_filename = fileUrlInTestDir("__nosuch.dtd") + 46 parser = etree.XMLParser(dtd_validation=True) + 47 xml = _bytes('<!DOCTYPE b SYSTEM "%s"><b><a/></b>' % dtd_filename) + 48 self.assertRaises(etree.XMLSyntaxError, + 49 fromstring, xml, parser=parser) + 50 errors = None + 51 try: + 52 fromstring(xml, parser=parser) + 53 except etree.XMLSyntaxError: + 54 e = sys.exc_info()[1] + 55 self.assertTrue(e.error_log) + 56 self.assertTrue(parser.error_log) + 57 errors = [entry.message for entry in e.error_log + 58 if dtd_filename in entry.message] + 59 self.assertTrue(errors) +
60 +
61 - def test_dtd_parse_valid(self): +
62 parser = etree.XMLParser(dtd_validation=True) + 63 xml = ('<!DOCTYPE a SYSTEM "%s"><a><b/></a>' % + 64 fileUrlInTestDir("test.dtd")) + 65 root = etree.fromstring(xml, parser=parser) +
66 +
68 parser = etree.XMLParser(dtd_validation=True) + 69 xml = ('<!DOCTYPE a SYSTEM "%s"><a><b/></a>' % + 70 fileUrlInTestDir("test.dtd")) + 71 root = etree.fromstring(xml, parser=parser) +
72 +
74 parser = etree.XMLParser(dtd_validation=True) + 75 xml = '<!DOCTYPE a SYSTEM "test.dtd"><a><b/></a>' + 76 root = etree.fromstring( + 77 xml, parser=parser, base_url=fileUrlInTestDir("test.xml")) +
78 +
80 parser = etree.XMLParser(dtd_validation=True) + 81 xml = '<!DOCTYPE a SYSTEM "test.dtd"><a><b/></a>' + 82 root = etree.fromstring( + 83 xml, parser=parser, base_url=fileUrlInTestDir("test.xml")) +
84 +
85 - def test_dtd_invalid(self): +
86 root = etree.XML("<b><a/></b>") + 87 dtd = etree.DTD(BytesIO("<!ELEMENT b EMPTY>")) + 88 self.assertRaises(etree.DocumentInvalid, dtd.assertValid, root) +
89 +
90 - def test_dtd_assertValid(self): +
91 root = etree.XML("<b><a/></b>") + 92 dtd = etree.DTD(BytesIO("<!ELEMENT b (a)><!ELEMENT a EMPTY>")) + 93 dtd.assertValid(root) +
94 +
95 - def test_dtd_internal(self): +
96 root = etree.XML(_bytes(''' + 97 <!DOCTYPE b SYSTEM "none" [ + 98 <!ELEMENT b (a)> + 99 <!ELEMENT a EMPTY> +100 ]> +101 <b><a/></b> +102 ''')) +103 dtd = etree.ElementTree(root).docinfo.internalDTD +104 self.assertTrue(dtd) +105 dtd.assertValid(root) +
106 +
107 - def test_dtd_internal_invalid(self): +
108 root = etree.XML(_bytes(''' +109 <!DOCTYPE b SYSTEM "none" [ +110 <!ELEMENT b (a)> +111 <!ELEMENT a (c)> +112 <!ELEMENT c EMPTY> +113 ]> +114 <b><a/></b> +115 ''')) +116 dtd = etree.ElementTree(root).docinfo.internalDTD +117 self.assertTrue(dtd) +118 self.assertFalse(dtd.validate(root)) +
119 +
121 root = etree.XML(_bytes(''' +122 <a><b id="id1"/><b id="id2"/><b id="id1"/></a> +123 ''')) +124 dtd = etree.DTD(BytesIO(_bytes(""" +125 <!ELEMENT a (b*)> +126 <!ATTLIST b +127 id ID #REQUIRED +128 > +129 <!ELEMENT b EMPTY> +130 """))) +131 self.assertFalse(dtd.validate(root)) +132 self.assertTrue(dtd.error_log) +133 self.assertTrue([error for error in dtd.error_log +134 if 'id1' in error.message]) +
135 +
136 - def test_dtd_api_internal(self): +
137 root = etree.XML(_bytes(''' +138 <!DOCTYPE b SYSTEM "none" [ +139 <!ATTLIST a +140 attr1 (x | y | z) "z" +141 attr2 CDATA #FIXED "X" +142 > +143 <!ELEMENT b (a)> +144 <!ELEMENT a EMPTY> +145 ]> +146 <b><a/></b> +147 ''')) +148 dtd = etree.ElementTree(root).docinfo.internalDTD +149 self.assertTrue(dtd) +150 dtd.assertValid(root) +151 +152 seen = [] +153 for el in dtd.iterelements(): +154 if el.name == 'a': +155 self.assertEqual(2, len(el.attributes())) +156 for attr in el.iterattributes(): +157 if attr.name == 'attr1': +158 self.assertEqual('enumeration', attr.type) +159 self.assertEqual('none', attr.default) +160 self.assertEqual('z', attr.default_value) +161 values = attr.values() +162 values.sort() +163 self.assertEqual(['x', 'y', 'z'], values) +164 else: +165 self.assertEqual('attr2', attr.name) +166 self.assertEqual('cdata', attr.type) +167 self.assertEqual('fixed', attr.default) +168 self.assertEqual('X', attr.default_value) +169 else: +170 self.assertEqual('b', el.name) +171 self.assertEqual(0, len(el.attributes())) +172 seen.append(el.name) +173 seen.sort() +174 self.assertEqual(['a', 'b'], seen) +175 self.assertEqual(2, len(dtd.elements())) +
176 +
177 - def test_internal_dtds(self): +
178 for el_count in range(2, 5): +179 for attr_count in range(4): +180 root = etree.XML(_bytes(''' +181 <!DOCTYPE el0 SYSTEM "none" [ +182 ''' + ''.join([''' +183 <!ATTLIST el%d +184 attr%d (x | y | z) "z" +185 > +186 ''' % (e, a) for a in range(attr_count) for e in range(el_count) +187 ]) + ''.join([''' +188 <!ELEMENT el%d EMPTY> +189 ''' % e for e in range(1, el_count) +190 ]) + ''' +191 ''' + '<!ELEMENT el0 (%s)>' % '|'.join([ +192 'el%d' % e for e in range(1, el_count)]) + ''' +193 ]> +194 <el0><el1 %s /></el0> +195 ''' % ' '.join(['attr%d="x"' % a for a in range(attr_count)]))) +196 dtd = etree.ElementTree(root).docinfo.internalDTD +197 self.assertTrue(dtd) +198 dtd.assertValid(root) +199 +200 e = -1 +201 for e, el in enumerate(dtd.iterelements()): +202 self.assertEqual(attr_count, len(el.attributes())) +203 a = -1 +204 for a, attr in enumerate(el.iterattributes()): +205 self.assertEqual('enumeration', attr.type) +206 self.assertEqual('none', attr.default) +207 self.assertEqual('z', attr.default_value) +208 values = sorted(attr.values()) +209 self.assertEqual(['x', 'y', 'z'], values) +210 self.assertEqual(attr_count - 1, a) +211 self.assertEqual(el_count - 1, e) +212 self.assertEqual(el_count, len(dtd.elements())) +
213 +
214 - def test_dtd_broken(self): +
215 self.assertRaises(etree.DTDParseError, etree.DTD, +216 BytesIO("<!ELEMENT b HONKEY>")) +
217 +
218 - def test_parse_file_dtd(self): +
219 parser = etree.XMLParser(attribute_defaults=True) +220 +221 tree = etree.parse(fileInTestDir('test.xml'), parser) +222 root = tree.getroot() +223 +224 self.assertEqual( +225 "valueA", +226 root.get("default")) +227 self.assertEqual( +228 "valueB", +229 root[0].get("default")) +
230 +231 @skipIf(etree.LIBXML_VERSION == (2, 9, 0), +232 "DTD loading is broken for incremental parsing in libxml2 2.9.0") +
234 iterparse = etree.iterparse +235 iterator = iterparse(fileInTestDir("test.xml"), events=('start',), +236 attribute_defaults=True) +237 attributes = [ element.get("default") +238 for event, element in iterator ] +239 self.assertEqual( +240 ["valueA", "valueB"], +241 attributes) +
242 +243 @skipIf(etree.LIBXML_VERSION == (2, 9, 0), +244 "DTD loading is broken for incremental parsing in libxml2 2.9.0") +
246 iterparse = etree.iterparse +247 iterator = iterparse(fileInTestDir("test.xml"), events=('end',), +248 attribute_defaults=True) +249 attributes = [ element.get("default") +250 for event, element in iterator ] +251 self.assertEqual( +252 ["valueB", "valueA"], +253 attributes) +
254 +
255 - def test_dtd_attrs(self): +
256 dtd = etree.DTD(fileUrlInTestDir("test.dtd")) +257 +258 # Test DTD.system_url attribute +259 self.assertTrue(dtd.system_url.endswith("test.dtd")) +260 +261 # Test elements and their attributes +262 a = dtd.elements()[0] +263 self.assertEqual(a.name, "a") +264 self.assertEqual(a.type, "element") +265 self.assertEqual(a.content.name, "b") +266 self.assertEqual(a.content.type, "element") +267 self.assertEqual(a.content.occur, "once") +268 +269 aattr = a.attributes()[0] +270 self.assertEqual(aattr.name, "default") +271 self.assertEqual(aattr.type, "enumeration") +272 self.assertEqual(aattr.values(), ["valueA", "valueB"]) +273 self.assertEqual(aattr.default_value, "valueA") +274 +275 b = dtd.elements()[1] +276 self.assertEqual(b.name, "b") +277 self.assertEqual(b.type, "empty") +278 self.assertEqual(b.content, None) +279 +280 # Test entities and their attributes +281 c = dtd.entities()[0] +282 self.assertEqual(c.name, "c") +283 self.assertEqual(c.orig, "&#42;") +284 self.assertEqual(c.content, "*") +285 +286 # Test DTD.name attribute +287 root = etree.XML(_bytes(''' +288 <!DOCTYPE a SYSTEM "none" [ +289 <!ELEMENT a EMPTY> +290 ]> +291 <a/> +292 ''')) +293 dtd = etree.ElementTree(root).docinfo.internalDTD +294 self.assertEqual(dtd.name, "a") +295 +296 # Test DTD.name and DTD.systemID attributes +297 parser = etree.XMLParser(dtd_validation=True) +298 xml = '<!DOCTYPE a SYSTEM "test.dtd"><a><b/></a>' +299 root = etree.fromstring(xml, parser=parser, +300 base_url=fileUrlInTestDir("test.xml")) +301 +302 dtd = root.getroottree().docinfo.internalDTD +303 self.assertEqual(dtd.name, "a") +304 self.assertEqual(dtd.system_url, "test.dtd") +
305 +
307 # Standard allows quotes in systemliteral, but in that case +308 # systemliteral must be escaped with single quotes. +309 # See http://www.w3.org/TR/REC-xml/#sec-prolog-dtd. +310 root = etree.XML('''<!DOCTYPE a PUBLIC 'foo' '"'><a/>''') +311 doc = root.getroottree() +312 self.assertEqual(doc.docinfo.doctype, +313 '''<!DOCTYPE a PUBLIC "foo" '"'>''') +314 self.assertEqual(etree.tostring(doc), +315 _bytes('''<!DOCTYPE a PUBLIC "foo" '"'>\n<a/>''')) +
316 +
318 root = etree.XML('''<!DOCTYPE a SYSTEM '"'><a/>''') +319 doc = root.getroottree() +320 self.assertEqual(doc.docinfo.doctype, '''<!DOCTYPE a SYSTEM '"'>''') +321 self.assertEqual(etree.tostring(doc), +322 _bytes('''<!DOCTYPE a SYSTEM '"'>\n<a/>''')) +
323 +
324 - def test_declaration_apos(self): +
325 root = etree.XML('''<!DOCTYPE a SYSTEM "'"><a/>''') +326 doc = root.getroottree() +327 self.assertEqual(doc.docinfo.doctype, '''<!DOCTYPE a SYSTEM "'">''') +328 self.assertEqual(etree.tostring(doc), +329 _bytes('''<!DOCTYPE a SYSTEM "'">\n<a/>''')) +
330 +
331 - def test_ietf_decl(self): +
332 html_data = ( +333 '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">\n' +334 '<html></html>') +335 root = etree.HTML(html_data) +336 doc = root.getroottree() +337 self.assertEqual(doc.docinfo.doctype, +338 '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">') +339 self.assertEqual(etree.tostring(doc, method='html'), _bytes(html_data)) +
340 +
341 - def test_set_decl_public(self): +
342 doc = etree.Element('test').getroottree() +343 doc.docinfo.public_id = 'bar' +344 doc.docinfo.system_url = 'baz' +345 self.assertEqual(doc.docinfo.doctype, +346 '<!DOCTYPE test PUBLIC "bar" "baz">') +347 self.assertEqual(etree.tostring(doc), +348 _bytes('<!DOCTYPE test PUBLIC "bar" "baz">\n<test/>')) +
349 +
350 - def test_html_decl(self): +
351 # Slightly different to one above: when we create an html element, +352 # we do not start with a blank slate. +353 doc = html.Element('html').getroottree() +354 doc.docinfo.public_id = 'bar' +355 doc.docinfo.system_url = 'baz' +356 self.assertEqual(doc.docinfo.doctype, +357 '<!DOCTYPE html PUBLIC "bar" "baz">') +358 self.assertEqual(etree.tostring(doc), +359 _bytes('<!DOCTYPE html PUBLIC "bar" "baz">\n<html/>')) +
360 +
361 - def test_clean_doctype(self): +
362 doc = html.Element('html').getroottree() +363 self.assertTrue(doc.docinfo.doctype != '') +364 doc.docinfo.clear() +365 self.assertTrue(doc.docinfo.doctype == '') +
366 +
367 - def test_set_decl_system(self): +
368 doc = etree.Element('test').getroottree() +369 doc.docinfo.system_url = 'baz' +370 self.assertEqual(doc.docinfo.doctype, +371 '<!DOCTYPE test SYSTEM "baz">') +372 self.assertEqual(etree.tostring(doc), +373 _bytes('<!DOCTYPE test SYSTEM "baz">\n<test/>')) +
374 +
375 - def test_empty_decl(self): +
376 doc = etree.Element('test').getroottree() +377 doc.docinfo.public_id = None +378 self.assertEqual(doc.docinfo.doctype, +379 '<!DOCTYPE test>') +380 self.assertTrue(doc.docinfo.public_id is None) +381 self.assertTrue(doc.docinfo.system_url is None) +382 self.assertEqual(etree.tostring(doc), +383 _bytes('<!DOCTYPE test>\n<test/>')) +
384 +
385 - def test_invalid_decl_1(self): +
386 docinfo = etree.Element('test').getroottree().docinfo +387 +388 def set_public_id(value): +389 docinfo.public_id = value +
390 self.assertRaises(ValueError, set_public_id, _str('ä')) +391 self.assertRaises(ValueError, set_public_id, _str('qwerty ä asdf')) +
392 +
393 - def test_invalid_decl_2(self): +
394 docinfo = etree.Element('test').getroottree().docinfo +395 +396 def set_system_url(value): +397 docinfo.system_url = value +
398 self.assertRaises(ValueError, set_system_url, '\'"') +399 self.assertRaises(ValueError, set_system_url, '"\'') +400 self.assertRaises(ValueError, set_system_url, ' " \' ') +401 +
402 - def test_comment_before_dtd(self): +
403 data = '<!--comment--><!DOCTYPE test>\n<!-- --><test/>' +404 doc = etree.fromstring(data).getroottree() +405 self.assertEqual(etree.tostring(doc), +406 _bytes(data)) +
407 +
408 +409 -def test_suite(): +
410 suite = unittest.TestSuite() +411 suite.addTests([unittest.makeSuite(ETreeDtdTestCase)]) +412 suite.addTests( +413 [make_doctest('../../../doc/validation.txt')]) +414 return suite +
415 +416 if __name__ == '__main__': +417 print('to test use test.py %s' % __file__) +418 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..9f58f16c --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd.ETreeDtdTestCase-class.html @@ -0,0 +1,938 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeDtdTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_file_url(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_valid_relative(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_valid_relative_file_url(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_invalid_duplicate_id(self) + source code + +
+ +
+   + + + + + + +
test_dtd_api_internal(self) + source code + +
+ +
+   + + + + + + +
test_internal_dtds(self) + source code + +
+ +
+   + + + + + + +
test_dtd_broken(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_dtd(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_file_dtd_start(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_file_dtd_end(self) + source code + +
+ +
+   + + + + + + +
test_dtd_attrs(self) + source code + +
+ +
+   + + + + + + +
test_declaration_escape_quote_pid(self) + source code + +
+ +
+   + + + + + + +
test_declaration_quote_withoutpid(self) + source code + +
+ +
+   + + + + + + +
test_declaration_apos(self) + source code + +
+ +
+   + + + + + + +
test_ietf_decl(self) + source code + +
+ +
+   + + + + + + +
test_set_decl_public(self) + source code + +
+ +
+   + + + + + + +
test_html_decl(self) + source code + +
+ +
+   + + + + + + +
test_clean_doctype(self) + source code + +
+ +
+   + + + + + + +
test_set_decl_system(self) + source code + +
+ +
+   + + + + + + +
test_empty_decl(self) + source code + +
+ +
+   + + + + + + +
test_invalid_decl_1(self) + source code + +
+ +
+   + + + + + + +
test_invalid_decl_2(self) + source code + +
+ +
+   + + + + + + +
test_comment_before_dtd(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

test_iterparse_file_dtd_start(self) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @skipIf(etree.LIBXML_VERSION== (2, 9, 0), "DTD loading is broken for incremental parsing in libxml2 2.9.0")
  • +
+
+
+
+ +
+ +
+ + +
+

test_iterparse_file_dtd_end(self) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @skipIf(etree.LIBXML_VERSION== (2, 9, 0), "DTD loading is broken for incremental parsing in libxml2 2.9.0")
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementpath-module.html b/doc/html/api/lxml.tests.test_elementpath-module.html new file mode 100644 index 00000000..089905f2 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementpath-module.html @@ -0,0 +1,250 @@ + + + + + lxml.tests.test_elementpath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementpath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_elementpath

source code

+Tests for the ElementPath implementation. + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + EtreeElementPathTestCase +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
summarize(elem) + source code + +
+ +
+   + + + + + + +
summarize_list(seq) + source code + +
+ +
+   + + + + + + +
normalize_crlf(tree) + source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'lxml.tests' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementpath-pysrc.html b/doc/html/api/lxml.tests.test_elementpath-pysrc.html new file mode 100644 index 00000000..b461d480 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementpath-pysrc.html @@ -0,0 +1,758 @@ + + + + + lxml.tests.test_elementpath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementpath + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_elementpath

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Tests for the ElementPath implementation. 
+  5  """ 
+  6   
+  7  from __future__ import absolute_import 
+  8   
+  9  import unittest 
+ 10  from copy import deepcopy 
+ 11  from .common_imports import etree, HelperTestCase 
+ 12   
+ 13   
+
14 -def summarize(elem): +
15 return elem.tag +
16 +
17 -def summarize_list(seq): +
18 return list(map(summarize, seq)) +
19 +
20 -def normalize_crlf(tree): +
21 for elem in tree.getiterator(): + 22 if elem.text: elem.text = elem.text.replace("\r\n", "\n") + 23 if elem.tail: elem.tail = elem.tail.replace("\r\n", "\n") +
24 + 25 +
26 -class EtreeElementPathTestCase(HelperTestCase): +
27 etree = etree + 28 from lxml import _elementpath + 29 +
30 - def test_cache(self): +
31 self._elementpath._cache.clear() + 32 el = self.etree.XML(b'<a><b><c/><c/></b></a>') + 33 self.assertFalse(self._elementpath._cache) + 34 + 35 self.assertTrue(el.findall('b/c')) + 36 self.assertEqual(1, len(self._elementpath._cache)) + 37 self.assertTrue(el.findall('b/c')) + 38 self.assertEqual(1, len(self._elementpath._cache)) + 39 self.assertFalse(el.findall('xxx')) + 40 self.assertEqual(2, len(self._elementpath._cache)) + 41 self.assertFalse(el.findall('xxx')) + 42 self.assertEqual(2, len(self._elementpath._cache)) + 43 self.assertTrue(el.findall('b/c')) + 44 self.assertEqual(2, len(self._elementpath._cache)) +
45 +
46 - def _assert_tokens(self, tokens, path, namespaces=None): +
47 self.assertEqual(tokens, list(self._elementpath.xpath_tokenizer(path, namespaces))) +
48 +
49 - def test_tokenizer(self): +
50 assert_tokens = self._assert_tokens + 51 assert_tokens( + 52 [('/', '')], + 53 '/', + 54 ) + 55 assert_tokens( + 56 [('.', ''), ('/', ''), ('', 'a'), ('/', ''), ('', 'b'), ('/', ''), ('', 'c')], + 57 './a/b/c', + 58 ) + 59 assert_tokens( + 60 [('/', ''), ('', 'a'), ('/', ''), ('', 'b'), ('/', ''), ('', 'c')], + 61 '/a/b/c', + 62 ) + 63 assert_tokens( + 64 [('/', ''), ('', '{nsx}a'), ('/', ''), ('', '{nsy}b'), ('/', ''), ('', 'c')], + 65 '/x:a/y:b/c', + 66 {'x': 'nsx', 'y': 'nsy'}, + 67 ) + 68 assert_tokens( + 69 [('/', ''), ('', '{nsx}a'), ('/', ''), ('', '{nsy}b'), ('/', ''), ('', '{nsnone}c')], + 70 '/x:a/y:b/c', + 71 {'x': 'nsx', 'y': 'nsy', None: 'nsnone'}, + 72 ) +
73 +
74 - def test_tokenizer_predicates(self): +
75 assert_tokens = self._assert_tokens + 76 assert_tokens( + 77 [('', 'a'), ('[', ''), ('', 'b'), (']', '')], + 78 'a[b]', + 79 ) + 80 assert_tokens( + 81 [('', 'a'), ('[', ''), ('', 'b'), ('=', ''), ('"abc"', ''), (']', '')], + 82 'a[b="abc"]', + 83 ) + 84 assert_tokens( + 85 [('', 'a'), ('[', ''), ('.', ''), ('', ''), ('=', ''), ('', ''), ('"abc"', ''), (']', '')], + 86 'a[. = "abc"]', + 87 ) +
88 +
89 - def test_xpath_tokenizer(self): +
90 # Test the XPath tokenizer. Copied from CPython's "test_xml_etree.py" + 91 ElementPath = self._elementpath + 92 + 93 def check(p, expected, namespaces=None): + 94 self.assertEqual([op or tag + 95 for op, tag in ElementPath.xpath_tokenizer(p, namespaces)], + 96 expected) +
97 + 98 # tests from the xml specification + 99 check("*", ['*']) +100 check("text()", ['text', '()']) +101 check("@name", ['@', 'name']) +102 check("@*", ['@', '*']) +103 check("para[1]", ['para', '[', '1', ']']) +104 check("para[last()]", ['para', '[', 'last', '()', ']']) +105 check("*/para", ['*', '/', 'para']) +106 check("/doc/chapter[5]/section[2]", +107 ['/', 'doc', '/', 'chapter', '[', '5', ']', +108 '/', 'section', '[', '2', ']']) +109 check("chapter//para", ['chapter', '//', 'para']) +110 check("//para", ['//', 'para']) +111 check("//olist/item", ['//', 'olist', '/', 'item']) +112 check(".", ['.']) +113 check(".//para", ['.', '//', 'para']) +114 check("..", ['..']) +115 check("../@lang", ['..', '/', '@', 'lang']) +116 check("chapter[title]", ['chapter', '[', 'title', ']']) +117 check("employee[@secretary and @assistant]", ['employee', +118 '[', '@', 'secretary', '', 'and', '', '@', 'assistant', ']']) +119 +120 # additional tests +121 check("@{ns}attr", ['@', '{ns}attr']) +122 check("{http://spam}egg", ['{http://spam}egg']) +123 check("./spam.egg", ['.', '/', 'spam.egg']) +124 check(".//{http://spam}egg", ['.', '//', '{http://spam}egg']) +125 +126 # wildcard tags +127 check("{ns}*", ['{ns}*']) +128 check("{}*", ['{}*']) +129 check("{*}tag", ['{*}tag']) +130 check("{*}*", ['{*}*']) +131 check(".//{*}tag", ['.', '//', '{*}tag']) +132 +133 # namespace prefix resolution +134 check("./xsd:type", ['.', '/', '{http://www.w3.org/2001/XMLSchema}type'], +135 {'xsd': 'http://www.w3.org/2001/XMLSchema'}) +136 check("type", ['{http://www.w3.org/2001/XMLSchema}type'], +137 {'': 'http://www.w3.org/2001/XMLSchema'}) +138 check("@xsd:type", ['@', '{http://www.w3.org/2001/XMLSchema}type'], +139 {'xsd': 'http://www.w3.org/2001/XMLSchema'}) +140 check("@type", ['@', 'type'], +141 {'': 'http://www.w3.org/2001/XMLSchema'}) +142 check("@{*}type", ['@', '{*}type'], +143 {'': 'http://www.w3.org/2001/XMLSchema'}) +144 check("@{ns}attr", ['@', '{ns}attr'], +145 {'': 'http://www.w3.org/2001/XMLSchema', +146 'ns': 'http://www.w3.org/2001/XMLSchema'}) +
147 +
148 - def test_find(self): +
149 """ +150 Test find methods (including xpath syntax). +151 Originally copied from 'selftest.py'. +152 """ +153 elem = etree.XML(""" +154 <body> +155 <tag class='a'>text</tag> +156 <tag class='b' /> +157 <section> +158 <tag class='b' id='inner'>subtext</tag> +159 </section> +160 </body> +161 """) +162 +163 self.assertEqual(elem.find("tag").tag, +164 'tag') +165 self.assertEqual(etree.ElementTree(elem).find("tag").tag, +166 'tag') +167 self.assertEqual(elem.find("section/tag").tag, +168 'tag') +169 self.assertEqual(etree.ElementTree(elem).find("section/tag").tag, +170 'tag') +171 +172 self.assertEqual(elem.findtext("tag"), +173 'text') +174 self.assertEqual(elem.findtext("tog"), +175 None) +176 self.assertEqual(elem.findtext("tog", "default"), +177 'default') +178 self.assertEqual(etree.ElementTree(elem).findtext("tag"), +179 'text') +180 self.assertEqual(elem.findtext("section/tag"), +181 'subtext') +182 self.assertEqual(etree.ElementTree(elem).findtext("section/tag"), +183 'subtext') +184 +185 self.assertEqual(summarize_list(elem.findall("tag")), +186 ['tag', 'tag']) +187 self.assertEqual(summarize_list(elem.findall("*")), +188 ['tag', 'tag', 'section']) +189 self.assertEqual(summarize_list(elem.findall(".//tag")), +190 ['tag', 'tag', 'tag']) +191 self.assertEqual(summarize_list(elem.findall("section/tag")), +192 ['tag']) +193 self.assertEqual(summarize_list(elem.findall("section//tag")), +194 ['tag']) +195 +196 self.assertEqual(summarize_list(elem.findall("section/*")), +197 ['tag']) +198 self.assertEqual(summarize_list(elem.findall("section//*")), +199 ['tag']) +200 self.assertEqual(summarize_list(elem.findall("section/.//*")), +201 ['tag']) +202 self.assertEqual(summarize_list(elem.findall("*/*")), +203 ['tag']) +204 self.assertEqual(summarize_list(elem.findall("*//*")), +205 ['tag']) +206 self.assertEqual(summarize_list(elem.findall("*/tag")), +207 ['tag']) +208 self.assertEqual(summarize_list(elem.findall("*/./tag")), +209 ['tag']) +210 self.assertEqual(summarize_list(elem.findall("./tag")), +211 ['tag', 'tag']) +212 self.assertEqual(summarize_list(elem.findall(".//tag")), +213 ['tag', 'tag', 'tag']) +214 self.assertEqual(summarize_list(elem.findall("././tag")), +215 ['tag', 'tag']) +216 +217 self.assertEqual(summarize_list(elem.findall(".//tag[@class]")), +218 ['tag', 'tag', 'tag']) +219 self.assertEqual(summarize_list(elem.findall(".//tag[ @class]")), +220 ['tag', 'tag', 'tag']) +221 self.assertEqual(summarize_list(elem.findall(".//tag[@class ]")), +222 ['tag', 'tag', 'tag']) +223 self.assertEqual(summarize_list(elem.findall(".//tag[ @class ]")), +224 ['tag', 'tag', 'tag']) +225 self.assertEqual(summarize_list(elem.findall(".//tag[@class='a']")), +226 ['tag']) +227 self.assertEqual(summarize_list(elem.findall('.//tag[@class="a"]')), +228 ['tag']) +229 self.assertEqual(summarize_list(elem.findall(".//tag[@class='b']")), +230 ['tag', 'tag']) +231 self.assertEqual(summarize_list(elem.findall('.//tag[@class="b"]')), +232 ['tag', 'tag']) +233 self.assertEqual(summarize_list(elem.findall('.//tag[@class = "b"]')), +234 ['tag', 'tag']) +235 self.assertEqual(summarize_list(elem.findall(".//tag[@id]")), +236 ['tag']) +237 self.assertEqual(summarize_list(elem.findall(".//tag[@class][@id]")), +238 ['tag']) +239 self.assertEqual(summarize_list(elem.findall(".//section[tag]")), +240 ['section']) +241 self.assertEqual(summarize_list(elem.findall(".//section[element]")), +242 []) +243 +244 self.assertEqual(summarize_list(elem.findall(".//section[tag='subtext']")), +245 ['section']) +246 self.assertEqual(summarize_list(elem.findall(".//section[tag ='subtext']")), +247 ['section']) +248 self.assertEqual(summarize_list(elem.findall(".//section[tag= 'subtext']")), +249 ['section']) +250 self.assertEqual(summarize_list(elem.findall(".//section[tag = 'subtext']")), +251 ['section']) +252 self.assertEqual(summarize_list(elem.findall(".//section[ tag = 'subtext' ]")), +253 ['section']) +254 self.assertEqual(summarize_list(elem.findall(".//tag[.='subtext']")), +255 ['tag']) +256 self.assertEqual(summarize_list(elem.findall(".//tag[. ='subtext']")), +257 ['tag']) +258 self.assertEqual(summarize_list(elem.findall('.//tag[.= "subtext"]')), +259 ['tag']) +260 self.assertEqual(summarize_list(elem.findall(".//tag[. = 'subtext']")), +261 ['tag']) +262 self.assertEqual(summarize_list(elem.findall(".//tag[. = 'subtext ']")), +263 []) +264 self.assertEqual(summarize_list(elem.findall(".//tag[.= ' subtext']")), +265 []) +266 +267 self.assertEqual(summarize_list(elem.findall("../tag")), +268 []) +269 self.assertEqual(summarize_list(elem.findall("section/../tag")), +270 ['tag', 'tag']) +271 self.assertEqual(summarize_list(etree.ElementTree(elem).findall("./tag")), +272 ['tag', 'tag']) +273 +274 # FIXME: ET's Path module handles this case incorrectly; this gives +275 # a warning in 1.3, and the behaviour will be modified in 1.4. +276 self.assertEqual(summarize_list(etree.ElementTree(elem).findall("/tag")), +277 ['tag', 'tag']) +278 +279 # duplicate section => 2x tag matches +280 elem[1] = deepcopy(elem[2]) +281 self.assertEqual(summarize_list(elem.findall(".//section[tag = 'subtext']")), +282 ['section', 'section']) +283 self.assertEqual(summarize_list(elem.findall(".//tag[. = 'subtext']")), +284 ['tag', 'tag']) +285 self.assertEqual(summarize_list(elem.findall(".//tag[@class][@id]")), +286 ['tag', 'tag']) +
287 +288 +289 #class ElementTreeElementPathTestCase(EtreeElementPathTestCase): +290 # import xml.etree.ElementTree as etree +291 # import xml.etree.ElementPath as _elementpath +292 +293 +
294 -def test_suite(): +
295 suite = unittest.TestSuite() +296 suite.addTests([unittest.makeSuite(EtreeElementPathTestCase)]) +297 #suite.addTests([unittest.makeSuite(ElementTreeElementPathTestCase)]) +298 return suite +
299 +300 +301 if __name__ == '__main__': +302 print('to test use test.py %s' % __file__) +303 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html b/doc/html/api/lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html new file mode 100644 index 00000000..953aa52c --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html @@ -0,0 +1,488 @@ + + + + + lxml.tests.test_elementpath.EtreeElementPathTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementpath :: + Class EtreeElementPathTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class EtreeElementPathTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               EtreeElementPathTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_cache(self) + source code + +
+ +
+   + + + + + + +
_assert_tokens(self, + tokens, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
test_tokenizer(self) + source code + +
+ +
+   + + + + + + +
test_tokenizer_predicates(self) + source code + +
+ +
+   + + + + + + +
test_xpath_tokenizer(self) + source code + +
+ +
+   + + + + + + +
test_find(self)
+ Test find methods (including xpath syntax). +Originally copied from 'selftest.py'.
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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-module.html b/doc/html/api/lxml.tests.test_elementtree-module.html new file mode 100644 index 00000000..68bd55a4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree-module.html @@ -0,0 +1,380 @@ + + + + + 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 +
+   + + _ElementSlicingTest +
+   + + _XMLPullParserTest +
+   + + _C14NTest +
+   + + ETreeTestCase +
+   + + ETreePullTestCase +
+   + + ETreeElementSlicingTest +
+   + + ETreeC14NTest +
+   + + ETreeC14N2WriteTest +
+   + + ETreeC14N2TostringTest +
+   + + ElementTreeTestCase +
+   + + ElementTreeElementSlicingTest +
+   + + CElementTreeTestCase +
+   + + CElementTreeElementSlicingTest +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
et_needs_pyversion(*version) + source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + cElementTree = None
+ hash(x) +
+   + + ElementTreePullTestCase = None
+ hash(x) +
+   + + ElementTreeC14NTest = None
+ hash(x) +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..0f917b14 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree-pysrc.html @@ -0,0 +1,15683 @@ + + + + + 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 copy 
+  12  import io 
+  13  import operator 
+  14  import os 
+  15  import re 
+  16  import sys 
+  17  import textwrap 
+  18  import unittest 
+  19  from contextlib import contextmanager 
+  20  from functools import wraps, partial 
+  21  from itertools import islice 
+  22   
+  23  this_dir = os.path.dirname(__file__) 
+  24  if this_dir not in sys.path: 
+  25      sys.path.insert(0, this_dir) # needed for Py3 
+  26   
+  27  from common_imports import BytesIO, etree, HelperTestCase 
+  28  from common_imports import ElementTree, cElementTree, ET_VERSION, CET_VERSION 
+  29  from common_imports import filter_by_version, fileInTestDir, canonicalize, tmpfile 
+  30  from common_imports import _str, _bytes, unicode, next, IS_PYTHON2 
+  31   
+  32  if cElementTree is not None and (CET_VERSION <= (1,0,7) or sys.version_info[0] >= 3): 
+  33      cElementTree = None 
+  34   
+  35  if ElementTree is not None: 
+  36      print("Comparing with ElementTree %s" % getattr(ElementTree, "VERSION", "?")) 
+  37   
+  38  if cElementTree is not None: 
+  39      print("Comparing with cElementTree %s" % getattr(cElementTree, "VERSION", "?")) 
+
40 + 41 + 42 -def et_needs_pyversion(*version): +
43 def wrap(method): + 44 @wraps(method) + 45 def testfunc(self, *args): + 46 if self.etree is not etree and sys.version_info < version: + 47 raise unittest.SkipTest("requires ET in Python %s" % '.'.join(map(str, version))) + 48 return method(self, *args) +
49 return testfunc + 50 return wrap + 51 +
52 + 53 -class _ETreeTestCaseBase(HelperTestCase): +
54 etree = None + 55 required_versions_ET = {} + 56 required_versions_cET = {} + 57 +
58 - def XMLParser(self, **kwargs): +
59 try: + 60 XMLParser = self.etree.XMLParser + 61 except AttributeError: + 62 assert 'ElementTree' in self.etree.__name__ + 63 XMLParser = self.etree.TreeBuilder + 64 return XMLParser(**kwargs) +
65 + 66 try: + 67 HelperTestCase.assertRegex + 68 except AttributeError: +
69 - def assertRegex(self, *args, **kwargs): +
70 return self.assertRegexpMatches(*args, **kwargs) +
71 + 72 @et_needs_pyversion(3, 6) +
73 - def test_interface(self): +
74 # Test element tree interface. + 75 + 76 def check_string(string): + 77 len(string) + 78 for char in string: + 79 self.assertEqual(len(char), 1, + 80 msg="expected one-character string, got %r" % char) + 81 new_string = string + "" + 82 new_string = string + " " + 83 string[:0] +
84 + 85 def check_mapping(mapping): + 86 len(mapping) + 87 keys = mapping.keys() + 88 items = mapping.items() + 89 for key in keys: + 90 item = mapping[key] + 91 mapping["key"] = "value" + 92 self.assertEqual(mapping["key"], "value", + 93 msg="expected value string, got %r" % mapping["key"]) +
94 + 95 def check_element(element): + 96 self.assertTrue(self.etree.iselement(element), msg="not an element") + 97 direlem = dir(element) + 98 for attr in 'tag', 'attrib', 'text', 'tail': + 99 self.assertTrue(hasattr(element, attr), + 100 msg='no %s member' % attr) + 101 self.assertIn(attr, direlem, + 102 msg='no %s visible by dir' % attr) + 103 + 104 check_string(element.tag) + 105 check_mapping(element.attrib) + 106 if element.text is not None: + 107 check_string(element.text) + 108 if element.tail is not None: + 109 check_string(element.tail) + 110 for elem in element: + 111 check_element(elem) + 112 + 113 element = self.etree.Element("tag") + 114 check_element(element) + 115 tree = self.etree.ElementTree(element) + 116 check_element(tree.getroot()) + 117 element = self.etree.Element(u"t\xe4g", key="value") + 118 tree = self.etree.ElementTree(element) + 119 # lxml and ET Py2: slightly different repr() + 120 #self.assertRegex(repr(element), r"^<Element 't\xe4g' at 0x.*>$") + 121 element = self.etree.Element("tag", key="value") + 122 + 123 # Make sure all standard element methods exist. + 124 + 125 def check_method(method): + 126 self.assertTrue(hasattr(method, '__call__'), + 127 msg="%s not callable" % method) + 128 + 129 check_method(element.append) + 130 check_method(element.extend) + 131 check_method(element.insert) + 132 check_method(element.remove) + 133 check_method(element.getchildren) + 134 check_method(element.find) + 135 check_method(element.iterfind) + 136 check_method(element.findall) + 137 check_method(element.findtext) + 138 check_method(element.clear) + 139 check_method(element.get) + 140 check_method(element.set) + 141 check_method(element.keys) + 142 check_method(element.items) + 143 check_method(element.iter) + 144 check_method(element.itertext) + 145 check_method(element.getiterator) + 146 + 147 # These methods return an iterable. See bug 6472. + 148 + 149 def check_iter(it): + 150 check_method(it.next if IS_PYTHON2 else it.__next__) + 151 + 152 check_iter(element.iterfind("tag")) + 153 check_iter(element.iterfind("*")) + 154 check_iter(tree.iterfind("tag")) + 155 check_iter(tree.iterfind("*")) + 156 + 157 # These aliases are provided: + 158 + 159 # not an alias in lxml + 160 #self.assertEqual(self.etree.XML, self.etree.fromstring) + 161 self.assertEqual(self.etree.PI, self.etree.ProcessingInstruction) + 162 +
163 - def test_element(self): +
164 for i in range(10): + 165 e = self.etree.Element('foo') + 166 self.assertEqual(e.tag, 'foo') + 167 self.assertEqual(e.text, None) + 168 self.assertEqual(e.tail, None) +
169 +
170 - def test_simple(self): +
171 Element = self.etree.Element + 172 + 173 root = Element('root') + 174 root.append(Element('one')) + 175 root.append(Element('two')) + 176 root.append(Element('three')) + 177 self.assertEqual(3, len(root)) + 178 self.assertEqual('one', root[0].tag) + 179 self.assertEqual('two', root[1].tag) + 180 self.assertEqual('three', root[2].tag) + 181 self.assertRaises(IndexError, operator.getitem, root, 3) +
182 + 183 # test weird dictionary interaction leading to segfault previously +
184 - def test_weird_dict_interaction(self): +
185 root = self.etree.Element('root') + 186 self.assertEqual(root.tag, "root") + 187 add = self.etree.ElementTree(file=BytesIO('<foo>Foo</foo>')) + 188 self.assertEqual(add.getroot().tag, "foo") + 189 self.assertEqual(add.getroot().text, "Foo") + 190 root.append(self.etree.Element('baz')) + 191 self.assertEqual(root.tag, "root") + 192 self.assertEqual(root[0].tag, "baz") +
193 +
194 - def test_subelement(self): +
195 Element = self.etree.Element + 196 SubElement = self.etree.SubElement + 197 + 198 root = Element('root') + 199 SubElement(root, 'one') + 200 SubElement(root, 'two') + 201 SubElement(root, 'three') + 202 self.assertEqual(3, len(root)) + 203 self.assertEqual('one', root[0].tag) + 204 self.assertEqual('two', root[1].tag) + 205 self.assertEqual('three', root[2].tag) +
206 +
207 - def test_element_contains(self): +
208 Element = self.etree.Element + 209 SubElement = self.etree.SubElement + 210 + 211 root1 = Element('root') + 212 SubElement(root1, 'one') + 213 self.assertTrue(root1[0] in root1) + 214 + 215 root2 = Element('root') + 216 SubElement(root2, 'two') + 217 SubElement(root2, 'three') + 218 self.assertTrue(root2[0] in root2) + 219 self.assertTrue(root2[1] in root2) + 220 + 221 self.assertFalse(root1[0] in root2) + 222 self.assertFalse(root2[0] in root1) + 223 self.assertFalse(None in root2) +
224 +
226 ElementTree = self.etree.ElementTree + 227 + 228 f = BytesIO('<doc>Test<one>One</one></doc>') + 229 doc = ElementTree(file=f) + 230 root = doc.getroot() + 231 self.assertEqual(1, len(root)) + 232 self.assertEqual('one', root[0].tag) + 233 self.assertRaises(IndexError, operator.getitem, root, 1) +
234 +
236 ElementTree = self.etree.ElementTree + 237 + 238 f = BytesIO('<doc><one>One</one><two>Two</two>hm<three>Three</three></doc>') + 239 doc = ElementTree(file=f) + 240 root = doc.getroot() + 241 self.assertEqual(3, len(root)) + 242 self.assertEqual('one', root[0].tag) + 243 self.assertEqual('two', root[1].tag) + 244 self.assertEqual('three', root[2].tag) +
245 +
247 ElementTree = self.etree.ElementTree + 248 + 249 f = BytesIO('<doc>Test</doc>') + 250 doc = ElementTree(file=f) + 251 root = doc.getroot() + 252 self.assertEqual(0, len(root)) +
253 +
255 Element = self.etree.Element + 256 SubElement = self.etree.SubElement + 257 a = Element('a') + 258 b = SubElement(a, 'b') + 259 c = SubElement(a, 'c') + 260 d = SubElement(a, 'd') + 261 self.assertEqual(d, a[-1]) + 262 self.assertEqual(c, a[-2]) + 263 self.assertEqual(b, a[-3]) + 264 self.assertRaises(IndexError, operator.getitem, a, -4) + 265 a[-1] = e = Element('e') + 266 self.assertEqual(e, a[-1]) + 267 del a[-1] + 268 self.assertEqual(2, len(a)) +
269 +
270 - def test_elementtree(self): +
271 ElementTree = self.etree.ElementTree + 272 + 273 f = BytesIO('<doc><one>One</one><two>Two</two></doc>') + 274 doc = ElementTree(file=f) + 275 root = doc.getroot() + 276 self.assertEqual(2, len(root)) + 277 self.assertEqual('one', root[0].tag) + 278 self.assertEqual('two', root[1].tag) +
279 +
280 - def test_text(self): +
281 ElementTree = self.etree.ElementTree + 282 + 283 f = BytesIO('<doc>This is a text</doc>') + 284 doc = ElementTree(file=f) + 285 root = doc.getroot() + 286 self.assertEqual('This is a text', root.text) +
287 +
288 - def test_text_empty(self): +
289 ElementTree = self.etree.ElementTree + 290 + 291 f = BytesIO('<doc></doc>') + 292 doc = ElementTree(file=f) + 293 root = doc.getroot() + 294 self.assertEqual(None, root.text) +
295 +
296 - def test_text_other(self): +
297 ElementTree = self.etree.ElementTree + 298 + 299 f = BytesIO('<doc><one>One</one></doc>') + 300 doc = ElementTree(file=f) + 301 root = doc.getroot() + 302 self.assertEqual(None, root.text) + 303 self.assertEqual('One', root[0].text) +
304 +
305 - def test_text_escape_in(self): +
306 ElementTree = self.etree.ElementTree + 307 + 308 f = BytesIO('<doc>This is &gt; than a text</doc>') + 309 doc = ElementTree(file=f) + 310 root = doc.getroot() + 311 self.assertEqual('This is > than a text', root.text) +
312 +
313 - def test_text_escape_out(self): +
314 Element = self.etree.Element + 315 + 316 a = Element("a") + 317 a.text = "<>&" + 318 self.assertXML(_bytes('<a>&lt;&gt;&amp;</a>'), + 319 a) +
320 +
321 - def test_text_escape_tostring(self): +
322 tostring = self.etree.tostring + 323 Element = self.etree.Element + 324 + 325 a = Element("a") + 326 a.text = "<>&" + 327 self.assertEqual(_bytes('<a>&lt;&gt;&amp;</a>'), + 328 tostring(a)) +
329 +
330 - def test_text_str_subclass(self): +
331 Element = self.etree.Element + 332 + 333 class strTest(str): + 334 pass +
335 + 336 a = Element("a") + 337 a.text = strTest("text") + 338 self.assertXML(_bytes('<a>text</a>'), + 339 a) + 340 +
341 - def test_tail(self): +
342 ElementTree = self.etree.ElementTree + 343 + 344 f = BytesIO('<doc>This is <i>mixed</i> content.</doc>') + 345 doc = ElementTree(file=f) + 346 root = doc.getroot() + 347 self.assertEqual(1, len(root)) + 348 self.assertEqual('This is ', root.text) + 349 self.assertEqual(None, root.tail) + 350 self.assertEqual('mixed', root[0].text) + 351 self.assertEqual(' content.', root[0].tail) +
352 +
353 - def test_tail_str_subclass(self): +
354 Element = self.etree.Element + 355 SubElement = self.etree.SubElement + 356 + 357 class strTest(str): + 358 pass +
359 + 360 a = Element("a") + 361 SubElement(a, "t").tail = strTest("tail") + 362 self.assertXML(_bytes('<a><t></t>tail</a>'), + 363 a) + 364 +
365 - def _test_del_tail(self): +
366 # this is discouraged for ET compat, should not be tested... + 367 XML = self.etree.XML + 368 + 369 root = XML(_bytes('<doc>This is <i>mixed</i> content.</doc>')) + 370 self.assertEqual(1, len(root)) + 371 self.assertEqual('This is ', root.text) + 372 self.assertEqual(None, root.tail) + 373 self.assertEqual('mixed', root[0].text) + 374 self.assertEqual(' content.', root[0].tail) + 375 + 376 del root[0].tail + 377 + 378 self.assertEqual(1, len(root)) + 379 self.assertEqual('This is ', root.text) + 380 self.assertEqual(None, root.tail) + 381 self.assertEqual('mixed', root[0].text) + 382 self.assertEqual(None, root[0].tail) + 383 + 384 root[0].tail = "TAIL" + 385 + 386 self.assertEqual(1, len(root)) + 387 self.assertEqual('This is ', root.text) + 388 self.assertEqual(None, root.tail) + 389 self.assertEqual('mixed', root[0].text) + 390 self.assertEqual('TAIL', root[0].tail) +
391 +
392 - def test_ElementTree(self): +
393 Element = self.etree.Element + 394 ElementTree = self.etree.ElementTree + 395 + 396 el = Element('hoi') + 397 doc = ElementTree(el) + 398 root = doc.getroot() + 399 self.assertEqual(None, root.text) + 400 self.assertEqual('hoi', root.tag) +
401 +
402 - def test_attrib(self): +
403 ElementTree = self.etree.ElementTree + 404 + 405 f = BytesIO('<doc one="One" two="Two"/>') + 406 doc = ElementTree(file=f) + 407 root = doc.getroot() + 408 self.assertEqual('One', root.attrib['one']) + 409 self.assertEqual('Two', root.attrib['two']) + 410 self.assertRaises(KeyError, operator.getitem, root.attrib, 'three') +
411 +
412 - def test_attrib_get(self): +
413 ElementTree = self.etree.ElementTree + 414 + 415 f = BytesIO('<doc one="One" two="Two"/>') + 416 doc = ElementTree(file=f) + 417 root = doc.getroot() + 418 self.assertEqual('One', root.attrib.get('one')) + 419 self.assertEqual('Two', root.attrib.get('two')) + 420 self.assertEqual(None, root.attrib.get('three')) + 421 self.assertEqual('foo', root.attrib.get('three', 'foo')) +
422 +
423 - def test_attrib_dict(self): +
424 ElementTree = self.etree.ElementTree + 425 + 426 f = BytesIO('<doc one="One" two="Two"/>') + 427 doc = ElementTree(file=f) + 428 root = doc.getroot() + 429 attrib = dict(root.attrib) + 430 self.assertEqual('One', attrib['one']) + 431 self.assertEqual('Two', attrib['two']) + 432 self.assertRaises(KeyError, operator.getitem, attrib, 'three') +
433 +
434 - def test_attrib_copy(self): +
435 ElementTree = self.etree.ElementTree + 436 + 437 f = BytesIO('<doc one="One" two="Two"/>') + 438 doc = ElementTree(file=f) + 439 root = doc.getroot() + 440 attrib = copy.copy(root.attrib) + 441 self.assertEqual('One', attrib['one']) + 442 self.assertEqual('Two', attrib['two']) + 443 self.assertRaises(KeyError, operator.getitem, attrib, 'three') +
444 +
445 - def test_attrib_deepcopy(self): +
446 ElementTree = self.etree.ElementTree + 447 + 448 f = BytesIO('<doc one="One" two="Two"/>') + 449 doc = ElementTree(file=f) + 450 root = doc.getroot() + 451 attrib = copy.deepcopy(root.attrib) + 452 self.assertEqual('One', attrib['one']) + 453 self.assertEqual('Two', attrib['two']) + 454 self.assertRaises(KeyError, operator.getitem, attrib, 'three') +
455 +
456 - def test_attributes_get(self): +
457 ElementTree = self.etree.ElementTree + 458 + 459 f = BytesIO('<doc one="One" two="Two"/>') + 460 doc = ElementTree(file=f) + 461 root = doc.getroot() + 462 self.assertEqual('One', root.get('one')) + 463 self.assertEqual('Two', root.get('two')) + 464 self.assertEqual(None, root.get('three')) + 465 self.assertEqual('foo', root.get('three', 'foo')) +
466 +
467 - def test_attrib_clear(self): +
468 XML = self.etree.XML + 469 + 470 root = XML(_bytes('<doc one="One" two="Two"/>')) + 471 self.assertEqual('One', root.get('one')) + 472 self.assertEqual('Two', root.get('two')) + 473 root.attrib.clear() + 474 self.assertEqual(None, root.get('one')) + 475 self.assertEqual(None, root.get('two')) +
476 +
477 - def test_attrib_set_clear(self): +
478 Element = self.etree.Element + 479 + 480 root = Element("root", one="One") + 481 root.set("two", "Two") + 482 self.assertEqual('One', root.get('one')) + 483 self.assertEqual('Two', root.get('two')) + 484 root.attrib.clear() + 485 self.assertEqual(None, root.get('one')) + 486 self.assertEqual(None, root.get('two')) +
487 +
488 - def test_attrib_ns_clear(self): +
489 Element = self.etree.Element + 490 SubElement = self.etree.SubElement + 491 + 492 attribNS = '{http://foo/bar}x' + 493 + 494 parent = Element('parent') + 495 parent.set(attribNS, 'a') + 496 child = SubElement(parent, 'child') + 497 child.set(attribNS, 'b') + 498 + 499 self.assertEqual('a', parent.get(attribNS)) + 500 self.assertEqual('b', child.get(attribNS)) + 501 + 502 parent.clear() + 503 self.assertEqual(None, parent.get(attribNS)) + 504 self.assertEqual('b', child.get(attribNS)) +
505 +
506 - def test_attrib_pop(self): +
507 ElementTree = self.etree.ElementTree + 508 + 509 f = BytesIO('<doc one="One" two="Two"/>') + 510 doc = ElementTree(file=f) + 511 root = doc.getroot() + 512 self.assertEqual('One', root.attrib['one']) + 513 self.assertEqual('Two', root.attrib['two']) + 514 + 515 self.assertEqual('One', root.attrib.pop('one')) + 516 + 517 self.assertEqual(None, root.attrib.get('one')) + 518 self.assertEqual('Two', root.attrib['two']) +
519 +
520 - def test_attrib_pop_unknown(self): +
521 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 522 self.assertRaises(KeyError, root.attrib.pop, 'NONE') + 523 + 524 self.assertEqual('One', root.attrib['one']) + 525 self.assertEqual('Two', root.attrib['two']) +
526 +
527 - def test_attrib_pop_default(self): +
528 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 529 self.assertEqual('Three', root.attrib.pop('three', 'Three')) +
530 +
532 root = self.etree.XML(_bytes('<doc/>')) + 533 self.assertEqual('Three', root.attrib.pop('three', 'Three')) +
534 +
536 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 537 self.assertRaises(TypeError, root.attrib.pop, 'One', None, None) +
538 +
539 - def test_attribute_update_dict(self): +
540 XML = self.etree.XML + 541 + 542 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 543 items = list(root.attrib.items()) + 544 items.sort() + 545 self.assertEqual( + 546 [('alpha', 'Alpha'), ('beta', 'Beta')], + 547 items) + 548 + 549 root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}) + 550 + 551 items = list(root.attrib.items()) + 552 items.sort() + 553 self.assertEqual( + 554 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 555 items) +
556 +
558 XML = self.etree.XML + 559 + 560 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 561 items = list(root.attrib.items()) + 562 items.sort() + 563 self.assertEqual( + 564 [('alpha', 'Alpha'), ('beta', 'Beta')], + 565 items) + 566 + 567 root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}.items()) + 568 + 569 items = list(root.attrib.items()) + 570 items.sort() + 571 self.assertEqual( + 572 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 573 items) +
574 +
575 - def test_attribute_update_iter(self): +
576 XML = self.etree.XML + 577 + 578 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 579 items = list(root.attrib.items()) + 580 items.sort() + 581 self.assertEqual( + 582 [('alpha', 'Alpha'), ('beta', 'Beta')], + 583 items) + 584 + 585 root.attrib.update(iter({'alpha' : 'test', 'gamma' : 'Gamma'}.items())) + 586 + 587 items = list(root.attrib.items()) + 588 items.sort() + 589 self.assertEqual( + 590 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 591 items) +
592 +
594 XML = self.etree.XML + 595 + 596 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 597 items = list(root.attrib.items()) + 598 items.sort() + 599 self.assertEqual( + 600 [('alpha', 'Alpha'), ('beta', 'Beta')], + 601 items) + 602 + 603 other = XML(_bytes('<doc alpha="test" gamma="Gamma"/>')) + 604 root.attrib.update(other.attrib) + 605 + 606 items = list(root.attrib.items()) + 607 items.sort() + 608 self.assertEqual( + 609 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 610 items) +
611 +
612 - def test_attribute_keys(self): +
613 XML = self.etree.XML + 614 + 615 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 616 keys = list(root.attrib.keys()) + 617 keys.sort() + 618 self.assertEqual(['alpha', 'beta', 'gamma'], keys) +
619 +
620 - def test_attribute_keys2(self): +
621 XML = self.etree.XML + 622 + 623 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 624 keys = list(root.keys()) + 625 keys.sort() + 626 self.assertEqual(['alpha', 'beta', 'gamma'], keys) +
627 +
628 - def test_attribute_items2(self): +
629 XML = self.etree.XML + 630 + 631 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 632 items = list(root.items()) + 633 items.sort() + 634 self.assertEqual( + 635 [('alpha','Alpha'), ('beta','Beta'), ('gamma','Gamma')], + 636 items) +
637 +
638 - def test_attribute_keys_ns(self): +
639 XML = self.etree.XML + 640 + 641 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 642 keys = list(root.keys()) + 643 keys.sort() + 644 self.assertEqual(['bar', '{http://ns.codespeak.net/test}baz'], + 645 keys) +
646 +
647 - def test_attribute_values(self): +
648 XML = self.etree.XML + 649 + 650 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 651 values = list(root.attrib.values()) + 652 values.sort() + 653 self.assertEqual(['Alpha', 'Beta', 'Gamma'], values) +
654 +
655 - def test_attribute_values_ns(self): +
656 XML = self.etree.XML + 657 + 658 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 659 values = list(root.attrib.values()) + 660 values.sort() + 661 self.assertEqual( + 662 ['Bar', 'Baz'], values) +
663 +
664 - def test_attribute_items(self): +
665 XML = self.etree.XML + 666 + 667 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 668 items = list(root.attrib.items()) + 669 items.sort() + 670 self.assertEqual([ + 671 ('alpha', 'Alpha'), + 672 ('beta', 'Beta'), + 673 ('gamma', 'Gamma'), + 674 ], + 675 items) +
676 +
677 - def test_attribute_items_ns(self): +
678 XML = self.etree.XML + 679 + 680 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 681 items = list(root.attrib.items()) + 682 items.sort() + 683 self.assertEqual( + 684 [('bar', 'Bar'), ('{http://ns.codespeak.net/test}baz', 'Baz')], + 685 items) +
686 +
687 - def test_attribute_str(self): +
688 XML = self.etree.XML + 689 + 690 expected = "{'{http://ns.codespeak.net/test}baz': 'Baz', 'bar': 'Bar'}" + 691 alternative = "{'bar': 'Bar', '{http://ns.codespeak.net/test}baz': 'Baz'}" + 692 + 693 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 694 try: + 695 self.assertEqual(expected, str(root.attrib)) + 696 except AssertionError: + 697 self.assertEqual(alternative, str(root.attrib)) +
698 +
699 - def test_attribute_contains(self): +
700 XML = self.etree.XML + 701 + 702 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 703 self.assertEqual( + 704 True, 'bar' in root.attrib) + 705 self.assertEqual( + 706 False, 'baz' in root.attrib) + 707 self.assertEqual( + 708 False, 'hah' in root.attrib) + 709 self.assertEqual( + 710 True, + 711 '{http://ns.codespeak.net/test}baz' in root.attrib) +
712 +
713 - def test_attribute_set(self): +
714 Element = self.etree.Element + 715 + 716 root = Element("root") + 717 root.set("attr", "TEST") + 718 self.assertEqual("TEST", root.get("attr")) +
719 +
720 - def test_attrib_as_attrib(self): +
721 Element = self.etree.Element + 722 + 723 root = Element("root") + 724 root.set("attr", "TEST") + 725 self.assertEqual("TEST", root.attrib["attr"]) + 726 + 727 root2 = Element("root2", root.attrib) + 728 self.assertEqual("TEST", root2.attrib["attr"]) +
729 +
730 - def test_attribute_iterator(self): +
731 XML = self.etree.XML + 732 + 733 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma" />')) + 734 result = [] + 735 for key in root.attrib: + 736 result.append(key) + 737 result.sort() + 738 self.assertEqual(['alpha', 'beta', 'gamma'], result) +
739 +
740 - def test_attribute_manipulation(self): +
741 Element = self.etree.Element + 742 + 743 a = Element('a') + 744 a.attrib['foo'] = 'Foo' + 745 a.attrib['bar'] = 'Bar' + 746 self.assertEqual('Foo', a.attrib['foo']) + 747 del a.attrib['foo'] + 748 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
749 +
750 - def test_del_attribute_ns(self): +
751 Element = self.etree.Element + 752 + 753 a = Element('a') + 754 a.attrib['{http://a/}foo'] = 'Foo' + 755 a.attrib['{http://a/}bar'] = 'Bar' + 756 self.assertEqual(None, a.get('foo')) + 757 self.assertEqual('Foo', a.get('{http://a/}foo')) + 758 self.assertEqual('Foo', a.attrib['{http://a/}foo']) + 759 + 760 self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + 761 self.assertEqual('Foo', a.attrib['{http://a/}foo']) + 762 + 763 del a.attrib['{http://a/}foo'] + 764 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
765 +
767 XML = self.etree.XML + 768 + 769 a = XML(_bytes('<a xmlns:nsa="http://a/" nsa:foo="FooNS" foo="Foo" />')) + 770 + 771 self.assertEqual('Foo', a.attrib['foo']) + 772 self.assertEqual('FooNS', a.attrib['{http://a/}foo']) + 773 + 774 del a.attrib['foo'] + 775 self.assertEqual('FooNS', a.attrib['{http://a/}foo']) + 776 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 777 self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + 778 + 779 del a.attrib['{http://a/}foo'] + 780 self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + 781 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 782 + 783 a = XML(_bytes('<a xmlns:nsa="http://a/" foo="Foo" nsa:foo="FooNS" />')) + 784 + 785 self.assertEqual('Foo', a.attrib['foo']) + 786 self.assertEqual('FooNS', a.attrib['{http://a/}foo']) + 787 + 788 del a.attrib['foo'] + 789 self.assertEqual('FooNS', a.attrib['{http://a/}foo']) + 790 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 791 + 792 del a.attrib['{http://a/}foo'] + 793 self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + 794 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
795 +
796 - def test_XML(self): +
797 XML = self.etree.XML + 798 + 799 root = XML(_bytes('<doc>This is a text.</doc>')) + 800 self.assertEqual(0, len(root)) + 801 self.assertEqual('This is a text.', root.text) +
802 +
803 - def test_XMLID(self): +
804 XMLID = self.etree.XMLID + 805 XML = self.etree.XML + 806 xml_text = _bytes(''' + 807 <document> + 808 <h1 id="chapter1">...</h1> + 809 <p id="note1" class="note">...</p> + 810 <p>Regular paragraph.</p> + 811 <p xml:id="xmlid">XML:ID paragraph.</p> + 812 <p id="warn1" class="warning">...</p> + 813 </document> + 814 ''') + 815 + 816 root, dic = XMLID(xml_text) + 817 root2 = XML(xml_text) + 818 self.assertEqual(self._writeElement(root), + 819 self._writeElement(root2)) + 820 expected = { + 821 "chapter1" : root[0], + 822 "note1" : root[1], + 823 "warn1" : root[4] + 824 } + 825 self.assertEqual(dic, expected) +
826 +
827 - def test_fromstring(self): +
828 fromstring = self.etree.fromstring + 829 + 830 root = fromstring('<doc>This is a text.</doc>') + 831 self.assertEqual(0, len(root)) + 832 self.assertEqual('This is a text.', root.text) +
833 + 834 required_versions_ET['test_fromstringlist'] = (1,3) +
835 - def test_fromstringlist(self): +
836 fromstringlist = self.etree.fromstringlist + 837 + 838 root = fromstringlist(["<do", "c>T", "hi", "s is", + 839 " a text.<", "/doc", ">"]) + 840 self.assertEqual(0, len(root)) + 841 self.assertEqual('This is a text.', root.text) +
842 + 843 required_versions_ET['test_fromstringlist_characters'] = (1,3) +
845 fromstringlist = self.etree.fromstringlist + 846 + 847 root = fromstringlist(list('<doc>This is a text.</doc>')) + 848 self.assertEqual(0, len(root)) + 849 self.assertEqual('This is a text.', root.text) +
850 + 851 required_versions_ET['test_fromstringlist_single'] = (1,3) +
852 - def test_fromstringlist_single(self): +
853 fromstringlist = self.etree.fromstringlist + 854 + 855 root = fromstringlist(['<doc>This is a text.</doc>']) + 856 self.assertEqual(0, len(root)) + 857 self.assertEqual('This is a text.', root.text) +
858 +
859 - def test_iselement(self): +
860 iselement = self.etree.iselement + 861 Element = self.etree.Element + 862 ElementTree = self.etree.ElementTree + 863 XML = self.etree.XML + 864 Comment = self.etree.Comment + 865 ProcessingInstruction = self.etree.ProcessingInstruction + 866 + 867 el = Element('hoi') + 868 self.assertTrue(iselement(el)) + 869 + 870 el2 = XML(_bytes('<foo/>')) + 871 self.assertTrue(iselement(el2)) + 872 + 873 tree = ElementTree(element=Element('dag')) + 874 self.assertTrue(not iselement(tree)) + 875 self.assertTrue(iselement(tree.getroot())) + 876 + 877 c = Comment('test') + 878 self.assertTrue(iselement(c)) + 879 + 880 p = ProcessingInstruction("test", "some text") + 881 self.assertTrue(iselement(p)) +
882 +
883 - def test_iteration(self): +
884 XML = self.etree.XML + 885 + 886 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 887 result = [] + 888 for el in root: + 889 result.append(el.tag) + 890 self.assertEqual(['one', 'two', 'three'], result) +
891 +
892 - def test_iteration_empty(self): +
893 XML = self.etree.XML + 894 + 895 root = XML(_bytes('<doc></doc>')) + 896 result = [] + 897 for el in root: + 898 result.append(el.tag) + 899 self.assertEqual([], result) +
900 +
901 - def test_iteration_text_only(self): +
902 XML = self.etree.XML + 903 + 904 root = XML(_bytes('<doc>Text</doc>')) + 905 result = [] + 906 for el in root: + 907 result.append(el.tag) + 908 self.assertEqual([], result) +
909 +
911 # this would cause a crash in the past + 912 fromstring = self.etree.fromstring + 913 root = fromstring('<html><p></p>x</html>') + 914 for elem in root: + 915 elem.tail = '' +
916 +
917 - def test_iteration_clear_tail(self): +
918 # this would cause a crash in the past + 919 fromstring = self.etree.fromstring + 920 root = fromstring('<html><p></p>x</html>') + 921 for elem in root: + 922 elem.tail = None +
923 +
924 - def test_iteration_reversed(self): +
925 XML = self.etree.XML + 926 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 927 result = [] + 928 for el in reversed(root): + 929 result.append(el.tag) + 930 self.assertEqual(['three', 'two', 'one'], result) +
931 +
932 - def test_iteration_subelement(self): +
933 XML = self.etree.XML + 934 + 935 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 936 result = [] + 937 add = True + 938 for el in root: + 939 result.append(el.tag) + 940 if add: + 941 self.etree.SubElement(root, 'four') + 942 add = False + 943 self.assertEqual(['one', 'two', 'three', 'four'], result) +
944 +
945 - def test_iteration_del_child(self): +
946 XML = self.etree.XML + 947 + 948 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 949 result = [] + 950 for el in root: + 951 result.append(el.tag) + 952 del root[-1] + 953 self.assertEqual(['one', 'two'], result) +
954 +
955 - def test_iteration_double(self): +
956 XML = self.etree.XML + 957 + 958 root = XML(_bytes('<doc><one/><two/></doc>')) + 959 result = [] + 960 for el0 in root: + 961 result.append(el0.tag) + 962 for el1 in root: + 963 result.append(el1.tag) + 964 self.assertEqual(['one','one', 'two', 'two', 'one', 'two'], result) +
965 + 966 required_versions_ET['test_itertext'] = (1,3) +
967 - def test_itertext(self): +
968 # ET 1.3+ + 969 XML = self.etree.XML + 970 root = XML(_bytes("<root>RTEXT<a></a>ATAIL<b/><c>CTEXT</c>CTAIL</root>")) + 971 + 972 text = list(root.itertext()) + 973 self.assertEqual(["RTEXT", "ATAIL", "CTEXT", "CTAIL"], + 974 text) +
975 + 976 required_versions_ET['test_itertext_child'] = (1,3) +
977 - def test_itertext_child(self): +
978 # ET 1.3+ + 979 XML = self.etree.XML + 980 root = XML(_bytes("<root>RTEXT<a></a>ATAIL<b/><c>CTEXT</c>CTAIL</root>")) + 981 + 982 text = list(root[2].itertext()) + 983 self.assertEqual(["CTEXT"], + 984 text) +
985 +
986 - def test_findall(self): +
987 XML = self.etree.XML + 988 root = XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>')) + 989 self.assertEqual(len(list(root.findall("c"))), 1) + 990 self.assertEqual(len(list(root.findall(".//c"))), 2) + 991 self.assertEqual(len(list(root.findall(".//b"))), 3) + 992 self.assertEqual(len(list(root.findall(".//b"))[0]), 1) + 993 self.assertEqual(len(list(root.findall(".//b"))[1]), 0) + 994 self.assertEqual(len(list(root.findall(".//b"))[2]), 0) +
995 +
996 - def test_findall_ns(self): +
997 XML = self.etree.XML + 998 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>')) + 999 self.assertEqual(len(list(root.findall(".//{X}b"))), 2) +1000 self.assertEqual(len(list(root.findall(".//b"))), 3) +1001 self.assertEqual(len(list(root.findall("b"))), 2) +
1002 +1003 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
1004 - def test_findall_wildcard(self): +
1005 def summarize_list(l): +1006 return [el.tag for el in l] +
1007 +1008 root = self.etree.XML(''' +1009 <a xmlns:x="X" xmlns:y="Y"> +1010 <x:b><c/></x:b> +1011 <b/> +1012 <c><x:b/><b/></c><y:b/> +1013 </a>''') +1014 root.append(self.etree.Comment('test')) +1015 +1016 self.assertEqual(summarize_list(root.findall("{*}b")), +1017 ['{X}b', 'b', '{Y}b']) +1018 self.assertEqual(summarize_list(root.findall("{*}c")), +1019 ['c']) +1020 self.assertEqual(summarize_list(root.findall("{X}*")), +1021 ['{X}b']) +1022 self.assertEqual(summarize_list(root.findall("{Y}*")), +1023 ['{Y}b']) +1024 self.assertEqual(summarize_list(root.findall("{}*")), +1025 ['b', 'c']) +1026 self.assertEqual(summarize_list(root.findall("{}b")), # only for consistency +1027 ['b']) +1028 self.assertEqual(summarize_list(root.findall("{}b")), +1029 summarize_list(root.findall("b"))) +1030 self.assertEqual(summarize_list(root.findall("{*}*")), +1031 ['{X}b', 'b', 'c', '{Y}b']) +1032 self.assertEqual(summarize_list(root.findall("{*}*") +1033 + ([] if self.etree is etree else [root[-1]])), +1034 summarize_list(root.findall("*"))) +1035 +1036 self.assertEqual(summarize_list(root.findall(".//{*}b")), +1037 ['{X}b', 'b', '{X}b', 'b', '{Y}b']) +1038 self.assertEqual(summarize_list(root.findall(".//{*}c")), +1039 ['c', 'c']) +1040 self.assertEqual(summarize_list(root.findall(".//{X}*")), +1041 ['{X}b', '{X}b']) +1042 self.assertEqual(summarize_list(root.findall(".//{Y}*")), +1043 ['{Y}b']) +1044 self.assertEqual(summarize_list(root.findall(".//{}*")), +1045 ['c', 'b', 'c', 'b']) +1046 self.assertEqual(summarize_list(root.findall(".//{}b")), +1047 ['b', 'b']) +1048 +
1050 Element = self.etree.Element +1051 +1052 el = Element('tag', foo='Foo', bar='Bar') +1053 self.assertEqual('Foo', el.attrib['foo']) +1054 self.assertEqual('Bar', el.attrib['bar']) +
1055 +
1057 Element = self.etree.Element +1058 +1059 el = Element('tag', {'foo': 'Foo', 'bar': 'Bar'}) +1060 self.assertEqual('Foo', el.attrib['foo']) +1061 self.assertEqual('Bar', el.attrib['bar']) +
1062 +
1064 Element = self.etree.Element +1065 +1066 el = Element('tag', {'foo': 'Foo', 'bar': 'Bar'}, baz='Baz') +1067 self.assertEqual('Foo', el.attrib['foo']) +1068 self.assertEqual('Bar', el.attrib['bar']) +1069 self.assertEqual('Baz', el.attrib['baz']) +
1070 +
1072 Element = self.etree.Element +1073 +1074 el = Element('tag', {'foo': 'Foo', 'bar': 'Bar'}, bar='Baz') +1075 self.assertEqual('Foo', el.attrib['foo']) +1076 self.assertEqual('Baz', el.attrib['bar']) +
1077 +
1079 Element = self.etree.Element +1080 +1081 el = Element('tag', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) +1082 self.assertEqual('Foo', el.attrib['{ns1}foo']) +1083 self.assertEqual('Bar', el.attrib['{ns2}bar']) +
1084 +
1086 Element = self.etree.Element +1087 SubElement = self.etree.SubElement +1088 +1089 el = Element('tag') +1090 SubElement(el, 'foo', {'foo':'Foo'}, baz="Baz") +1091 self.assertEqual("Baz", el[0].attrib['baz']) +1092 self.assertEqual('Foo', el[0].attrib['foo']) +
1093 +
1095 Element = self.etree.Element +1096 SubElement = self.etree.SubElement +1097 +1098 el = Element('tag') +1099 SubElement(el, 'foo', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) +1100 self.assertEqual('Foo', el[0].attrib['{ns1}foo']) +1101 self.assertEqual('Bar', el[0].attrib['{ns2}bar']) +
1102 +
1103 - def test_write(self): +
1104 ElementTree = self.etree.ElementTree +1105 XML = self.etree.XML +1106 +1107 for i in range(10): +1108 f = BytesIO() +1109 root = XML(_bytes('<doc%s>This is a test.</doc%s>' % (i, i))) +1110 tree = ElementTree(element=root) +1111 tree.write(f) +1112 data = f.getvalue() +1113 self.assertEqual( +1114 _bytes('<doc%s>This is a test.</doc%s>' % (i, i)), +1115 canonicalize(data)) +
1116 +1117 required_versions_ET['test_write_method_html'] = (1,3) +
1118 - def test_write_method_html(self): +
1119 ElementTree = self.etree.ElementTree +1120 Element = self.etree.Element +1121 SubElement = self.etree.SubElement +1122 +1123 html = Element('html') +1124 body = SubElement(html, 'body') +1125 p = SubElement(body, 'p') +1126 p.text = "html" +1127 SubElement(p, 'br').tail = "test" +1128 +1129 tree = ElementTree(element=html) +1130 f = BytesIO() +1131 tree.write(f, method="html") +1132 data = f.getvalue().replace(_bytes('\n'),_bytes('')) +1133 +1134 self.assertEqual(_bytes('<html><body><p>html<br>test</p></body></html>'), +1135 data) +
1136 +1137 required_versions_ET['test_write_method_text'] = (1,3) +
1138 - def test_write_method_text(self): +
1139 ElementTree = self.etree.ElementTree +1140 Element = self.etree.Element +1141 SubElement = self.etree.SubElement +1142 +1143 a = Element('a') +1144 a.text = "A" +1145 a.tail = "tail" +1146 b = SubElement(a, 'b') +1147 b.text = "B" +1148 b.tail = "TAIL" +1149 c = SubElement(a, 'c') +1150 c.text = "C" +1151 +1152 tree = ElementTree(element=a) +1153 f = BytesIO() +1154 tree.write(f, method="text") +1155 data = f.getvalue() +1156 +1157 self.assertEqual(_bytes('ABTAILCtail'), +1158 data) +
1159 +
1160 - def test_write_fail(self): +
1161 ElementTree = self.etree.ElementTree +1162 XML = self.etree.XML +1163 +1164 tree = ElementTree( XML(_bytes('<doc>This is a test.</doc>')) ) +1165 self.assertRaises(IOError, tree.write, +1166 "definitely////\\-\\nonexisting\\-\\////FILE") +
1167 +1168 # this could trigger a crash, apparently because the document +1169 # reference was prematurely garbage collected +
1170 - def test_crash(self): +
1171 Element = self.etree.Element +1172 +1173 element = Element('tag') +1174 for i in range(10): +1175 element.attrib['key'] = 'value' +1176 value = element.attrib['key'] +1177 self.assertEqual(value, 'value') +
1178 +1179 # from doctest; for some reason this caused crashes too +
1181 Element = self.etree.Element +1182 ElementTree = self.etree.ElementTree +1183 +1184 f = BytesIO() +1185 for i in range(10): +1186 element = Element('tag%s' % i) +1187 self._check_element(element) +1188 tree = ElementTree(element) +1189 tree.write(f) +1190 self._check_element_tree(tree) +
1191 +
1192 - def test_subelement_reference(self): +
1193 Element = self.etree.Element +1194 SubElement = self.etree.SubElement +1195 +1196 el = Element('foo') +1197 el2 = SubElement(el, 'bar') +1198 el3 = SubElement(el2, 'baz') +1199 +1200 al = Element('foo2') +1201 al2 = SubElement(al, 'bar2') +1202 al3 = SubElement(al2, 'baz2') +1203 +1204 # now move al2 into el +1205 el.append(al2) +1206 +1207 # now change al3 directly +1208 al3.text = 'baz2-modified' +1209 +1210 # it should have changed through this route too +1211 self.assertEqual( +1212 'baz2-modified', +1213 el[1][0].text) +
1214 +
1215 - def test_set_text(self): +
1216 Element = self.etree.Element +1217 SubElement = self.etree.SubElement +1218 +1219 a = Element('a') +1220 b = SubElement(a, 'b') +1221 a.text = 'hoi' +1222 self.assertEqual( +1223 'hoi', +1224 a.text) +1225 self.assertEqual( +1226 'b', +1227 a[0].tag) +
1228 +
1229 - def test_set_text2(self): +
1230 Element = self.etree.Element +1231 SubElement = self.etree.SubElement +1232 +1233 a = Element('a') +1234 a.text = 'hoi' +1235 b = SubElement(a ,'b') +1236 self.assertEqual( +1237 'hoi', +1238 a.text) +1239 self.assertEqual( +1240 'b', +1241 a[0].tag) +
1242 +
1243 - def test_set_text_none(self): +
1244 Element = self.etree.Element +1245 +1246 a = Element('a') +1247 +1248 a.text = 'foo' +1249 a.text = None +1250 +1251 self.assertEqual( +1252 None, +1253 a.text) +1254 self.assertXML(_bytes('<a></a>'), a) +
1255 +
1256 - def test_set_text_empty(self): +
1257 Element = self.etree.Element +1258 +1259 a = Element('a') +1260 self.assertEqual(None, a.text) +1261 +1262 a.text = '' +1263 self.assertEqual('', a.text) +1264 self.assertXML(_bytes('<a></a>'), a) +
1265 +
1266 - def test_tail1(self): +
1267 Element = self.etree.Element +1268 SubElement = self.etree.SubElement +1269 +1270 a = Element('a') +1271 a.tail = 'dag' +1272 self.assertEqual('dag', +1273 a.tail) +1274 b = SubElement(a, 'b') +1275 b.tail = 'hoi' +1276 self.assertEqual('hoi', +1277 b.tail) +1278 self.assertEqual('dag', +1279 a.tail) +
1280 +
1281 - def test_tail_append(self): +
1282 Element = self.etree.Element +1283 +1284 a = Element('a') +1285 b = Element('b') +1286 b.tail = 'b_tail' +1287 a.append(b) +1288 self.assertEqual('b_tail', +1289 b.tail) +
1290 +
1291 - def test_tail_set_twice(self): +
1292 Element = self.etree.Element +1293 SubElement = self.etree.SubElement +1294 +1295 a = Element('a') +1296 b = SubElement(a, 'b') +1297 b.tail = 'foo' +1298 b.tail = 'bar' +1299 self.assertEqual('bar', +1300 b.tail) +1301 self.assertXML(_bytes('<a><b></b>bar</a>'), a) +
1302 +
1303 - def test_tail_set_none(self): +
1304 Element = self.etree.Element +1305 a = Element('a') +1306 a.tail = 'foo' +1307 a.tail = None +1308 self.assertEqual( +1309 None, +1310 a.tail) +1311 self.assertXML(_bytes('<a></a>'), a) +
1312 +1313 required_versions_ET['test_extend'] = (1,3) +
1314 - def test_extend(self): +
1315 root = self.etree.Element('foo') +1316 for i in range(3): +1317 element = self.etree.SubElement(root, 'a%s' % i) +1318 element.text = "text%d" % i +1319 element.tail = "tail%d" % i +1320 +1321 elements = [] +1322 for i in range(3): +1323 new_element = self.etree.Element("test%s" % i) +1324 new_element.text = "TEXT%s" % i +1325 new_element.tail = "TAIL%s" % i +1326 elements.append(new_element) +1327 +1328 root.extend(elements) +1329 +1330 self.assertEqual( +1331 ["a0", "a1", "a2", "test0", "test1", "test2"], +1332 [ el.tag for el in root ]) +1333 self.assertEqual( +1334 ["text0", "text1", "text2", "TEXT0", "TEXT1", "TEXT2"], +1335 [ el.text for el in root ]) +1336 self.assertEqual( +1337 ["tail0", "tail1", "tail2", "TAIL0", "TAIL1", "TAIL2"], +1338 [ el.tail for el in root ]) +
1339 +
1340 - def test_comment(self): +
1341 Element = self.etree.Element +1342 SubElement = self.etree.SubElement +1343 Comment = self.etree.Comment +1344 +1345 a = Element('a') +1346 a.append(Comment('foo')) +1347 self.assertEqual(a[0].tag, Comment) +1348 self.assertEqual(a[0].text, 'foo') +
1349 +1350 # ElementTree < 1.3 adds whitespace around comments +1351 required_versions_ET['test_comment_text'] = (1,3) +
1352 - def test_comment_text(self): +
1353 Element = self.etree.Element +1354 SubElement = self.etree.SubElement +1355 Comment = self.etree.Comment +1356 tostring = self.etree.tostring +1357 +1358 a = Element('a') +1359 a.append(Comment('foo')) +1360 self.assertEqual(a[0].text, 'foo') +1361 +1362 self.assertEqual( +1363 _bytes('<a><!--foo--></a>'), +1364 tostring(a)) +1365 +1366 a[0].text = "TEST" +1367 self.assertEqual(a[0].text, 'TEST') +1368 +1369 self.assertEqual( +1370 _bytes('<a><!--TEST--></a>'), +1371 tostring(a)) +
1372 +1373 # ElementTree < 1.3 adds whitespace around comments +1374 required_versions_ET['test_comment_whitespace'] = (1,3) +
1375 - def test_comment_whitespace(self): +
1376 Element = self.etree.Element +1377 SubElement = self.etree.SubElement +1378 Comment = self.etree.Comment +1379 tostring = self.etree.tostring +1380 +1381 a = Element('a') +1382 a.append(Comment(' foo ')) +1383 self.assertEqual(a[0].text, ' foo ') +1384 self.assertEqual( +1385 _bytes('<a><!-- foo --></a>'), +1386 tostring(a)) +
1387 +
1388 - def test_comment_nonsense(self): +
1389 Comment = self.etree.Comment +1390 c = Comment('foo') +1391 self.assertEqual({}, c.attrib) +1392 self.assertEqual([], list(c.keys())) +1393 self.assertEqual([], list(c.items())) +1394 self.assertEqual(None, c.get('hoi')) +1395 self.assertEqual(0, len(c)) +1396 # should not iterate +1397 for i in c: +1398 pass +
1399 +
1400 - def test_pi(self): +
1401 # lxml.etree separates target and text +1402 Element = self.etree.Element +1403 SubElement = self.etree.SubElement +1404 ProcessingInstruction = self.etree.ProcessingInstruction +1405 +1406 a = Element('a') +1407 a.append(ProcessingInstruction('foo', 'some more text')) +1408 self.assertEqual(a[0].tag, ProcessingInstruction) +1409 self.assertXML(_bytes("<a><?foo some more text?></a>"), +1410 a) +
1411 +
1412 - def test_processinginstruction(self): +
1413 # lxml.etree separates target and text +1414 Element = self.etree.Element +1415 SubElement = self.etree.SubElement +1416 ProcessingInstruction = self.etree.PI +1417 +1418 a = Element('a') +1419 a.append(ProcessingInstruction('foo', 'some more text')) +1420 self.assertEqual(a[0].tag, ProcessingInstruction) +1421 self.assertXML(_bytes("<a><?foo some more text?></a>"), +1422 a) +
1423 +
1424 - def test_pi_nonsense(self): +
1425 ProcessingInstruction = self.etree.ProcessingInstruction +1426 pi = ProcessingInstruction('foo') +1427 self.assertEqual({}, pi.attrib) +1428 self.assertEqual([], list(pi.keys())) +1429 self.assertEqual([], list(pi.items())) +1430 self.assertEqual(None, pi.get('hoi')) +1431 self.assertEqual(0, len(pi)) +1432 # should not iterate +1433 for i in pi: +1434 pass +
1435 +
1436 - def test_setitem(self): +
1437 Element = self.etree.Element +1438 SubElement = self.etree.SubElement +1439 +1440 a = Element('a') +1441 b = SubElement(a, 'b') +1442 c = Element('c') +1443 a[0] = c +1444 self.assertEqual( +1445 c, +1446 a[0]) +1447 self.assertXML(_bytes('<a><c></c></a>'), +1448 a) +1449 self.assertXML(_bytes('<b></b>'), +1450 b) +
1451 +
1452 - def test_setitem2(self): +
1453 Element = self.etree.Element +1454 SubElement = self.etree.SubElement +1455 +1456 a = Element('a') +1457 for i in range(5): +1458 b = SubElement(a, 'b%s' % i) +1459 c = SubElement(b, 'c') +1460 for i in range(5): +1461 d = Element('d') +1462 e = SubElement(d, 'e') +1463 a[i] = d +1464 self.assertXML( +1465 _bytes('<a><d><e></e></d><d><e></e></d><d><e></e></d><d><e></e></d><d><e></e></d></a>'), +1466 a) +1467 self.assertXML(_bytes('<c></c>'), +1468 c) +
1469 +
1470 - def test_setitem_replace(self): +
1471 Element = self.etree.Element +1472 SubElement = self.etree.SubElement +1473 +1474 a = Element('a') +1475 SubElement(a, 'b') +1476 d = Element('d') +1477 a[0] = d +1478 self.assertXML(_bytes('<a><d></d></a>'), a) +
1479 +
1480 - def test_setitem_indexerror(self): +
1481 Element = self.etree.Element +1482 SubElement = self.etree.SubElement +1483 +1484 a = Element('a') +1485 b = SubElement(a, 'b') +1486 +1487 self.assertRaises(IndexError, operator.setitem, a, 1, Element('c')) +
1488 +
1489 - def test_setitem_tail(self): +
1490 Element = self.etree.Element +1491 SubElement = self.etree.SubElement +1492 +1493 a = Element('a') +1494 b = SubElement(a, 'b') +1495 b.tail = 'B2' +1496 c = Element('c') +1497 c.tail = 'C2' +1498 +1499 a[0] = c +1500 self.assertXML( +1501 _bytes('<a><c></c>C2</a>'), +1502 a) +
1503 +
1504 - def test_tag_write(self): +
1505 Element = self.etree.Element +1506 SubElement = self.etree.SubElement +1507 +1508 a = Element('a') +1509 b = SubElement(a, 'b') +1510 +1511 a.tag = 'c' +1512 +1513 self.assertEqual( +1514 'c', +1515 a.tag) +1516 +1517 self.assertXML( +1518 _bytes('<c><b></b></c>'), +1519 a) +
1520 +
1521 - def test_tag_reset_ns(self): +
1522 Element = self.etree.Element +1523 SubElement = self.etree.SubElement +1524 tostring = self.etree.tostring +1525 +1526 a = Element('{a}a') +1527 b1 = SubElement(a, '{a}b') +1528 b2 = SubElement(a, '{b}b') +1529 +1530 self.assertEqual('{a}b', b1.tag) +1531 +1532 b1.tag = 'c' +1533 +1534 # can't use C14N here! +1535 self.assertEqual('c', b1.tag) +1536 self.assertEqual(_bytes('<c'), tostring(b1)[:2]) +1537 self.assertTrue(_bytes('<c') in tostring(a)) +
1538 +
1539 - def test_tag_reset_root_ns(self): +
1540 Element = self.etree.Element +1541 SubElement = self.etree.SubElement +1542 tostring = self.etree.tostring +1543 +1544 a = Element('{a}a') +1545 b1 = SubElement(a, '{a}b') +1546 b2 = SubElement(a, '{b}b') +1547 +1548 a.tag = 'c' +1549 +1550 self.assertEqual( +1551 'c', +1552 a.tag) +1553 +1554 # can't use C14N here! +1555 self.assertEqual('c', a.tag) +1556 self.assertEqual(_bytes('<c'), tostring(a)[:2]) +
1557 +
1558 - def test_tag_str_subclass(self): +
1559 Element = self.etree.Element +1560 +1561 class strTest(str): +1562 pass +
1563 +1564 a = Element("a") +1565 a.tag = strTest("TAG") +1566 self.assertXML(_bytes('<TAG></TAG>'), +1567 a) +1568 +
1569 - def test_delitem(self): +
1570 Element = self.etree.Element +1571 SubElement = self.etree.SubElement +1572 +1573 a = Element('a') +1574 b = SubElement(a, 'b') +1575 c = SubElement(a, 'c') +1576 d = SubElement(a, 'd') +1577 +1578 del a[1] +1579 self.assertXML( +1580 _bytes('<a><b></b><d></d></a>'), +1581 a) +1582 +1583 del a[0] +1584 self.assertXML( +1585 _bytes('<a><d></d></a>'), +1586 a) +1587 +1588 del a[0] +1589 self.assertXML( +1590 _bytes('<a></a>'), +1591 a) +1592 # move deleted element into other tree afterwards +1593 other = Element('other') +1594 other.append(c) +1595 self.assertXML( +1596 _bytes('<other><c></c></other>'), +1597 other) +
1598 +
1599 - def test_del_insert(self): +
1600 Element = self.etree.Element +1601 SubElement = self.etree.SubElement +1602 +1603 a = Element('a') +1604 b = SubElement(a, 'b') +1605 bs = SubElement(b, 'bs') +1606 c = SubElement(a, 'c') +1607 cs = SubElement(c, 'cs') +1608 +1609 el = a[0] +1610 self.assertXML( +1611 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1612 a) +1613 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1614 self.assertXML(_bytes('<c><cs></cs></c>'), c) +1615 +1616 del a[0] +1617 self.assertXML( +1618 _bytes('<a><c><cs></cs></c></a>'), +1619 a) +1620 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1621 self.assertXML(_bytes('<c><cs></cs></c>'), c) +1622 +1623 a.insert(0, el) +1624 self.assertXML( +1625 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1626 a) +1627 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1628 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1629 +
1630 - def test_del_setitem(self): +
1631 Element = self.etree.Element +1632 SubElement = self.etree.SubElement +1633 +1634 a = Element('a') +1635 b = SubElement(a, 'b') +1636 bs = SubElement(b, 'bs') +1637 c = SubElement(a, 'c') +1638 cs = SubElement(c, 'cs') +1639 +1640 el = a[0] +1641 del a[0] +1642 a[0] = el +1643 self.assertXML( +1644 _bytes('<a><b><bs></bs></b></a>'), +1645 a) +1646 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1647 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1648 +
1649 - def test_del_setslice(self): +
1650 Element = self.etree.Element +1651 SubElement = self.etree.SubElement +1652 +1653 a = Element('a') +1654 b = SubElement(a, 'b') +1655 bs = SubElement(b, 'bs') +1656 c = SubElement(a, 'c') +1657 cs = SubElement(c, 'cs') +1658 +1659 el = a[0] +1660 del a[0] +1661 a[0:0] = [el] +1662 self.assertXML( +1663 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1664 a) +1665 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1666 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1667 +
1668 - def test_replace_slice_tail(self): +
1669 XML = self.etree.XML +1670 a = XML(_bytes('<a><b></b>B2<c></c>C2</a>')) +1671 b, c = a +1672 +1673 a[:] = [] +1674 +1675 self.assertEqual("B2", b.tail) +1676 self.assertEqual("C2", c.tail) +
1677 +
1679 XML = self.etree.XML +1680 root = XML(_bytes( +1681 '<foo><bar xmlns:baz="http://huhu"><puh><baz:bump1 /><baz:bump2 /></puh></bar></foo>')) +1682 root[:] = root.findall('.//puh') # delete bar from hierarchy +1683 +1684 # previously, this lost a namespace declaration on bump2 +1685 result = self.etree.tostring(root) +1686 foo = self.etree.fromstring(result) +1687 +1688 self.assertEqual('puh', foo[0].tag) +1689 self.assertEqual('{http://huhu}bump1', foo[0][0].tag) +1690 self.assertEqual('{http://huhu}bump2', foo[0][1].tag) +
1691 +
1692 - def test_delitem_tail(self): +
1693 ElementTree = self.etree.ElementTree +1694 f = BytesIO('<a><b></b>B2<c></c>C2</a>') +1695 doc = ElementTree(file=f) +1696 a = doc.getroot() +1697 del a[0] +1698 self.assertXML( +1699 _bytes('<a><c></c>C2</a>'), +1700 a) +
1701 +
1702 - def test_clear(self): +
1703 Element = self.etree.Element +1704 +1705 a = Element('a') +1706 a.text = 'foo' +1707 a.tail = 'bar' +1708 a.set('hoi', 'dag') +1709 a.clear() +1710 self.assertEqual(None, a.text) +1711 self.assertEqual(None, a.tail) +1712 self.assertEqual(None, a.get('hoi')) +1713 self.assertEqual('a', a.tag) +
1714 +
1715 - def test_clear_sub(self): +
1716 Element = self.etree.Element +1717 SubElement = self.etree.SubElement +1718 +1719 a = Element('a') +1720 a.text = 'foo' +1721 a.tail = 'bar' +1722 a.set('hoi', 'dag') +1723 b = SubElement(a, 'b') +1724 c = SubElement(b, 'c') +1725 a.clear() +1726 self.assertEqual(None, a.text) +1727 self.assertEqual(None, a.tail) +1728 self.assertEqual(None, a.get('hoi')) +1729 self.assertEqual('a', a.tag) +1730 self.assertEqual(0, len(a)) +1731 self.assertXML(_bytes('<a></a>'), +1732 a) +1733 self.assertXML(_bytes('<b><c></c></b>'), +1734 b) +
1735 +
1736 - def test_clear_tail(self): +
1737 ElementTree = self.etree.ElementTree +1738 f = BytesIO('<a><b></b>B2<c></c>C2</a>') +1739 doc = ElementTree(file=f) +1740 a = doc.getroot() +1741 a.clear() +1742 self.assertXML( +1743 _bytes('<a></a>'), +1744 a) +
1745 +
1746 - def test_insert(self): +
1747 Element = self.etree.Element +1748 SubElement = self.etree.SubElement +1749 +1750 a = Element('a') +1751 b = SubElement(a, 'b') +1752 c = SubElement(a, 'c') +1753 d = Element('d') +1754 a.insert(0, d) +1755 +1756 self.assertEqual( +1757 d, +1758 a[0]) +1759 +1760 self.assertXML( +1761 _bytes('<a><d></d><b></b><c></c></a>'), +1762 a) +1763 +1764 e = Element('e') +1765 a.insert(2, e) +1766 self.assertEqual( +1767 e, +1768 a[2]) +1769 self.assertXML( +1770 _bytes('<a><d></d><b></b><e></e><c></c></a>'), +1771 a) +
1772 +
1773 - def test_insert_name_interning(self): +
1774 # See GH#268 / LP#1773749. +1775 Element = self.etree.Element +1776 SubElement = self.etree.SubElement +1777 +1778 # Use unique names to make sure they are new in the tag name dict. +1779 import uuid +1780 names = dict((k, 'tag-' + str(uuid.uuid4())) for k in 'abcde') +1781 +1782 a = Element(names['a']) +1783 b = SubElement(a, names['b']) +1784 c = SubElement(a, names['c']) +1785 d = Element(names['d']) +1786 a.insert(0, d) +1787 +1788 self.assertEqual( +1789 d, +1790 a[0]) +1791 +1792 self.assertXML( +1793 _bytes('<%(a)s><%(d)s></%(d)s><%(b)s></%(b)s><%(c)s></%(c)s></%(a)s>' % names), +1794 a) +1795 +1796 e = Element(names['e']) +1797 a.insert(2, e) +1798 self.assertEqual( +1799 e, +1800 a[2]) +1801 self.assertXML( +1802 _bytes('<%(a)s><%(d)s></%(d)s><%(b)s></%(b)s><%(e)s></%(e)s><%(c)s></%(c)s></%(a)s>' % names), +1803 a) +
1804 +
1805 - def test_insert_beyond_index(self): +
1806 Element = self.etree.Element +1807 SubElement = self.etree.SubElement +1808 +1809 a = Element('a') +1810 b = SubElement(a, 'b') +1811 c = Element('c') +1812 +1813 a.insert(2, c) +1814 self.assertEqual( +1815 c, +1816 a[1]) +1817 self.assertXML( +1818 _bytes('<a><b></b><c></c></a>'), +1819 a) +
1820 +
1821 - def test_insert_negative(self): +
1822 Element = self.etree.Element +1823 SubElement = self.etree.SubElement +1824 +1825 a = Element('a') +1826 b = SubElement(a, 'b') +1827 c = SubElement(a, 'c') +1828 +1829 d = Element('d') +1830 a.insert(-1, d) +1831 self.assertEqual( +1832 d, +1833 a[-2]) +1834 self.assertXML( +1835 _bytes('<a><b></b><d></d><c></c></a>'), +1836 a) +
1837 +
1838 - def test_insert_tail(self): +
1839 Element = self.etree.Element +1840 SubElement = self.etree.SubElement +1841 +1842 a = Element('a') +1843 b = SubElement(a, 'b') +1844 +1845 c = Element('c') +1846 c.tail = 'C2' +1847 +1848 a.insert(0, c) +1849 self.assertXML( +1850 _bytes('<a><c></c>C2<b></b></a>'), +1851 a) +
1852 +
1853 - def test_remove(self): +
1854 Element = self.etree.Element +1855 SubElement = self.etree.SubElement +1856 +1857 a = Element('a') +1858 b = SubElement(a, 'b') +1859 c = SubElement(a, 'c') +1860 +1861 a.remove(b) +1862 self.assertEqual( +1863 c, +1864 a[0]) +1865 self.assertXML( +1866 _bytes('<a><c></c></a>'), +1867 a) +
1868 +
1869 - def test_remove_ns(self): +
1870 Element = self.etree.Element +1871 SubElement = self.etree.SubElement +1872 +1873 a = Element('{http://test}a') +1874 b = SubElement(a, '{http://test}b') +1875 c = SubElement(a, '{http://test}c') +1876 +1877 a.remove(b) +1878 self.assertXML( +1879 _bytes('<ns0:a xmlns:ns0="http://test"><ns0:c></ns0:c></ns0:a>'), +1880 a) +1881 self.assertXML( +1882 _bytes('<ns0:b xmlns:ns0="http://test"></ns0:b>'), +1883 b) +
1884 +
1885 - def test_remove_nonexisting(self): +
1886 Element = self.etree.Element +1887 SubElement = self.etree.SubElement +1888 +1889 a = Element('a') +1890 b = SubElement(a, 'b') +1891 c = SubElement(a, 'c') +1892 d = Element('d') +1893 self.assertRaises( +1894 ValueError, a.remove, d) +
1895 +
1896 - def test_remove_tail(self): +
1897 Element = self.etree.Element +1898 SubElement = self.etree.SubElement +1899 +1900 a = Element('a') +1901 b = SubElement(a, 'b') +1902 b.tail = 'b2' +1903 a.remove(b) +1904 self.assertXML( +1905 _bytes('<a></a>'), +1906 a) +1907 self.assertEqual('b2', b.tail) +
1908 +
1909 - def test_remove_while_iterating(self): +
1910 # There is no guarantee that this "works", but it should +1911 # remove at least one child and not crash. +1912 Element = self.etree.Element +1913 SubElement = self.etree.SubElement +1914 +1915 a = Element('a') +1916 SubElement(a, 'b') +1917 SubElement(a, 'c') +1918 SubElement(a, 'd') +1919 for el in a: +1920 a.remove(el) +1921 self.assertLess(len(a), 3) +
1922 +
1923 - def test_getchildren(self): +
1924 Element = self.etree.Element +1925 SubElement = self.etree.SubElement +1926 +1927 a = Element('a') +1928 b = SubElement(a, 'b') +1929 c = SubElement(a, 'c') +1930 d = SubElement(b, 'd') +1931 e = SubElement(c, 'e') +1932 self.assertXML( +1933 _bytes('<a><b><d></d></b><c><e></e></c></a>'), +1934 a) +1935 self.assertEqual( +1936 [b, c], +1937 a.getchildren()) +1938 self.assertEqual( +1939 [d], +1940 b.getchildren()) +1941 self.assertEqual( +1942 [], +1943 d.getchildren()) +
1944 +
1945 - def test_makeelement(self): +
1946 Element = self.etree.Element +1947 +1948 a = Element('a') +1949 b = a.makeelement('c', {'hoi':'dag'}) +1950 self.assertXML( +1951 _bytes('<c hoi="dag"></c>'), +1952 b) +
1953 +1954 required_versions_ET['test_iter'] = (1,3) +
1955 - def test_iter(self): +
1956 Element = self.etree.Element +1957 SubElement = self.etree.SubElement +1958 +1959 a = Element('a') +1960 b = SubElement(a, 'b') +1961 c = SubElement(a, 'c') +1962 d = SubElement(b, 'd') +1963 e = SubElement(c, 'e') +1964 +1965 self.assertEqual( +1966 [a, b, d, c, e], +1967 list(a.iter())) +1968 self.assertEqual( +1969 [d], +1970 list(d.iter())) +
1971 +
1972 - def test_iter_remove_tail(self): +
1973 Element = self.etree.Element +1974 SubElement = self.etree.SubElement +1975 +1976 a = Element('a') +1977 a.text = 'a' +1978 a.tail = 'a1' * 100 +1979 b = SubElement(a, 'b') +1980 b.text = 'b' +1981 b.tail = 'b1' * 100 +1982 c = SubElement(a, 'c') +1983 c.text = 'c' +1984 c.tail = 'c1' * 100 +1985 d = SubElement(b, 'd') +1986 d.text = 'd' +1987 d.tail = 'd1' * 100 +1988 e = SubElement(c, 'e') +1989 e.text = 'e' +1990 e.tail = 'e1' * 100 +1991 +1992 for el in a.iter(): +1993 el.tail = None +1994 el = None +1995 +1996 self.assertEqual( +1997 [None] * 5, +1998 [el.tail for el in a.iter()]) +
1999 +
2000 - def test_getiterator(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(b, 'd') +2008 e = SubElement(c, 'e') +2009 +2010 self.assertEqual( +2011 [a, b, d, c, e], +2012 list(a.getiterator())) +2013 self.assertEqual( +2014 [d], +2015 list(d.getiterator())) +
2016 +
2017 - def test_getiterator_empty(self): +
2018 Element = self.etree.Element +2019 SubElement = self.etree.SubElement +2020 +2021 a = Element('a') +2022 b = SubElement(a, 'b') +2023 c = SubElement(a, 'c') +2024 d = SubElement(b, 'd') +2025 e = SubElement(c, 'e') +2026 +2027 self.assertEqual( +2028 [], +2029 list(a.getiterator('none'))) +2030 self.assertEqual( +2031 [], +2032 list(e.getiterator('none'))) +2033 self.assertEqual( +2034 [e], +2035 list(e.getiterator())) +
2036 +
2037 - def test_getiterator_filter(self): +
2038 Element = self.etree.Element +2039 SubElement = self.etree.SubElement +2040 +2041 a = Element('a') +2042 b = SubElement(a, 'b') +2043 c = SubElement(a, 'c') +2044 d = SubElement(b, 'd') +2045 e = SubElement(c, 'e') +2046 +2047 self.assertEqual( +2048 [a], +2049 list(a.getiterator('a'))) +2050 a2 = SubElement(e, 'a') +2051 self.assertEqual( +2052 [a, a2], +2053 list(a.getiterator('a'))) +2054 self.assertEqual( +2055 [a2], +2056 list(c.getiterator('a'))) +
2057 +
2058 - def test_getiterator_filter_all(self): +
2059 Element = self.etree.Element +2060 SubElement = self.etree.SubElement +2061 +2062 a = Element('a') +2063 b = SubElement(a, 'b') +2064 c = SubElement(a, 'c') +2065 d = SubElement(b, 'd') +2066 e = SubElement(c, 'e') +2067 +2068 self.assertEqual( +2069 [a, b, d, c, e], +2070 list(a.getiterator('*'))) +
2071 +
2073 Element = self.etree.Element +2074 Comment = self.etree.Comment +2075 SubElement = self.etree.SubElement +2076 +2077 a = Element('a') +2078 b = SubElement(a, 'b') +2079 comment_b = Comment("TEST-b") +2080 b.append(comment_b) +2081 +2082 self.assertEqual( +2083 [comment_b], +2084 list(a.getiterator(Comment))) +2085 +2086 comment_a = Comment("TEST-a") +2087 a.append(comment_a) +2088 +2089 self.assertEqual( +2090 [comment_b, comment_a], +2091 list(a.getiterator(Comment))) +2092 +2093 self.assertEqual( +2094 [comment_b], +2095 list(b.getiterator(Comment))) +
2096 +
2097 - def test_getiterator_filter_pi(self): +
2098 Element = self.etree.Element +2099 PI = self.etree.ProcessingInstruction +2100 SubElement = self.etree.SubElement +2101 +2102 a = Element('a') +2103 b = SubElement(a, 'b') +2104 pi_b = PI("TEST-b") +2105 b.append(pi_b) +2106 +2107 self.assertEqual( +2108 [pi_b], +2109 list(a.getiterator(PI))) +2110 +2111 pi_a = PI("TEST-a") +2112 a.append(pi_a) +2113 +2114 self.assertEqual( +2115 [pi_b, pi_a], +2116 list(a.getiterator(PI))) +2117 +2118 self.assertEqual( +2119 [pi_b], +2120 list(b.getiterator(PI))) +
2121 +
2122 - def test_getiterator_with_text(self): +
2123 Element = self.etree.Element +2124 SubElement = self.etree.SubElement +2125 +2126 a = Element('a') +2127 a.text = 'a' +2128 b = SubElement(a, 'b') +2129 b.text = 'b' +2130 b.tail = 'b1' +2131 c = SubElement(a, 'c') +2132 c.text = 'c' +2133 c.tail = 'c1' +2134 d = SubElement(b, 'd') +2135 d.text = 'd' +2136 d.tail = 'd1' +2137 e = SubElement(c, 'e') +2138 e.text = 'e' +2139 e.tail = 'e1' +2140 +2141 self.assertEqual( +2142 [a, b, d, c, e], +2143 list(a.getiterator())) +
2144 #self.assertEqual( +2145 # [d], +2146 # list(d.getiterator())) +2147 +
2149 Element = self.etree.Element +2150 SubElement = self.etree.SubElement +2151 +2152 a = Element('a') +2153 a.text = 'a' +2154 b = SubElement(a, 'b') +2155 b.text = 'b' +2156 b.tail = 'b1' +2157 c = SubElement(a, 'c') +2158 c.text = 'c' +2159 c.tail = 'c1' +2160 d = SubElement(b, 'd') +2161 d.text = 'd' +2162 d.tail = 'd1' +2163 e = SubElement(c, 'e') +2164 e.text = 'e' +2165 e.tail = 'e1' +2166 +2167 self.assertEqual( +2168 [a], +2169 list(a.getiterator('a'))) +2170 a2 = SubElement(e, 'a') +2171 self.assertEqual( +2172 [a, a2], +2173 list(a.getiterator('a'))) +2174 self.assertEqual( +2175 [a2], +2176 list(e.getiterator('a'))) +
2177 +
2178 - def test_getslice(self): +
2179 Element = self.etree.Element +2180 SubElement = self.etree.SubElement +2181 +2182 a = Element('a') +2183 b = SubElement(a, 'b') +2184 c = SubElement(a, 'c') +2185 d = SubElement(a, 'd') +2186 +2187 self.assertEqual( +2188 [b, c], +2189 a[0:2]) +2190 self.assertEqual( +2191 [b, c, d], +2192 a[:]) +2193 self.assertEqual( +2194 [b, c, d], +2195 a[:10]) +2196 self.assertEqual( +2197 [b], +2198 a[0:1]) +2199 self.assertEqual( +2200 [], +2201 a[10:12]) +
2202 +
2203 - def test_getslice_negative(self): +
2204 Element = self.etree.Element +2205 SubElement = self.etree.SubElement +2206 +2207 a = Element('a') +2208 b = SubElement(a, 'b') +2209 c = SubElement(a, 'c') +2210 d = SubElement(a, 'd') +2211 +2212 self.assertEqual( +2213 [d], +2214 a[-1:]) +2215 self.assertEqual( +2216 [c, d], +2217 a[-2:]) +2218 self.assertEqual( +2219 [c], +2220 a[-2:-1]) +2221 self.assertEqual( +2222 [b, c], +2223 a[-3:-1]) +2224 self.assertEqual( +2225 [b, c], +2226 a[-3:2]) +
2227 +
2228 - def test_getslice_step(self): +
2229 Element = self.etree.Element +2230 SubElement = self.etree.SubElement +2231 +2232 a = Element('a') +2233 b = SubElement(a, 'b') +2234 c = SubElement(a, 'c') +2235 d = SubElement(a, 'd') +2236 e = SubElement(a, 'e') +2237 +2238 self.assertEqual( +2239 [e,d,c,b], +2240 a[::-1]) +2241 self.assertEqual( +2242 [b,d], +2243 a[::2]) +2244 self.assertEqual( +2245 [e,c], +2246 a[::-2]) +2247 self.assertEqual( +2248 [d,c], +2249 a[-2:0:-1]) +2250 self.assertEqual( +2251 [e], +2252 a[:1:-2]) +
2253 +
2254 - def test_getslice_text(self): +
2255 ElementTree = self.etree.ElementTree +2256 +2257 f = BytesIO('<a><b>B</b>B1<c>C</c>C1</a>') +2258 doc = ElementTree(file=f) +2259 a = doc.getroot() +2260 b = a[0] +2261 c = a[1] +2262 self.assertEqual( +2263 [b, c], +2264 a[:]) +2265 self.assertEqual( +2266 [b], +2267 a[0:1]) +2268 self.assertEqual( +2269 [c], +2270 a[1:]) +
2271 +
2273 Element = self.etree.Element +2274 Comment = self.etree.Comment +2275 SubElement = self.etree.SubElement +2276 +2277 a = Element('a') +2278 b = SubElement(a, 'b') +2279 foo = Comment('foo') +2280 a.append(foo) +2281 c = SubElement(a, 'c') +2282 self.assertEqual( +2283 [b, foo, c], +2284 a[:]) +2285 self.assertEqual( +2286 foo, +2287 a[1]) +2288 a[1] = new = Element('new') +2289 self.assertEqual( +2290 new, +2291 a[1]) +2292 self.assertXML( +2293 _bytes('<a><b></b><new></new><c></c></a>'), +2294 a) +
2295 +
2296 - def test_delslice(self): +
2297 Element = self.etree.Element +2298 SubElement = self.etree.SubElement +2299 +2300 a = Element('a') +2301 b = SubElement(a, 'b') +2302 c = SubElement(a, 'c') +2303 d = SubElement(a, 'd') +2304 e = SubElement(a, 'e') +2305 +2306 del a[1:3] +2307 self.assertEqual( +2308 [b, e], +2309 list(a)) +
2310 +
2311 - def test_delslice_negative1(self): +
2312 Element = self.etree.Element +2313 SubElement = self.etree.SubElement +2314 +2315 a = Element('a') +2316 b = SubElement(a, 'b') +2317 c = SubElement(a, 'c') +2318 d = SubElement(a, 'd') +2319 e = SubElement(a, 'e') +2320 +2321 del a[1:-1] +2322 self.assertEqual( +2323 [b, e], +2324 list(a)) +
2325 +
2326 - def test_delslice_negative2(self): +
2327 Element = self.etree.Element +2328 SubElement = self.etree.SubElement +2329 +2330 a = Element('a') +2331 b = SubElement(a, 'b') +2332 c = SubElement(a, 'c') +2333 d = SubElement(a, 'd') +2334 e = SubElement(a, 'e') +2335 +2336 del a[-3:-1] +2337 self.assertEqual( +2338 [b, e], +2339 list(a)) +
2340 +
2341 - def test_delslice_step(self): +
2342 Element = self.etree.Element +2343 SubElement = self.etree.SubElement +2344 +2345 a = Element('a') +2346 b = SubElement(a, 'b') +2347 c = SubElement(a, 'c') +2348 d = SubElement(a, 'd') +2349 e = SubElement(a, 'e') +2350 +2351 del a[1::2] +2352 self.assertEqual( +2353 [b, d], +2354 list(a)) +
2355 +
2356 - def test_delslice_step_negative(self): +
2357 Element = self.etree.Element +2358 SubElement = self.etree.SubElement +2359 +2360 a = Element('a') +2361 b = SubElement(a, 'b') +2362 c = SubElement(a, 'c') +2363 d = SubElement(a, 'd') +2364 e = SubElement(a, 'e') +2365 +2366 del a[::-1] +2367 self.assertEqual( +2368 [], +2369 list(a)) +
2370 +
2372 Element = self.etree.Element +2373 SubElement = self.etree.SubElement +2374 +2375 a = Element('a') +2376 b = SubElement(a, 'b') +2377 c = SubElement(a, 'c') +2378 d = SubElement(a, 'd') +2379 e = SubElement(a, 'e') +2380 +2381 del a[::-2] +2382 self.assertEqual( +2383 [b, d], +2384 list(a)) +
2385 +
2386 - def test_delslice_child_tail(self): +
2387 ElementTree = self.etree.ElementTree +2388 f = BytesIO('<a><b></b>B2<c></c>C2<d></d>D2<e></e>E2</a>') +2389 doc = ElementTree(file=f) +2390 a = doc.getroot() +2391 del a[1:3] +2392 self.assertXML( +2393 _bytes('<a><b></b>B2<e></e>E2</a>'), +2394 a) +
2395 +
2396 - def test_delslice_tail(self): +
2397 XML = self.etree.XML +2398 a = XML(_bytes('<a><b></b>B2<c></c>C2</a>')) +2399 b, c = a +2400 +2401 del a[:] +2402 +2403 self.assertEqual("B2", b.tail) +2404 self.assertEqual("C2", c.tail) +
2405 +
2406 - def test_delslice_memory(self): +
2407 # this could trigger a crash +2408 Element = self.etree.Element +2409 SubElement = self.etree.SubElement +2410 a = Element('a') +2411 b = SubElement(a, 'b') +2412 c = SubElement(b, 'c') +2413 del b # no more reference to b +2414 del a[:] +2415 self.assertEqual('c', c.tag) +
2416 +
2417 - def test_setslice(self): +
2418 Element = self.etree.Element +2419 SubElement = self.etree.SubElement +2420 +2421 a = Element('a') +2422 b = SubElement(a, 'b') +2423 c = SubElement(a, 'c') +2424 d = SubElement(a, 'd') +2425 +2426 e = Element('e') +2427 f = Element('f') +2428 g = Element('g') +2429 +2430 s = [e, f, g] +2431 a[1:2] = s +2432 self.assertEqual( +2433 [b, e, f, g, d], +2434 list(a)) +
2435 +
2436 - def test_setslice_all(self): +
2437 Element = self.etree.Element +2438 SubElement = self.etree.SubElement +2439 +2440 a = Element('a') +2441 b = SubElement(a, 'b') +2442 c = SubElement(a, 'c') +2443 +2444 e = Element('e') +2445 f = Element('f') +2446 g = Element('g') +2447 +2448 s = [e, f, g] +2449 a[:] = s +2450 self.assertEqual( +2451 [e, f, g], +2452 list(a)) +
2453 +
2454 - def test_setslice_all_empty(self): +
2455 Element = self.etree.Element +2456 SubElement = self.etree.SubElement +2457 +2458 a = Element('a') +2459 +2460 e = Element('e') +2461 f = Element('f') +2462 g = Element('g') +2463 +2464 s = [e, f, g] +2465 a[:] = s +2466 self.assertEqual( +2467 [e, f, g], +2468 list(a)) +
2469 +
2470 - def test_setslice_all_replace(self): +
2471 Element = self.etree.Element +2472 SubElement = self.etree.SubElement +2473 +2474 a = Element('a') +2475 b = SubElement(a, 'b') +2476 c = SubElement(a, 'c') +2477 d = SubElement(a, 'd') +2478 +2479 s = [b, c, d] +2480 a[:] = s +2481 self.assertEqual( +2482 [b, c, d], +2483 list(a)) +
2484 +
2486 Element = self.etree.Element +2487 SubElement = self.etree.SubElement +2488 +2489 a = Element('a') +2490 b = SubElement(a, 'b') +2491 c = SubElement(a, 'c') +2492 d = SubElement(a, 'd') +2493 +2494 s = [d, c, b] +2495 a[:] = s +2496 self.assertEqual( +2497 [d, c, b], +2498 list(a)) +
2499 +
2501 Element = self.etree.Element +2502 SubElement = self.etree.SubElement +2503 +2504 a = Element('{ns}a') +2505 b = SubElement(a, '{ns}b', {'{ns1}a1': 'test'}) +2506 c = SubElement(a, '{ns}c', {'{ns2}a2': 'test'}) +2507 d = SubElement(a, '{ns}d', {'{ns3}a3': 'test'}) +2508 +2509 s = [d, c, b] +2510 a[:] = s +2511 self.assertEqual( +2512 [d, c, b], +2513 list(a)) +2514 self.assertEqual( +2515 ['{ns}d', '{ns}c', '{ns}b'], +2516 [ child.tag for child in a ]) +2517 +2518 self.assertEqual( +2519 [['{ns3}a3'], ['{ns2}a2'], ['{ns1}a1']], +2520 [ list(child.attrib.keys()) for child in a ]) +
2521 +
2523 Element = self.etree.Element +2524 SubElement = self.etree.SubElement +2525 +2526 a = Element('{ns}a') +2527 b = SubElement(a, '{ns1}b', {'{ns}a1': 'test'}) +2528 c = SubElement(a, '{ns2}c', {'{ns}a2': 'test'}) +2529 d = SubElement(a, '{ns3}d', {'{ns}a3': 'test'}) +2530 +2531 s = [d, c, b] +2532 a[:] = s +2533 self.assertEqual( +2534 [d, c, b], +2535 list(a)) +2536 self.assertEqual( +2537 ['{ns3}d', '{ns2}c', '{ns1}b'], +2538 [ child.tag for child in a ]) +2539 +2540 self.assertEqual( +2541 [['{ns}a3'], ['{ns}a2'], ['{ns}a1']], +2542 [ list(child.attrib.keys()) for child in a ]) +
2543 +
2544 - def test_setslice_end(self): +
2545 Element = self.etree.Element +2546 SubElement = self.etree.SubElement +2547 +2548 a = Element('a') +2549 b = SubElement(a, 'b') +2550 c = SubElement(a, 'c') +2551 +2552 e = Element('e') +2553 f = Element('f') +2554 g = Element('g') +2555 h = Element('h') +2556 +2557 s = [e, f] +2558 a[99:] = s +2559 self.assertEqual( +2560 [b, c, e, f], +2561 list(a)) +2562 +2563 s = [g, h] +2564 a[:0] = s +2565 self.assertEqual( +2566 [g, h, b, c, e, f], +2567 list(a)) +
2568 +
2569 - def test_setslice_end_exact(self): +
2570 Element = self.etree.Element +2571 SubElement = self.etree.SubElement +2572 +2573 a = Element('a') +2574 b = SubElement(a, 'b') +2575 c = SubElement(a, 'c') +2576 d = SubElement(a, 'd') +2577 +2578 e = Element('e') +2579 f = Element('f') +2580 g = Element('g') +2581 +2582 s = [e, f, g] +2583 a[3:] = s +2584 self.assertEqual( +2585 [b, c, d, e, f, g], +2586 list(a)) +
2587 +
2588 - def test_setslice_single(self): +
2589 Element = self.etree.Element +2590 SubElement = self.etree.SubElement +2591 +2592 a = Element('a') +2593 b = SubElement(a, 'b') +2594 c = SubElement(a, 'c') +2595 +2596 e = Element('e') +2597 f = Element('f') +2598 +2599 s = [e] +2600 a[0:1] = s +2601 self.assertEqual( +2602 [e, c], +2603 list(a)) +2604 +2605 s = [f] +2606 a[1:2] = s +2607 self.assertEqual( +2608 [e, f], +2609 list(a)) +
2610 +
2611 - def test_setslice_tail(self): +
2612 ElementTree = self.etree.ElementTree +2613 Element = self.etree.Element +2614 f = BytesIO('<a><b></b>B2<c></c>C2<d></d>D2<e></e>E2</a>') +2615 doc = ElementTree(file=f) +2616 a = doc.getroot() +2617 x = Element('x') +2618 y = Element('y') +2619 z = Element('z') +2620 x.tail = 'X2' +2621 y.tail = 'Y2' +2622 z.tail = 'Z2' +2623 a[1:3] = [x, y, z] +2624 self.assertXML( +2625 _bytes('<a><b></b>B2<x></x>X2<y></y>Y2<z></z>Z2<e></e>E2</a>'), +2626 a) +
2627 +
2628 - def test_setslice_negative(self): +
2629 Element = self.etree.Element +2630 SubElement = self.etree.SubElement +2631 +2632 a = Element('a') +2633 b = SubElement(a, 'b') +2634 c = SubElement(a, 'c') +2635 d = SubElement(a, 'd') +2636 +2637 x = Element('x') +2638 y = Element('y') +2639 +2640 a[1:-1] = [x, y] +2641 self.assertEqual( +2642 [b, x, y, d], +2643 list(a)) +
2644 +
2645 - def test_setslice_negative2(self): +
2646 Element = self.etree.Element +2647 SubElement = self.etree.SubElement +2648 +2649 a = Element('a') +2650 b = SubElement(a, 'b') +2651 c = SubElement(a, 'c') +2652 d = SubElement(a, 'd') +2653 +2654 x = Element('x') +2655 y = Element('y') +2656 +2657 a[1:-2] = [x, y] +2658 self.assertEqual( +2659 [b, x, y, c, d], +2660 list(a)) +
2661 +
2662 - def test_setslice_empty(self): +
2663 Element = self.etree.Element +2664 +2665 a = Element('a') +2666 +2667 b = Element('b') +2668 c = Element('c') +2669 +2670 a[:] = [b, c] +2671 self.assertEqual( +2672 [b, c], +2673 list(a)) +
2674 +
2675 - def test_tail_elementtree_root(self): +
2676 Element = self.etree.Element +2677 ElementTree = self.etree.ElementTree +2678 +2679 a = Element('a') +2680 a.tail = 'A2' +2681 t = ElementTree(element=a) +2682 self.assertEqual('A2', +2683 a.tail) +
2684 +
2686 Element = self.etree.Element +2687 SubElement = self.etree.SubElement +2688 ElementTree = self.etree.ElementTree +2689 +2690 a = Element('a') +2691 b = SubElement(a, 'b') +2692 c = SubElement(a, 'c') +2693 d = SubElement(b, 'd') +2694 e = SubElement(c, 'e') +2695 t = ElementTree(element=a) +2696 +2697 self.assertEqual( +2698 [a, b, d, c, e], +2699 list(t.getiterator())) +
2700 +
2702 Element = self.etree.Element +2703 SubElement = self.etree.SubElement +2704 ElementTree = self.etree.ElementTree +2705 a = Element('a') +2706 b = SubElement(a, 'b') +2707 c = SubElement(a, 'c') +2708 d = SubElement(b, 'd') +2709 e = SubElement(c, 'e') +2710 t = ElementTree(element=a) +2711 +2712 self.assertEqual( +2713 [a], +2714 list(t.getiterator('a'))) +2715 a2 = SubElement(e, 'a') +2716 self.assertEqual( +2717 [a, a2], +2718 list(t.getiterator('a'))) +
2719 +
2720 - def test_ns_access(self): +
2721 ElementTree = self.etree.ElementTree +2722 ns = 'http://xml.infrae.com/1' +2723 f = BytesIO('<x:a xmlns:x="%s"><x:b></x:b></x:a>' % ns) +2724 t = ElementTree(file=f) +2725 a = t.getroot() +2726 self.assertEqual('{%s}a' % ns, +2727 a.tag) +2728 self.assertEqual('{%s}b' % ns, +2729 a[0].tag) +
2730 +
2731 - def test_ns_access2(self): +
2732 ElementTree = self.etree.ElementTree +2733 ns = 'http://xml.infrae.com/1' +2734 ns2 = 'http://xml.infrae.com/2' +2735 f = BytesIO('<x:a xmlns:x="%s" xmlns:y="%s"><x:b></x:b><y:b></y:b></x:a>' % (ns, ns2)) +2736 t = ElementTree(file=f) +2737 a = t.getroot() +2738 self.assertEqual('{%s}a' % ns, +2739 a.tag) +2740 self.assertEqual('{%s}b' % ns, +2741 a[0].tag) +2742 self.assertEqual('{%s}b' % ns2, +2743 a[1].tag) +
2744 +
2745 - def test_ns_setting(self): +
2746 Element = self.etree.Element +2747 SubElement = self.etree.SubElement +2748 ns = 'http://xml.infrae.com/1' +2749 ns2 = 'http://xml.infrae.com/2' +2750 a = Element('{%s}a' % ns) +2751 b = SubElement(a, '{%s}b' % ns2) +2752 c = SubElement(a, '{%s}c' % ns) +2753 self.assertEqual('{%s}a' % ns, +2754 a.tag) +2755 self.assertEqual('{%s}b' % ns2, +2756 b.tag) +2757 self.assertEqual('{%s}c' % ns, +2758 c.tag) +2759 self.assertEqual('{%s}a' % ns, +2760 a.tag) +2761 self.assertEqual('{%s}b' % ns2, +2762 b.tag) +2763 self.assertEqual('{%s}c' % ns, +2764 c.tag) +
2765 +
2766 - def test_ns_tag_parse(self): +
2767 Element = self.etree.Element +2768 SubElement = self.etree.SubElement +2769 ElementTree = self.etree.ElementTree +2770 +2771 ns = 'http://xml.infrae.com/1' +2772 ns2 = 'http://xml.infrae.com/2' +2773 f = BytesIO('<a xmlns="%s" xmlns:x="%s"><x:b></x:b><b></b></a>' % (ns, ns2)) +2774 t = ElementTree(file=f) +2775 +2776 a = t.getroot() +2777 self.assertEqual('{%s}a' % ns, +2778 a.tag) +2779 self.assertEqual('{%s}b' % ns2, +2780 a[0].tag) +2781 self.assertEqual('{%s}b' % ns, +2782 a[1].tag) +
2783 +
2784 - def test_ns_attr(self): +
2785 Element = self.etree.Element +2786 ns = 'http://xml.infrae.com/1' +2787 ns2 = 'http://xml.infrae.com/2' +2788 a = Element('a') +2789 a.set('{%s}foo' % ns, 'Foo') +2790 a.set('{%s}bar' % ns2, 'Bar') +2791 self.assertEqual( +2792 'Foo', +2793 a.get('{%s}foo' % ns)) +2794 self.assertEqual( +2795 'Bar', +2796 a.get('{%s}bar' % ns2)) +2797 try: +2798 self.assertXML( +2799 _bytes('<a xmlns:ns0="%s" xmlns:ns1="%s" ns0:foo="Foo" ns1:bar="Bar"></a>' % (ns, ns2)), +2800 a) +2801 except AssertionError: +2802 self.assertXML( +2803 _bytes('<a xmlns:ns0="%s" xmlns:ns1="%s" ns1:foo="Foo" ns0:bar="Bar"></a>' % (ns2, ns)), +2804 a) +
2805 +
2806 - def test_ns_move(self): +
2807 Element = self.etree.Element +2808 one = self.etree.fromstring( +2809 _bytes('<foo><bar xmlns:ns="http://a.b.c"><ns:baz/></bar></foo>')) +2810 baz = one[0][0] +2811 +2812 two = Element('root') +2813 two.append(baz) +2814 # removing the originating document could cause a crash/error before +2815 # as namespace is not moved along with it +2816 del one, baz +2817 self.assertEqual('{http://a.b.c}baz', two[0].tag) +
2818 +
2819 - def test_ns_decl_tostring(self): +
2820 tostring = self.etree.tostring +2821 root = self.etree.XML( +2822 _bytes('<foo><bar xmlns:ns="http://a.b.c"><ns:baz/></bar></foo>')) +2823 baz = root[0][0] +2824 +2825 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2826 tostring(baz)) +2827 self.assertEqual([_bytes("http://a.b.c")], nsdecl) +
2828 +
2830 tostring = self.etree.tostring +2831 root = self.etree.XML( +2832 _bytes('<foo><bar xmlns="http://a.b.c"><baz/></bar></foo>')) +2833 baz = root[0][0] +2834 +2835 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2836 tostring(baz)) +2837 self.assertEqual([_bytes("http://a.b.c")], nsdecl) +
2838 +
2839 - def test_ns_decl_tostring_root(self): +
2840 tostring = self.etree.tostring +2841 root = self.etree.XML( +2842 _bytes('<foo xmlns:ns="http://a.b.c"><bar><ns:baz/></bar></foo>')) +2843 baz = root[0][0] +2844 +2845 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2846 tostring(baz)) +2847 +2848 self.assertEqual([_bytes("http://a.b.c")], nsdecl) +
2849 +
2851 Element = self.etree.Element +2852 SubElement = self.etree.SubElement +2853 +2854 root = Element("foo") +2855 bar = SubElement(root, "{http://a.b.c}bar") +2856 baz = SubElement(bar, "{http://a.b.c}baz") +2857 +2858 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2859 self.etree.tostring(baz)) +2860 +2861 self.assertEqual([_bytes("http://a.b.c")], nsdecl) +
2862 +
2863 - def test_attribute_xmlns_move(self): +
2864 Element = self.etree.Element +2865 +2866 root = Element('element') +2867 +2868 subelement = Element('subelement', +2869 {"{http://www.w3.org/XML/1998/namespace}id": "foo"}) +2870 self.assertEqual(1, len(subelement.attrib)) +2871 self.assertEqual( +2872 "foo", +2873 subelement.get("{http://www.w3.org/XML/1998/namespace}id")) +2874 +2875 root.append(subelement) +2876 self.assertEqual(1, len(subelement.attrib)) +2877 self.assertEqual( +2878 list({"{http://www.w3.org/XML/1998/namespace}id" : "foo"}.items()), +2879 list(subelement.attrib.items())) +2880 self.assertEqual( +2881 "foo", +2882 subelement.get("{http://www.w3.org/XML/1998/namespace}id")) +
2883 +
2885 parse = self.etree.parse +2886 tostring = self.etree.tostring +2887 +2888 ns_href = "http://a.b.c" +2889 one = parse( +2890 BytesIO('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href)) +2891 baz = one.getroot()[0][0] +2892 +2893 parsed = parse(BytesIO( tostring(baz) )).getroot() +2894 self.assertEqual('{%s}baz' % ns_href, parsed.tag) +
2895 +
2897 fromstring = self.etree.fromstring +2898 tostring = self.etree.tostring +2899 +2900 ns_href = "http://a.b.c" +2901 xml = _bytes('<root xmlns="%s" xmlns:x="%s"><el x:a="test" /></root>' % ( +2902 ns_href,ns_href)) +2903 root = fromstring(xml) +2904 self.assertEqual('test', root[0].get('{%s}a' % ns_href)) +2905 +2906 xml2 = tostring(root) +2907 self.assertTrue(_bytes(':a=') in xml2, xml2) +2908 +2909 root2 = fromstring(xml2) +2910 self.assertEqual('test', root2[0].get('{%s}a' % ns_href)) +
2911 +
2913 fromstring = self.etree.fromstring +2914 tostring = self.etree.tostring +2915 +2916 ns_href = "http://a.b.c" +2917 xml = _bytes('<root xmlns="%s" xmlns:x="%s"><el x:a="test" /></root>' % ( +2918 ns_href,ns_href)) +2919 root = fromstring(xml) +2920 self.assertEqual('test', root[0].get('{%s}a' % ns_href)) +2921 +2922 root[0].set('{%s}a' % ns_href, 'TEST') +2923 +2924 xml2 = tostring(root) +2925 self.assertTrue(_bytes(':a=') in xml2, xml2) +2926 +2927 root2 = fromstring(xml2) +2928 self.assertEqual('TEST', root2[0].get('{%s}a' % ns_href)) +
2929 +2930 required_versions_ET['test_register_namespace'] = (1,3) +
2931 - def test_register_namespace(self): +
2932 # ET 1.3+ +2933 Element = self.etree.Element +2934 prefix = 'TESTPREFIX' +2935 namespace = 'http://seriously.unknown/namespace/URI' +2936 +2937 el = Element('{%s}test' % namespace) +2938 self.assertEqual(_bytes('<ns0:test xmlns:ns0="%s"></ns0:test>' % namespace), +2939 self._writeElement(el)) +2940 +2941 self.etree.register_namespace(prefix, namespace) +2942 el = Element('{%s}test' % namespace) +2943 self.assertEqual(_bytes('<%s:test xmlns:%s="%s"></%s:test>' % ( +2944 prefix, prefix, namespace, prefix)), +2945 self._writeElement(el)) +2946 +2947 self.assertRaises(ValueError, self.etree.register_namespace, 'ns25', namespace) +
2948 +
2949 - def test_tostring(self): +
2950 tostring = self.etree.tostring +2951 Element = self.etree.Element +2952 SubElement = self.etree.SubElement +2953 +2954 a = Element('a') +2955 b = SubElement(a, 'b') +2956 c = SubElement(a, 'c') +2957 +2958 self.assertEqual(_bytes('<a><b></b><c></c></a>'), +2959 canonicalize(tostring(a))) +
2960 +
2961 - def test_tostring_element(self): +
2962 tostring = self.etree.tostring +2963 Element = self.etree.Element +2964 SubElement = self.etree.SubElement +2965 +2966 a = Element('a') +2967 b = SubElement(a, 'b') +2968 c = SubElement(a, 'c') +2969 d = SubElement(c, 'd') +2970 self.assertEqual(_bytes('<b></b>'), +2971 canonicalize(tostring(b))) +2972 self.assertEqual(_bytes('<c><d></d></c>'), +2973 canonicalize(tostring(c))) +
2974 +
2975 - def test_tostring_element_tail(self): +
2976 tostring = self.etree.tostring +2977 Element = self.etree.Element +2978 SubElement = self.etree.SubElement +2979 +2980 a = Element('a') +2981 b = SubElement(a, 'b') +2982 c = SubElement(a, 'c') +2983 d = SubElement(c, 'd') +2984 b.tail = 'Foo' +2985 +2986 self.assertTrue(tostring(b) == _bytes('<b/>Foo') or +2987 tostring(b) == _bytes('<b />Foo')) +
2988 +2989 required_versions_ET['test_tostring_method_html'] = (1,3) +
2990 - def test_tostring_method_html(self): +
2991 tostring = self.etree.tostring +2992 Element = self.etree.Element +2993 SubElement = self.etree.SubElement +2994 +2995 html = Element('html') +2996 body = SubElement(html, 'body') +2997 p = SubElement(body, 'p') +2998 p.text = "html" +2999 SubElement(p, 'br').tail = "test" +3000 +3001 self.assertEqual(_bytes('<html><body><p>html<br>test</p></body></html>'), +3002 tostring(html, method="html")) +
3003 +3004 required_versions_ET['test_tostring_method_text'] = (1,3) +
3005 - def test_tostring_method_text(self): +
3006 tostring = self.etree.tostring +3007 Element = self.etree.Element +3008 SubElement = self.etree.SubElement +3009 +3010 a = Element('a') +3011 a.text = "A" +3012 a.tail = "tail" +3013 b = SubElement(a, 'b') +3014 b.text = "B" +3015 b.tail = "TAIL" +3016 c = SubElement(a, 'c') +3017 c.text = "C" +3018 +3019 self.assertEqual(_bytes('ABTAILCtail'), +3020 tostring(a, method="text")) +
3021 +
3022 - def test_iterparse(self): +
3023 iterparse = self.etree.iterparse +3024 f = BytesIO('<a><b></b><c/></a>') +3025 +3026 iterator = iterparse(f) +3027 self.assertEqual(None, +3028 iterator.root) +3029 events = list(iterator) +3030 root = iterator.root +3031 self.assertEqual( +3032 [('end', root[0]), ('end', root[1]), ('end', root)], +3033 events) +
3034 +
3035 - def test_iterparse_incomplete(self): +
3036 iterparse = self.etree.iterparse +3037 f = BytesIO('<a><b></b><c/></a>') +3038 +3039 iterator = iterparse(f) +3040 self.assertEqual(None, +3041 iterator.root) +3042 event, element = next(iter(iterator)) +3043 self.assertEqual('end', event) +3044 self.assertEqual('b', element.tag) +
3045 +
3046 - def test_iterparse_file(self): +
3047 iterparse = self.etree.iterparse +3048 iterator = iterparse(fileInTestDir("test.xml")) +3049 self.assertEqual(None, +3050 iterator.root) +3051 events = list(iterator) +3052 root = iterator.root +3053 self.assertEqual( +3054 [('end', root[0]), ('end', root)], +3055 events) +
3056 +
3057 - def test_iterparse_start(self): +
3058 iterparse = self.etree.iterparse +3059 f = BytesIO('<a><b></b><c/></a>') +3060 +3061 iterator = iterparse(f, events=('start',)) +3062 events = list(iterator) +3063 root = iterator.root +3064 self.assertEqual( +3065 [('start', root), ('start', root[0]), ('start', root[1])], +3066 events) +
3067 +
3068 - def test_iterparse_start_end(self): +
3069 iterparse = self.etree.iterparse +3070 f = BytesIO('<a><b></b><c/></a>') +3071 +3072 iterator = iterparse(f, events=('start','end')) +3073 events = list(iterator) +3074 root = iterator.root +3075 self.assertEqual( +3076 [('start', root), ('start', root[0]), ('end', root[0]), +3077 ('start', root[1]), ('end', root[1]), ('end', root)], +3078 events) +
3079 +
3080 - def test_iterparse_clear(self): +
3081 iterparse = self.etree.iterparse +3082 f = BytesIO('<a><b></b><c/></a>') +3083 +3084 iterator = iterparse(f) +3085 for event, elem in iterator: +3086 elem.clear() +3087 +3088 root = iterator.root +3089 self.assertEqual(0, +3090 len(root)) +
3091 +
3092 - def test_iterparse_large(self): +
3093 iterparse = self.etree.iterparse +3094 CHILD_COUNT = 12345 +3095 f = BytesIO('<a>%s</a>' % ('<b>test</b>'*CHILD_COUNT)) +3096 +3097 i = 0 +3098 for key in iterparse(f): +3099 event, element = key +3100 i += 1 +3101 self.assertEqual(i, CHILD_COUNT + 1) +
3102 +
3104 iterparse = self.etree.iterparse +3105 f = BytesIO('<a xmlns="http://ns1/"><b><c xmlns="http://ns2/"/></b></a>') +3106 +3107 attr_name = '{http://testns/}bla' +3108 events = [] +3109 iterator = iterparse(f, events=('start','end','start-ns','end-ns')) +3110 for event, elem in iterator: +3111 events.append(event) +3112 if event == 'start': +3113 if elem.tag != '{http://ns1/}a': +3114 elem.set(attr_name, 'value') +3115 +3116 self.assertEqual( +3117 ['start-ns', 'start', 'start', 'start-ns', 'start', +3118 'end', 'end-ns', 'end', 'end', 'end-ns'], +3119 events) +3120 +3121 root = iterator.root +3122 self.assertEqual( +3123 None, +3124 root.get(attr_name)) +3125 self.assertEqual( +3126 'value', +3127 root[0].get(attr_name)) +
3128 +
3129 - def test_iterparse_only_end_ns(self): +
3130 iterparse = self.etree.iterparse +3131 f = BytesIO('<a xmlns="http://ns1/"><b><c xmlns="http://ns2/"/></b></a>') +3132 +3133 attr_name = '{http://testns/}bla' +3134 events = [] +3135 iterator = iterparse(f, events=('start','end','start-ns','end-ns')) +3136 for event, elem in iterator: +3137 events.append(event) +3138 if event == 'start': +3139 if elem.tag != '{http://ns1/}a': +3140 elem.set(attr_name, 'value') +3141 +3142 self.assertEqual( +3143 ['start-ns', 'start', 'start', 'start-ns', 'start', +3144 'end', 'end-ns', 'end', 'end', 'end-ns'], +3145 events) +3146 +3147 root = iterator.root +3148 self.assertEqual( +3149 None, +3150 root.get(attr_name)) +3151 self.assertEqual( +3152 'value', +3153 root[0].get(attr_name)) +
3154 +
3155 - def test_iterparse_getiterator(self): +
3156 iterparse = self.etree.iterparse +3157 f = BytesIO('<a><b><d/></b><c/></a>') +3158 +3159 counts = [] +3160 for event, elem in iterparse(f): +3161 counts.append(len(list(elem.getiterator()))) +3162 self.assertEqual( +3163 [1,2,1,4], +3164 counts) +
3165 +
3167 iterparse = self.etree.iterparse +3168 f = BytesIO('<a><b><d/></b><c/></a>') +3169 +3170 for event, node in etree.iterparse(f): pass +3171 +3172 root = etree.Element('new_root', {}) +3173 root[:] = node[:] +3174 +3175 self.assertEqual( +3176 ['b', 'c'], +3177 [ el.tag for el in root ]) +
3178 +
3179 - def test_iterparse_cdata(self): +
3180 tostring = self.etree.tostring +3181 f = BytesIO('<root><![CDATA[test]]></root>') +3182 context = self.etree.iterparse(f) +3183 content = [ el.text for event,el in context ] +3184 +3185 self.assertEqual(['test'], content) +3186 self.assertEqual(_bytes('<root>test</root>'), +3187 tostring(context.root)) +
3188 +
3189 - def test_parse_file(self): +
3190 parse = self.etree.parse +3191 # from file +3192 tree = parse(fileInTestDir('test.xml')) +3193 self.assertXML( +3194 _bytes('<a><b></b></a>'), +3195 tree.getroot()) +
3196 +
3197 - def test_parse_file_nonexistent(self): +
3198 parse = self.etree.parse +3199 self.assertRaises(IOError, parse, fileInTestDir('notthere.xml')) +
3200 +
3201 - def test_parse_error_none(self): +
3202 parse = self.etree.parse +3203 self.assertRaises(TypeError, parse, None) +
3204 +3205 required_versions_ET['test_parse_error'] = (1,3) +
3206 - def test_parse_error(self): +
3207 # ET < 1.3 raises ExpatError +3208 parse = self.etree.parse +3209 f = BytesIO('<a><b></c></b></a>') +3210 self.assertRaises(SyntaxError, parse, f) +3211 f.close() +
3212 +3213 required_versions_ET['test_parse_error_from_file'] = (1,3) +
3214 - def test_parse_error_from_file(self): +
3215 parse = self.etree.parse +3216 # from file +3217 f = open(fileInTestDir('test_broken.xml'), 'rb') +3218 self.assertRaises(SyntaxError, parse, f) +3219 f.close() +
3220 +
3221 - def test_parse_file_object(self): +
3222 parse = self.etree.parse +3223 # from file object +3224 f = open(fileInTestDir('test.xml'), 'rb') +3225 tree = parse(f) +3226 f.close() +3227 self.assertXML( +3228 _bytes('<a><b></b></a>'), +3229 tree.getroot()) +
3230 +
3231 - def test_parse_stringio(self): +
3232 parse = self.etree.parse +3233 f = BytesIO('<a><b></b></a>') +3234 tree = parse(f) +3235 f.close() +3236 self.assertXML( +3237 _bytes('<a><b></b></a>'), +3238 tree.getroot() +3239 ) +
3240 +
3241 - def test_parse_cdata(self): +
3242 tostring = self.etree.tostring +3243 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>')) +3244 +3245 self.assertEqual('test', root.text) +3246 self.assertEqual(_bytes('<root>test</root>'), +3247 tostring(root)) +
3248 +
3249 - def test_parse_with_encoding(self): +
3250 # this can fail in libxml2 <= 2.6.22 +3251 parse = self.etree.parse +3252 tree = parse(BytesIO('<?xml version="1.0" encoding="ascii"?><html/>')) +3253 self.assertXML(_bytes('<html></html>'), +3254 tree.getroot()) +
3255 +
3256 - def test_encoding(self): +
3257 Element = self.etree.Element +3258 +3259 a = Element('a') +3260 a.text = _str('Søk på nettet') +3261 self.assertXML( +3262 _str('<a>Søk på nettet</a>').encode('UTF-8'), +3263 a, 'utf-8') +
3264 +
3265 - def test_encoding_exact(self): +
3266 ElementTree = self.etree.ElementTree +3267 Element = self.etree.Element +3268 +3269 a = Element('a') +3270 a.text = _str('Søk på nettet') +3271 +3272 f = BytesIO() +3273 tree = ElementTree(element=a) +3274 tree.write(f, encoding='utf-8') +3275 self.assertEqual(_str('<a>Søk på nettet</a>').encode('UTF-8'), +3276 f.getvalue().replace(_bytes('\n'),_bytes(''))) +
3277 +
3278 - def test_parse_file_encoding(self): +
3279 parse = self.etree.parse +3280 # from file +3281 tree = parse(fileInTestDir('test-string.xml')) +3282 self.assertXML( +3283 _str('<a>Søk på nettet</a>').encode('UTF-8'), +3284 tree.getroot(), 'UTF-8') +
3285 +
3287 parse = self.etree.parse +3288 # from file object +3289 f = open(fileInTestDir('test-string.xml'), 'rb') +3290 tree = parse(f) +3291 f.close() +3292 self.assertXML( +3293 _str('<a>Søk på nettet</a>').encode('UTF-8'), +3294 tree.getroot(), 'UTF-8') +
3295 +
3296 - def test_encoding_8bit_latin1(self): +
3297 ElementTree = self.etree.ElementTree +3298 Element = self.etree.Element +3299 +3300 a = Element('a') +3301 a.text = _str('Søk på nettet') +3302 +3303 f = BytesIO() +3304 tree = ElementTree(element=a) +3305 tree.write(f, encoding='iso-8859-1') +3306 result = f.getvalue() +3307 declaration = _bytes("<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>") +3308 self.assertEncodingDeclaration(result, _bytes('iso-8859-1')) +3309 result = result.split(_bytes('?>'), 1)[-1].replace(_bytes('\n'),_bytes('')) +3310 self.assertEqual(_str('<a>Søk på nettet</a>').encode('iso-8859-1'), +3311 result) +
3312 +3313 required_versions_ET['test_parse_encoding_8bit_explicit'] = (1,3) +
3315 XMLParser = self.XMLParser +3316 +3317 text = _str('Søk på nettet') +3318 xml_latin1 = (_str('<a>%s</a>') % text).encode('iso-8859-1') +3319 +3320 self.assertRaises(self.etree.ParseError, +3321 self.etree.parse, +3322 BytesIO(xml_latin1)) +3323 +3324 tree = self.etree.parse(BytesIO(xml_latin1), +3325 XMLParser(encoding="iso-8859-1")) +3326 a = tree.getroot() +3327 self.assertEqual(a.text, text) +
3328 +3329 required_versions_ET['test_parse_encoding_8bit_override'] = (1,3) +
3331 XMLParser = self.XMLParser +3332 +3333 text = _str('Søk på nettet') +3334 wrong_declaration = _str("<?xml version='1.0' encoding='UTF-8'?>") +3335 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) +3336 ).encode('iso-8859-1') +3337 +3338 self.assertRaises(self.etree.ParseError, +3339 self.etree.parse, +3340 BytesIO(xml_latin1)) +3341 +3342 tree = self.etree.parse(BytesIO(xml_latin1), +3343 XMLParser(encoding="iso-8859-1")) +3344 a = tree.getroot() +3345 self.assertEqual(a.text, text) +
3346 +
3348 # raise error on wrong encoding declaration in unicode strings +3349 XML = self.etree.XML +3350 test_utf = (_str('<?xml version="1.0" encoding="iso-8859-1"?>') + +3351 _str('<a>Søk på nettet</a>')) +3352 self.assertRaises(SyntaxError, XML, test_utf) +
3353 +
3355 ElementTree = self.etree.ElementTree +3356 Element = self.etree.Element +3357 +3358 a = Element('a') +3359 a.text = _str('Søk på nettet') +3360 +3361 f = BytesIO() +3362 tree = ElementTree(element=a) +3363 tree.write(f) +3364 data = f.getvalue().replace(_bytes('\n'),_bytes('')) +3365 self.assertEqual( +3366 _str('<a>Søk på nettet</a>').encode('ASCII', 'xmlcharrefreplace'), +3367 data) +
3368 +
3369 - def test_encoding_tostring(self): +
3370 Element = self.etree.Element +3371 tostring = self.etree.tostring +3372 +3373 a = Element('a') +3374 a.text = _str('Søk på nettet') +3375 self.assertEqual(_str('<a>Søk på nettet</a>').encode('UTF-8'), +3376 tostring(a, encoding='utf-8')) +
3377 +
3379 Element = self.etree.Element +3380 tostring = self.etree.tostring +3381 +3382 a = Element('a') +3383 a.text = _str('Søk på nettet') +3384 self.assertRaises(LookupError, tostring, a, +3385 encoding='Invalid Encoding') +
3386 +
3387 - def test_encoding_tostring_sub(self): +
3388 Element = self.etree.Element +3389 SubElement = self.etree.SubElement +3390 tostring = self.etree.tostring +3391 +3392 a = Element('a') +3393 b = SubElement(a, 'b') +3394 b.text = _str('Søk på nettet') +3395 self.assertEqual(_str('<b>Søk på nettet</b>').encode('UTF-8'), +3396 tostring(b, encoding='utf-8')) +
3397 +
3399 Element = self.etree.Element +3400 SubElement = self.etree.SubElement +3401 tostring = self.etree.tostring +3402 +3403 a = Element('a') +3404 b = SubElement(a, 'b') +3405 b.text = _str('Søk på nettet') +3406 b.tail = _str('Søk') +3407 self.assertEqual(_str('<b>Søk på nettet</b>Søk').encode('UTF-8'), +3408 tostring(b, encoding='utf-8')) +
3409 +
3411 Element = self.etree.Element +3412 SubElement = self.etree.SubElement +3413 tostring = self.etree.tostring +3414 +3415 a = Element('a') +3416 a.text = _str('Søk på nettet') +3417 +3418 expected = _bytes('<a>S&#248;k p&#229; nettet</a>') +3419 self.assertEqual( +3420 expected, +3421 tostring(a)) +
3422 +
3424 Element = self.etree.Element +3425 SubElement = self.etree.SubElement +3426 tostring = self.etree.tostring +3427 +3428 a = Element('a') +3429 b = SubElement(a, 'b') +3430 b.text = _str('Søk på nettet') +3431 +3432 expected = _bytes('<b>S&#248;k p&#229; nettet</b>') +3433 self.assertEqual( +3434 expected, +3435 tostring(b)) +
3436 +
3437 - def test_encoding_8bit_xml(self): +
3438 utext = _str('Søk på nettet') +3439 uxml = _str('<p>%s</p>') % utext +3440 prologue = _bytes('<?xml version="1.0" encoding="iso-8859-1" ?>') +3441 isoxml = prologue + uxml.encode('iso-8859-1') +3442 tree = self.etree.XML(isoxml) +3443 self.assertEqual(utext, tree.text) +
3444 +
3445 - def test_encoding_utf8_bom(self): +
3446 utext = _str('Søk på nettet') +3447 uxml = (_str('<?xml version="1.0" encoding="UTF-8"?>') + +3448 _str('<p>%s</p>') % utext) +3449 bom = _bytes('\\xEF\\xBB\\xBF').decode("unicode_escape").encode("latin1") +3450 xml = bom + uxml.encode("utf-8") +3451 tree = etree.XML(xml) +3452 self.assertEqual(utext, tree.text) +
3453 +
3455 utext = _str('Søk på nettet') +3456 uxml = _str('<p>%s</p>') % utext +3457 prologue = _bytes('<?xml version="1.0" encoding="iso-8859-1" ?>') +3458 isoxml = prologue + uxml.encode('iso-8859-1') +3459 el = self.etree.parse(BytesIO(isoxml)).getroot() +3460 self.assertEqual(utext, el.text) +
3461 +
3462 - def test_deepcopy_elementtree(self): +
3463 Element = self.etree.Element +3464 ElementTree = self.etree.ElementTree +3465 +3466 a = Element('a') +3467 a.text = "Foo" +3468 atree = ElementTree(a) +3469 +3470 btree = copy.deepcopy(atree) +3471 self.assertEqual("Foo", atree.getroot().text) +3472 self.assertEqual("Foo", btree.getroot().text) +3473 self.assertFalse(btree is atree) +3474 self.assertFalse(btree.getroot() is atree.getroot()) +
3475 +
3476 - def test_deepcopy(self): +
3477 Element = self.etree.Element +3478 +3479 a = Element('a') +3480 a.text = 'Foo' +3481 +3482 b = copy.deepcopy(a) +3483 self.assertEqual('Foo', b.text) +3484 +3485 b.text = 'Bar' +3486 self.assertEqual('Bar', b.text) +3487 self.assertEqual('Foo', a.text) +3488 +3489 del a +3490 self.assertEqual('Bar', b.text) +
3491 +
3492 - def test_deepcopy_tail(self): +
3493 Element = self.etree.Element +3494 +3495 a = Element('a') +3496 a.tail = 'Foo' +3497 +3498 b = copy.deepcopy(a) +3499 self.assertEqual('Foo', b.tail) +3500 +3501 b.tail = 'Bar' +3502 self.assertEqual('Bar', b.tail) +3503 self.assertEqual('Foo', a.tail) +3504 +3505 del a +3506 self.assertEqual('Bar', b.tail) +
3507 +
3508 - def test_deepcopy_subelement(self): +
3509 Element = self.etree.Element +3510 SubElement = self.etree.SubElement +3511 +3512 root = Element('root') +3513 a = SubElement(root, 'a') +3514 a.text = 'FooText' +3515 a.tail = 'FooTail' +3516 +3517 b = copy.deepcopy(a) +3518 self.assertEqual('FooText', b.text) +3519 self.assertEqual('FooTail', b.tail) +3520 +3521 b.text = 'BarText' +3522 b.tail = 'BarTail' +3523 self.assertEqual('BarTail', b.tail) +3524 self.assertEqual('FooTail', a.tail) +3525 self.assertEqual('BarText', b.text) +3526 self.assertEqual('FooText', a.text) +3527 +3528 del a +3529 self.assertEqual('BarTail', b.tail) +3530 self.assertEqual('BarText', b.text) +
3531 +
3532 - def test_deepcopy_namespaces(self): +
3533 root = self.etree.XML(_bytes('''<doc xmlns="dns" xmlns:t="tns"> +3534 <parent><node t:foo="bar" /></parent> +3535 </doc>''')) +3536 self.assertEqual( +3537 root[0][0].get('{tns}foo'), +3538 copy.deepcopy(root[0])[0].get('{tns}foo') ) +3539 self.assertEqual( +3540 root[0][0].get('{tns}foo'), +3541 copy.deepcopy(root[0][0]).get('{tns}foo') ) +
3542 +
3543 - def test_deepcopy_append(self): +
3544 # previously caused a crash +3545 Element = self.etree.Element +3546 tostring = self.etree.tostring +3547 +3548 a = Element('a') +3549 b = copy.deepcopy(a) +3550 a.append( Element('C') ) +3551 b.append( Element('X') ) +3552 +3553 self.assertEqual(_bytes('<a><C/></a>'), +3554 tostring(a).replace(_bytes(' '), _bytes(''))) +3555 self.assertEqual(_bytes('<a><X/></a>'), +3556 tostring(b).replace(_bytes(' '), _bytes(''))) +
3557 +
3558 - def test_deepcopy_comment(self): +
3559 # previously caused a crash +3560 # not supported by ET < 1.3! +3561 Comment = self.etree.Comment +3562 +3563 a = Comment("ONE") +3564 b = copy.deepcopy(a) +3565 b.text = "ANOTHER" +3566 +3567 self.assertEqual('ONE', a.text) +3568 self.assertEqual('ANOTHER', b.text) +
3569 +
3570 - def test_shallowcopy(self): +
3571 Element = self.etree.Element +3572 +3573 a = Element('a') +3574 a.text = 'Foo' +3575 +3576 b = copy.copy(a) +3577 self.assertEqual('Foo', b.text) +3578 +3579 b.text = 'Bar' +3580 self.assertEqual('Bar', b.text) +3581 self.assertEqual('Foo', a.text) +
3582 # XXX ElementTree will share nodes, but lxml.etree won't.. +3583 +
3585 Element = self.etree.Element +3586 ElementTree = self.etree.ElementTree +3587 +3588 a = Element('a') +3589 a.text = 'Foo' +3590 atree = ElementTree(a) +3591 +3592 btree = copy.copy(atree) +3593 self.assertFalse(btree is atree) +3594 self.assertTrue(btree.getroot() is atree.getroot()) +3595 self.assertEqual('Foo', atree.getroot().text) +
3596 +
3597 - def _test_element_boolean(self): +
3598 # deprecated as of ET 1.3/lxml 2.0 +3599 etree = self.etree +3600 e = etree.Element('foo') +3601 self.assertEqual(False, bool(e)) +3602 etree.SubElement(e, 'bar') +3603 self.assertEqual(True, bool(e)) +3604 e = etree.Element('foo') +3605 e.text = 'hey' +3606 self.assertEqual(False, bool(e)) +3607 e = etree.Element('foo') +3608 e.tail = 'bar' +3609 self.assertEqual(False, bool(e)) +3610 e = etree.Element('foo') +3611 e.set('bar', 'Bar') +3612 self.assertEqual(False, bool(e)) +
3613 +
3614 - def test_multiple_elementrees(self): +
3615 etree = self.etree +3616 +3617 a = etree.Element('a') +3618 b = etree.SubElement(a, 'b') +3619 +3620 t = etree.ElementTree(a) +3621 self.assertEqual(self._rootstring(t), _bytes('<a><b/></a>')) +3622 +3623 t1 = etree.ElementTree(a) +3624 self.assertEqual(self._rootstring(t1), _bytes('<a><b/></a>')) +3625 self.assertEqual(self._rootstring(t), _bytes('<a><b/></a>')) +3626 +3627 t2 = etree.ElementTree(b) +3628 self.assertEqual(self._rootstring(t2), _bytes('<b/>')) +3629 self.assertEqual(self._rootstring(t1), _bytes('<a><b/></a>')) +3630 self.assertEqual(self._rootstring(t), _bytes('<a><b/></a>')) +
3631 +
3632 - def test_qname(self): +
3633 etree = self.etree +3634 qname = etree.QName('myns', 'a') +3635 a1 = etree.Element(qname) +3636 a2 = etree.SubElement(a1, qname) +3637 self.assertEqual(a1.tag, "{myns}a") +3638 self.assertEqual(a2.tag, "{myns}a") +
3639 +
3640 - def test_qname_cmp(self): +
3641 etree = self.etree +3642 qname1 = etree.QName('myns', 'a') +3643 qname2 = etree.QName('myns', 'a') +3644 self.assertEqual(qname1, "{myns}a") +3645 self.assertEqual("{myns}a", qname2) +3646 self.assertEqual(qname1, qname1) +3647 self.assertEqual(qname1, qname2) +
3648 +
3649 - def test_qname_attribute_getset(self): +
3650 etree = self.etree +3651 qname = etree.QName('myns', 'a') +3652 +3653 a = etree.Element(qname) +3654 a.set(qname, "value") +3655 +3656 self.assertEqual(a.get(qname), "value") +3657 self.assertEqual(a.get("{myns}a"), "value") +
3658 +
3659 - def test_qname_attrib(self): +
3660 etree = self.etree +3661 qname = etree.QName('myns', 'a') +3662 +3663 a = etree.Element(qname) +3664 a.attrib[qname] = "value" +3665 +3666 self.assertEqual(a.attrib[qname], "value") +3667 self.assertEqual(a.attrib.get(qname), "value") +3668 +3669 self.assertEqual(a.attrib["{myns}a"], "value") +3670 self.assertEqual(a.attrib.get("{myns}a"), "value") +
3671 +
3673 etree = self.etree +3674 qname = etree.QName('http://myns', 'a') +3675 a = etree.Element(qname) +3676 a.set(qname, qname) +3677 +3678 self.assertXML( +3679 _bytes('<ns0:a xmlns:ns0="http://myns" ns0:a="ns0:a"></ns0:a>'), +3680 a) +
3681 +
3683 etree = self.etree +3684 qname = etree.QName('http://myns', 'a') +3685 a = etree.Element('a') +3686 a.set('a', qname) +3687 +3688 self.assertXML( +3689 _bytes('<a xmlns:ns0="http://myns" a="ns0:a"></a>'), +3690 a) +
3691 +
3692 - def test_qname_attrib_resolve(self): +
3693 etree = self.etree +3694 qname = etree.QName('http://myns', 'a') +3695 a = etree.Element(qname) +3696 a.attrib[qname] = qname +3697 +3698 self.assertXML( +3699 _bytes('<ns0:a xmlns:ns0="http://myns" ns0:a="ns0:a"></ns0:a>'), +3700 a) +
3701 +
3702 - def test_parser_version(self): +
3703 etree = self.etree +3704 parser = etree.XMLParser() +3705 if hasattr(parser, "version"): +3706 # ElementTree 1.3+, cET +3707 self.assertTrue(re.match("[^ ]+ [0-9.]+", parser.version)) +
3708 +3709 # feed parser interface +3710 +
3711 - def test_feed_parser_bytes(self): +
3712 parser = self.XMLParser() +3713 +3714 parser.feed(_bytes('<?xml version=')) +3715 parser.feed(_bytes('"1.0"?><ro')) +3716 parser.feed(_bytes('ot><')) +3717 parser.feed(_bytes('a test="works"/')) +3718 parser.feed(_bytes('></root')) +3719 parser.feed(_bytes('>')) +3720 +3721 root = parser.close() +3722 +3723 self.assertEqual(root.tag, "root") +3724 self.assertEqual(root[0].tag, "a") +3725 self.assertEqual(root[0].get("test"), "works") +
3726 +
3727 - def test_feed_parser_unicode(self): +
3728 parser = self.XMLParser() +3729 +3730 parser.feed(_str('<ro')) +3731 parser.feed(_str('ot><')) +3732 parser.feed(_str('a test="works"/')) +3733 parser.feed(_str('></root')) +3734 parser.feed(_str('>')) +3735 +3736 root = parser.close() +3737 +3738 self.assertEqual(root.tag, "root") +3739 self.assertEqual(root[0].tag, "a") +3740 self.assertEqual(root[0].get("test"), "works") +
3741 +3742 required_versions_ET['test_feed_parser_error_close_empty'] = (1,3) +
3744 ParseError = self.etree.ParseError +3745 parser = self.XMLParser() +3746 self.assertRaises(ParseError, parser.close) +
3747 +3748 required_versions_ET['test_feed_parser_error_close_incomplete'] = (1,3) +
3750 ParseError = self.etree.ParseError +3751 parser = self.XMLParser() +3752 +3753 parser.feed('<?xml version=') +3754 parser.feed('"1.0"?><ro') +3755 +3756 self.assertRaises(ParseError, parser.close) +
3757 +3758 required_versions_ET['test_feed_parser_error_broken'] = (1,3) +
3760 ParseError = self.etree.ParseError +3761 parser = self.XMLParser() +3762 +3763 parser.feed('<?xml version=') +3764 parser.feed('"1.0"?><ro') +3765 try: +3766 parser.feed('<><><><><><><') +3767 except ParseError: +3768 # can raise, but not required before close() +3769 pass +3770 +3771 self.assertRaises(ParseError, parser.close) +
3772 +3773 required_versions_ET['test_feed_parser_error_position'] = (1,3) +
3775 ParseError = self.etree.ParseError +3776 parser = self.XMLParser() +3777 try: +3778 parser.close() +3779 except ParseError: +3780 e = sys.exc_info()[1] +3781 self.assertNotEqual(None, e.code) +3782 self.assertNotEqual(0, e.code) +3783 self.assertTrue(isinstance(e.position, tuple)) +3784 self.assertTrue(e.position >= (0, 0)) +
3785 +3786 # parser target interface +3787 +3788 required_versions_ET['test_parser_target_property'] = (1,3) +
3789 - def test_parser_target_property(self): +
3790 class Target(object): +3791 pass +
3792 +3793 target = Target() +3794 parser = self.XMLParser(target=target) +3795 +3796 self.assertEqual(target, parser.target) +3797 +
3798 - def test_parser_target_tag(self): +
3799 assertEqual = self.assertEqual +3800 assertFalse = self.assertFalse +3801 +3802 events = [] +3803 class Target(object): +3804 def start(self, tag, attrib): +3805 events.append("start") +3806 assertFalse(attrib) +3807 assertEqual("TAG", tag) +
3808 def end(self, tag): +3809 events.append("end") +3810 assertEqual("TAG", tag) +3811 def close(self): +3812 return "DONE" +3813 +3814 parser = self.XMLParser(target=Target()) +3815 +3816 parser.feed("<TAG/>") +3817 done = parser.close() +3818 +3819 self.assertEqual("DONE", done) +3820 self.assertEqual(["start", "end"], events) +3821 +
3823 assertEqual = self.assertEqual +3824 +3825 events = [] +3826 class Target(object): +3827 def start(self, tag, attrib): +3828 events.append("start") +3829 assertEqual("TAG", tag) +3830 raise ValueError("TEST") +
3831 def end(self, tag): +3832 events.append("end") +3833 assertEqual("TAG", tag) +3834 def close(self): +3835 return "DONE" +3836 +3837 parser = self.XMLParser(target=Target()) +3838 +3839 try: +3840 parser.feed("<TAG/>") +3841 except ValueError: +3842 self.assertTrue('TEST' in str(sys.exc_info()[1])) +3843 else: +3844 self.assertTrue(False) +3845 if 'lxml' in self.etree.__name__: +3846 self.assertEqual(["start"], events) +3847 else: +3848 # cElementTree calls end() as well +3849 self.assertTrue("start" in events) +3850 +
3852 assertEqual = self.assertEqual +3853 +3854 events = [] +3855 class Target(object): +3856 def start(self, tag, attrib): +3857 events.append("start") +3858 assertEqual("TAG", tag) +
3859 def end(self, tag): +3860 events.append("end") +3861 assertEqual("TAG", tag) +3862 raise ValueError("TEST") +3863 def close(self): +3864 return "DONE" +3865 +3866 parser = self.XMLParser(target=Target()) +3867 +3868 try: +3869 parser.feed("<TAG/>") +3870 except ValueError: +3871 self.assertTrue('TEST' in str(sys.exc_info()[1])) +3872 else: +3873 self.assertTrue(False) +3874 self.assertEqual(["start", "end"], events) +3875 +
3877 assertEqual = self.assertEqual +3878 +3879 events = [] +3880 class Target(object): +3881 def start(self, tag, attrib): +3882 events.append("start") +3883 assertEqual("TAG", tag) +
3884 def end(self, tag): +3885 events.append("end") +3886 assertEqual("TAG", tag) +3887 def close(self): +3888 raise ValueError("TEST") +3889 +3890 parser = self.XMLParser(target=Target()) +3891 +3892 try: +3893 parser.feed("<TAG/>") +3894 parser.close() +3895 except ValueError: +3896 self.assertTrue('TEST' in str(sys.exc_info()[1])) +3897 else: +3898 self.assertTrue(False) +3899 self.assertEqual(["start", "end"], events) +3900 +
3902 assertEqual = self.assertEqual +3903 +3904 events = [] +3905 class Target(object): +3906 def start(self, tag, attrib): +3907 events.append("start") +3908 assertEqual("TAG", tag) +3909 raise IndexError("TEST-IE") +
3910 def end(self, tag): +3911 events.append("end") +3912 assertEqual("TAG", tag) +3913 def close(self): +3914 raise ValueError("TEST-VE") +3915 +3916 parser = self.XMLParser(target=Target()) +3917 +3918 try: +3919 parser.feed("<TAG/>") +3920 parser.close() +3921 except IndexError: +3922 if 'lxml' in self.etree.__name__: +3923 # we try not to swallow the initial exception in Py2 +3924 self.assertTrue(sys.version_info[0] < 3) +3925 self.assertTrue('TEST-IE' in str(sys.exc_info()[1])) +3926 except ValueError: +3927 if 'lxml' in self.etree.__name__: +3928 self.assertTrue(sys.version_info[0] >= 3) +3929 self.assertTrue('TEST-VE' in str(sys.exc_info()[1])) +3930 else: +3931 self.assertTrue(False) +3932 +3933 if 'lxml' in self.etree.__name__: +3934 self.assertEqual(["start"], events) +3935 else: +3936 # cElementTree calls end() as well +3937 self.assertTrue("start" in events) +3938 +
3940 assertEqual = self.assertEqual +3941 assertFalse = self.assertFalse +3942 Element = self.etree.Element +3943 +3944 events = [] +3945 class Target(object): +3946 def start(self, tag, attrib): +3947 events.append("start") +3948 assertFalse(attrib) +3949 assertEqual("TAG", tag) +
3950 def end(self, tag): +3951 events.append("end") +3952 assertEqual("TAG", tag) +3953 def close(self): +3954 return Element("DONE") +3955 +3956 parser = self.XMLParser(target=Target()) +3957 tree = self.etree.ElementTree() +3958 tree.parse(BytesIO("<TAG/>"), parser=parser) +3959 +3960 self.assertEqual("DONE", tree.getroot().tag) +3961 self.assertEqual(["start", "end"], events) +3962 +
3963 - def test_parser_target_attrib(self): +
3964 assertEqual = self.assertEqual +3965 +3966 events = [] +3967 class Target(object): +3968 def start(self, tag, attrib): +3969 events.append("start-" + tag) +3970 for name, value in attrib.items(): +3971 assertEqual(tag + name, value) +
3972 def end(self, tag): +3973 events.append("end-" + tag) +3974 def close(self): +3975 return "DONE" +3976 +3977 parser = self.XMLParser(target=Target()) +3978 +3979 parser.feed('<root a="roota" b="rootb"><sub c="subc"/></root>') +3980 done = parser.close() +3981 +3982 self.assertEqual("DONE", done) +3983 self.assertEqual(["start-root", "start-sub", "end-sub", "end-root"], +3984 events) +3985 +
3986 - def test_parser_target_data(self): +
3987 events = [] +3988 class Target(object): +3989 def start(self, tag, attrib): +3990 events.append("start-" + tag) +
3991 def end(self, tag): +3992 events.append("end-" + tag) +3993 def data(self, data): +3994 events.append("data-" + data) +3995 def close(self): +3996 return "DONE" +3997 +3998 parser = self.XMLParser(target=Target()) +3999 +4000 parser.feed('<root>A<sub/>B</root>') +4001 done = parser.close() +4002 +4003 self.assertEqual("DONE", done) +4004 self.assertEqual(["start-root", "data-A", "start-sub", +4005 "end-sub", "data-B", "end-root"], +4006 events) +4007 +
4008 - def test_parser_target_entity(self): +
4009 events = [] +4010 class Target(object): +4011 def __init__(self): +4012 self._data = [] +
4013 def _flush_data(self): +4014 if self._data: +4015 events.append("data-" + ''.join(self._data)) +4016 del self._data[:] +4017 def start(self, tag, attrib): +4018 self._flush_data() +4019 events.append("start-" + tag) +4020 def end(self, tag): +4021 self._flush_data() +4022 events.append("end-" + tag) +4023 def data(self, data): +4024 self._data.append(data) +4025 def close(self): +4026 self._flush_data() +4027 return "DONE" +4028 +4029 parser = self.XMLParser(target=Target()) +4030 +4031 dtd = ''' +4032 <!DOCTYPE root [ +4033 <!ELEMENT root (sub*)> +4034 <!ELEMENT sub (#PCDATA)> +4035 <!ENTITY ent "an entity"> +4036 ]> +4037 ''' +4038 parser.feed(dtd+'<root><sub/><sub>this is &ent;</sub><sub/></root>') +4039 done = parser.close() +4040 +4041 self.assertEqual("DONE", done) +4042 self.assertEqual(["start-root", "start-sub", "end-sub", "start-sub", +4043 "data-this is an entity", +4044 "end-sub", "start-sub", "end-sub", "end-root"], +4045 events) +4046 +4047 required_versions_ET['test_parser_target_entity_unknown'] = (1,3) +
4049 events = [] +4050 class Target(object): +4051 def __init__(self): +4052 self._data = [] +
4053 def _flush_data(self): +4054 if self._data: +4055 events.append("data-" + ''.join(self._data)) +4056 del self._data[:] +4057 def start(self, tag, attrib): +4058 self._flush_data() +4059 events.append("start-" + tag) +4060 def end(self, tag): +4061 self._flush_data() +4062 events.append("end-" + tag) +4063 def data(self, data): +4064 self._data.append(data) +4065 def close(self): +4066 self._flush_data() +4067 return "DONE" +4068 +4069 parser = self.XMLParser(target=Target()) +4070 +4071 def feed(): +4072 parser.feed('<root><sub/><sub>some &ent;</sub><sub/></root>') +4073 parser.close() +4074 +4075 self.assertRaises(self.etree.ParseError, feed) +4076 +4077 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4079 class Builder(list): +4080 def start(self, tag, attrib): +4081 self.append(("start", tag)) +
4082 def end(self, tag): +4083 self.append(("end", tag)) +4084 def data(self, text): +4085 pass +4086 def pi(self, target, data): +4087 self.append(("pi", target, data)) +4088 def comment(self, data): +4089 self.append(("comment", data)) +4090 def start_ns(self, prefix, uri): +4091 self.append(("start-ns", prefix, uri)) +4092 def end_ns(self, prefix): +4093 self.append(("end-ns", prefix)) +4094 +4095 builder = Builder() +4096 parser = self.etree.XMLParser(target=builder) +4097 parser.feed(textwrap.dedent("""\ +4098 <?pi data?> +4099 <!-- comment --> +4100 <root xmlns='namespace'> +4101 <element key='value'>text</element> +4102 <element>text</element>tail +4103 <empty-element/> +4104 </root> +4105 """)) +4106 self.assertEqual(builder, [ +4107 ('pi', 'pi', 'data'), +4108 ('comment', ' comment '), +4109 ('start-ns', '', 'namespace'), +4110 ('start', '{namespace}root'), +4111 ('start', '{namespace}element'), +4112 ('end', '{namespace}element'), +4113 ('start', '{namespace}element'), +4114 ('end', '{namespace}element'), +4115 ('start', '{namespace}empty-element'), +4116 ('end', '{namespace}empty-element'), +4117 ('end', '{namespace}root'), +4118 ('end-ns', ''), +4119 ]) +4120 +4121 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4122 - def test_parser_target_end_ns(self): +
4123 class Builder(list): +4124 def end_ns(self, prefix): +4125 self.append(("end-ns", prefix)) +
4126 +4127 builder = Builder() +4128 parser = self.etree.XMLParser(target=builder) +4129 parser.feed(textwrap.dedent("""\ +4130 <?pi data?> +4131 <!-- comment --> +4132 <root xmlns='namespace' xmlns:p='pns'> +4133 <element key='value'>text</element> +4134 <p:element>text</p:element>tail +4135 <empty-element/> +4136 </root> +4137 """)) +4138 self.assertEqual(builder, [ +4139 ('end-ns', 'p'), +4140 ('end-ns', ''), +4141 ]) +4142 +
4143 - def test_treebuilder(self): +
4144 builder = self.etree.TreeBuilder() +4145 el = builder.start("root", {'a':'A', 'b':'B'}) +4146 self.assertEqual("root", el.tag) +4147 self.assertEqual({'a':'A', 'b':'B'}, el.attrib) +4148 builder.data("ROOTTEXT") +4149 el = builder.start("child", {'x':'X', 'y':'Y'}) +4150 self.assertEqual("child", el.tag) +4151 self.assertEqual({'x':'X', 'y':'Y'}, el.attrib) +4152 builder.data("CHILDTEXT") +4153 el = builder.end("child") +4154 self.assertEqual("child", el.tag) +4155 self.assertEqual({'x':'X', 'y':'Y'}, el.attrib) +4156 self.assertEqual("CHILDTEXT", el.text) +4157 self.assertEqual(None, el.tail) +4158 builder.data("CHILDTAIL") +4159 root = builder.end("root") +4160 +4161 self.assertEqual("root", root.tag) +4162 self.assertEqual("ROOTTEXT", root.text) +4163 self.assertEqual("CHILDTEXT", root[0].text) +4164 self.assertEqual("CHILDTAIL", root[0].tail) +
4165 +
4166 - def test_treebuilder_target(self): +
4167 parser = self.XMLParser(target=self.etree.TreeBuilder()) +4168 parser.feed('<root>ROOTTEXT<child>CHILDTEXT</child>CHILDTAIL</root>') +4169 root = parser.close() +4170 +4171 self.assertEqual("root", root.tag) +4172 self.assertEqual("ROOTTEXT", root.text) +4173 self.assertEqual("CHILDTEXT", root[0].text) +4174 self.assertEqual("CHILDTAIL", root[0].tail) +
4175 +4176 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4177 - def test_treebuilder_comment(self): +
4178 ET = self.etree +4179 b = ET.TreeBuilder() +4180 self.assertEqual(b.comment('ctext').tag, ET.Comment) +4181 self.assertEqual(b.comment('ctext').text, 'ctext') +4182 +4183 b = ET.TreeBuilder(comment_factory=ET.Comment) +4184 self.assertEqual(b.comment('ctext').tag, ET.Comment) +4185 self.assertEqual(b.comment('ctext').text, 'ctext') +
4186 +4187 #b = ET.TreeBuilder(comment_factory=len) +4188 #self.assertEqual(b.comment('ctext'), len('ctext')) +4189 +4190 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4191 - def test_treebuilder_pi(self): +
4192 ET = self.etree +4193 is_lxml = ET.__name__ == 'lxml.etree' +4194 +4195 b = ET.TreeBuilder() +4196 self.assertEqual(b.pi('target', None).tag, ET.PI) +4197 if is_lxml: +4198 self.assertEqual(b.pi('target', None).target, 'target') +4199 else: +4200 self.assertEqual(b.pi('target', None).text, 'target') +4201 +4202 b = ET.TreeBuilder(pi_factory=ET.PI) +4203 self.assertEqual(b.pi('target').tag, ET.PI) +4204 if is_lxml: +4205 self.assertEqual(b.pi('target').target, "target") +4206 else: +4207 self.assertEqual(b.pi('target').text, "target") +4208 self.assertEqual(b.pi('pitarget', ' text ').tag, ET.PI) +4209 if is_lxml: +4210 self.assertEqual(b.pi('pitarget', ' text ').target, "pitarget") +4211 self.assertEqual(b.pi('pitarget', ' text ').text, " text ") +4212 else: +4213 self.assertEqual(b.pi('pitarget', ' text ').text, "pitarget text ") +
4214 +4215 #b = ET.TreeBuilder(pi_factory=lambda target, text: (len(target), text)) +4216 #self.assertEqual(b.pi('target'), (len('target'), None)) +4217 #self.assertEqual(b.pi('pitarget', ' text '), (len('pitarget'), ' text ')) +4218 +
4219 - def test_late_tail(self): +
4220 # Issue #37399: The tail of an ignored comment could overwrite the text before it. +4221 ET = self.etree +4222 class TreeBuilderSubclass(ET.TreeBuilder): +4223 pass +
4224 +4225 if ET.__name__ == 'lxml.etree': +4226 def assert_content(a): +4227 self.assertEqual(a.text, "text") +4228 self.assertEqual(a[0].tail, "tail") +4229 else: +4230 def assert_content(a): +4231 self.assertEqual(a.text, "texttail") +4232 +4233 xml = "<a>text<!-- comment -->tail</a>" +4234 a = ET.fromstring(xml) +4235 assert_content(a) +4236 +4237 parser = ET.XMLParser(target=TreeBuilderSubclass()) +4238 parser.feed(xml) +4239 a = parser.close() +4240 assert_content(a) +4241 +4242 xml = "<a>text<?pi data?>tail</a>" +4243 a = ET.fromstring(xml) +4244 assert_content(a) +4245 +4246 xml = "<a>text<?pi data?>tail</a>" +4247 parser = ET.XMLParser(target=TreeBuilderSubclass()) +4248 parser.feed(xml) +4249 a = parser.close() +4250 assert_content(a) +4251 +4252 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4254 # Issue #37399: The tail of an ignored comment could overwrite the text before it. +4255 # Test appending tails to comments/pis. +4256 ET = self.etree +4257 class TreeBuilderSubclass(ET.TreeBuilder): +4258 pass +
4259 +4260 xml = "<a>text<?pi1?> <!-- comment -->\n<?pi2?>tail</a>" +4261 parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=True, insert_pis=False)) +4262 parser.feed(xml) +4263 a = parser.close() +4264 self.assertEqual(a[0].text, ' comment ') +4265 self.assertEqual(a[0].tail, '\ntail') +4266 self.assertEqual(a.text, "text ") +4267 +4268 parser = ET.XMLParser(target=TreeBuilderSubclass(insert_comments=True, insert_pis=False)) +4269 parser.feed(xml) +4270 a = parser.close() +4271 self.assertEqual(a[0].text, ' comment ') +4272 self.assertEqual(a[0].tail, '\ntail') +4273 self.assertEqual(a.text, "text ") +4274 +4275 xml = "<a>text<!-- comment -->\n<?pi data?>tail</a>" +4276 parser = ET.XMLParser(target=ET.TreeBuilder(insert_pis=True, insert_comments=False)) +4277 parser.feed(xml) +4278 a = parser.close() +4279 self.assertEqual(a[0].text[-4:], 'data') +4280 self.assertEqual(a[0].tail, 'tail') +4281 self.assertEqual(a.text, "text\n") +4282 +4283 parser = ET.XMLParser(target=TreeBuilderSubclass(insert_pis=True, insert_comments=False)) +4284 parser.feed(xml) +4285 a = parser.close() +4286 self.assertEqual(a[0].text[-4:], 'data') +4287 self.assertEqual(a[0].tail, 'tail') +4288 self.assertEqual(a.text, "text\n") +4289 +4290 # helper methods +4291 +
4292 - def _writeElement(self, element, encoding='us-ascii'): +
4293 """Write out element for comparison. +4294 """ +4295 data = self.etree.tostring(element, encoding=encoding) +4296 return canonicalize(data) +
4297 +
4298 - def _writeElementFile(self, element, encoding='us-ascii'): +
4299 """Write out element for comparison, using real file. +4300 """ +4301 ElementTree = self.etree.ElementTree +4302 with tmpfile() as filename: +4303 with open(filename, 'wb') as f: +4304 tree = ElementTree(element=element) +4305 tree.write(f, encoding=encoding) +4306 with open(filename, 'rb') as f: +4307 data = f.read() +4308 return canonicalize(data) +
4309 +
4310 - def assertXML(self, expected, element, encoding='us-ascii'): +
4311 """Writes element out and checks whether it is expected. +4312 +4313 Does this two ways; once using BytesIO, once using a real file. +4314 """ +4315 if isinstance(expected, unicode): +4316 expected = expected.encode(encoding) +4317 self.assertEqual(expected, self._writeElement(element, encoding)) +4318 self.assertEqual(expected, self._writeElementFile(element, encoding)) +
4319 +
4320 - def assertEncodingDeclaration(self, result, encoding): +
4321 "Checks if the result XML byte string specifies the encoding." +4322 enc_re = r"<\?xml[^>]+ encoding=[\"']([^\"']+)[\"']" +4323 if isinstance(result, str): +4324 has_encoding = re.compile(enc_re).match +4325 else: +4326 has_encoding = re.compile(_bytes(enc_re)).match +4327 self.assertTrue(has_encoding(result)) +4328 result_encoding = has_encoding(result).group(1) +4329 self.assertEqual(result_encoding.upper(), encoding.upper()) +
4330 +
4331 - def _rootstring(self, tree): +
4332 return self.etree.tostring(tree.getroot()).replace( +4333 _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) +
4334 +
4335 - def _check_element_tree(self, tree): +
4336 self._check_element(tree.getroot()) +
4337 +
4338 - def _check_element(self, element): +
4339 self.assertTrue(hasattr(element, 'tag')) +4340 self.assertTrue(hasattr(element, 'attrib')) +4341 self.assertTrue(hasattr(element, 'text')) +4342 self.assertTrue(hasattr(element, 'tail')) +4343 self._check_string(element.tag) +4344 self._check_mapping(element.attrib) +4345 if element.text is not None: +4346 self._check_string(element.text) +4347 if element.tail is not None: +4348 self._check_string(element.tail) +
4349 +
4350 - def _check_string(self, string): +
4351 len(string) +4352 for char in string: +4353 self.assertEqual(1, len(char)) +4354 new_string = string + "" +4355 new_string = string + " " +4356 string[:0] +
4357 +
4358 - def _check_mapping(self, mapping): +
4359 len(mapping) +4360 keys = mapping.keys() +4361 values = mapping.values() +4362 items = mapping.items() +4363 for key in keys: +4364 item = mapping[key] +4365 mapping["key"] = "value" +4366 self.assertEqual("value", mapping["key"]) +
4367 +
4368 +4369 -class _ElementSlicingTest(unittest.TestCase): +
4370 etree = None +4371 +
4372 - def _elem_tags(self, elemlist): +
4373 return [e.tag for e in elemlist] +
4374 +
4375 - def _subelem_tags(self, elem): +
4376 return self._elem_tags(list(elem)) +
4377 +
4378 - def _make_elem_with_children(self, numchildren): +
4379 """Create an Element with a tag 'a', with the given amount of children +4380 named 'a0', 'a1' ... and so on. +4381 +4382 """ +4383 e = self.etree.Element('a') +4384 for i in range(numchildren): +4385 self.etree.SubElement(e, 'a%s' % i) +4386 return e +
4387 +
4388 - def test_getslice_single_index(self): +
4389 e = self._make_elem_with_children(10) +4390 +4391 self.assertEqual(e[1].tag, 'a1') +4392 self.assertEqual(e[-2].tag, 'a8') +4393 +4394 self.assertRaises(IndexError, lambda: e[12]) +4395 self.assertRaises(IndexError, lambda: e[-12]) +
4396 +
4397 - def test_getslice_range(self): +
4398 e = self._make_elem_with_children(6) +4399 +4400 self.assertEqual(self._elem_tags(e[3:]), ['a3', 'a4', 'a5']) +4401 self.assertEqual(self._elem_tags(e[3:6]), ['a3', 'a4', 'a5']) +4402 self.assertEqual(self._elem_tags(e[3:16]), ['a3', 'a4', 'a5']) +4403 self.assertEqual(self._elem_tags(e[3:5]), ['a3', 'a4']) +4404 self.assertEqual(self._elem_tags(e[3:-1]), ['a3', 'a4']) +4405 self.assertEqual(self._elem_tags(e[:2]), ['a0', 'a1']) +
4406 +
4407 - def test_getslice_steps(self): +
4408 e = self._make_elem_with_children(10) +4409 +4410 self.assertEqual(self._elem_tags(e[8:10:1]), ['a8', 'a9']) +4411 self.assertEqual(self._elem_tags(e[::3]), ['a0', 'a3', 'a6', 'a9']) +4412 self.assertEqual(self._elem_tags(e[::8]), ['a0', 'a8']) +4413 self.assertEqual(self._elem_tags(e[1::8]), ['a1', 'a9']) +4414 self.assertEqual(self._elem_tags(e[3::sys.maxsize]), ['a3']) +4415 self.assertEqual(self._elem_tags(e[3::sys.maxsize<<64]), ['a3']) +
4416 +
4418 e = self._make_elem_with_children(4) +4419 +4420 self.assertEqual(self._elem_tags(e[::-1]), ['a3', 'a2', 'a1', 'a0']) +4421 self.assertEqual(self._elem_tags(e[::-2]), ['a3', 'a1']) +4422 self.assertEqual(self._elem_tags(e[3::-sys.maxsize]), ['a3']) +4423 self.assertEqual(self._elem_tags(e[3::-sys.maxsize-1]), ['a3']) +4424 self.assertEqual(self._elem_tags(e[3::-sys.maxsize<<64]), ['a3']) +
4425 +
4426 - def test_delslice(self): +
4427 e = self._make_elem_with_children(4) +4428 del e[0:2] +4429 self.assertEqual(self._subelem_tags(e), ['a2', 'a3']) +4430 +4431 e = self._make_elem_with_children(4) +4432 del e[0:] +4433 self.assertEqual(self._subelem_tags(e), []) +4434 +4435 e = self._make_elem_with_children(4) +4436 del e[::-1] +4437 self.assertEqual(self._subelem_tags(e), []) +4438 +4439 e = self._make_elem_with_children(4) +4440 del e[::-2] +4441 self.assertEqual(self._subelem_tags(e), ['a0', 'a2']) +4442 +4443 e = self._make_elem_with_children(4) +4444 del e[1::2] +4445 self.assertEqual(self._subelem_tags(e), ['a0', 'a2']) +4446 +4447 e = self._make_elem_with_children(2) +4448 del e[::2] +4449 self.assertEqual(self._subelem_tags(e), ['a1']) +
4450 +
4451 - def test_setslice_single_index(self): +
4452 e = self._make_elem_with_children(4) +4453 e[1] = self.etree.Element('b') +4454 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'a2', 'a3']) +4455 +4456 e[-2] = self.etree.Element('c') +4457 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'c', 'a3']) +4458 +4459 with self.assertRaises(IndexError): +4460 e[5] = self.etree.Element('d') +4461 with self.assertRaises(IndexError): +4462 e[-5] = self.etree.Element('d') +4463 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'c', 'a3']) +
4464 +
4465 - def test_setslice_range(self): +
4466 e = self._make_elem_with_children(4) +4467 e[1:3] = [self.etree.Element('b%s' % i) for i in range(2)] +4468 self.assertEqual(self._subelem_tags(e), ['a0', 'b0', 'b1', 'a3']) +4469 +4470 e = self._make_elem_with_children(4) +4471 e[1:3] = [self.etree.Element('b')] +4472 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'a3']) +4473 +4474 e = self._make_elem_with_children(4) +4475 e[1:3] = [self.etree.Element('b%s' % i) for i in range(3)] +4476 self.assertEqual(self._subelem_tags(e), ['a0', 'b0', 'b1', 'b2', 'a3']) +
4477 +
4478 - def test_setslice_steps(self): +
4479 e = self._make_elem_with_children(6) +4480 e[1:5:2] = [self.etree.Element('b%s' % i) for i in range(2)] +4481 self.assertEqual(self._subelem_tags(e), ['a0', 'b0', 'a2', 'b1', 'a4', 'a5']) +4482 +4483 e = self._make_elem_with_children(6) +4484 with self.assertRaises(ValueError): +4485 e[1:5:2] = [self.etree.Element('b')] +4486 with self.assertRaises(ValueError): +4487 e[1:5:2] = [self.etree.Element('b%s' % i) for i in range(3)] +4488 with self.assertRaises(ValueError): +4489 e[1:5:2] = [] +4490 self.assertEqual(self._subelem_tags(e), ['a0', 'a1', 'a2', 'a3', 'a4', 'a5']) +4491 +4492 e = self._make_elem_with_children(4) +4493 e[1::sys.maxsize] = [self.etree.Element('b')] +4494 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'a2', 'a3']) +4495 e[1::sys.maxsize<<64] = [self.etree.Element('c')] +4496 self.assertEqual(self._subelem_tags(e), ['a0', 'c', 'a2', 'a3']) +
4497 +
4499 e = self._make_elem_with_children(4) +4500 e[2:0:-1] = [self.etree.Element('b%s' % i) for i in range(2)] +4501 self.assertEqual(self._subelem_tags(e), ['a0', 'b1', 'b0', 'a3']) +4502 +4503 e = self._make_elem_with_children(4) +4504 with self.assertRaises(ValueError): +4505 e[2:0:-1] = [self.etree.Element('b')] +4506 with self.assertRaises(ValueError): +4507 e[2:0:-1] = [self.etree.Element('b%s' % i) for i in range(3)] +4508 with self.assertRaises(ValueError): +4509 e[2:0:-1] = [] +4510 self.assertEqual(self._subelem_tags(e), ['a0', 'a1', 'a2', 'a3']) +4511 +4512 e = self._make_elem_with_children(4) +4513 e[1::-sys.maxsize] = [self.etree.Element('b')] +4514 self.assertEqual(self._subelem_tags(e), ['a0', 'b', 'a2', 'a3']) +4515 e[1::-sys.maxsize-1] = [self.etree.Element('c')] +4516 self.assertEqual(self._subelem_tags(e), ['a0', 'c', 'a2', 'a3']) +4517 e[1::-sys.maxsize<<64] = [self.etree.Element('d')] +4518 self.assertEqual(self._subelem_tags(e), ['a0', 'd', 'a2', 'a3']) +
4519 +
4520 +4521 -class _XMLPullParserTest(unittest.TestCase): +
4522 etree = None +4523 +
4524 - def _close_and_return_root(self, parser): +
4525 if 'ElementTree' in self.etree.__name__: +4526 # ElementTree's API is a bit unwieldy in Py3.4 +4527 root = parser._close_and_return_root() +4528 else: +4529 root = parser.close() +4530 return root +
4531 +
4532 - def _feed(self, parser, data, chunk_size=None): +
4533 if chunk_size is None: +4534 parser.feed(data) +4535 else: +4536 for i in range(0, len(data), chunk_size): +4537 parser.feed(data[i:i+chunk_size]) +
4538 +
4539 - def assert_events(self, parser, expected, max_events=None): +
4540 self.assertEqual( +4541 [(event, (elem.tag, elem.text)) +4542 for event, elem in islice(parser.read_events(), max_events)], +4543 expected) +
4544 +
4545 - def assert_event_tuples(self, parser, expected, max_events=None): +
4546 self.assertEqual( +4547 list(islice(parser.read_events(), max_events)), +4548 expected) +
4549 +
4550 - def assert_event_tags(self, parser, expected, max_events=None): +
4551 events = islice(parser.read_events(), max_events) +4552 self.assertEqual([(action, elem.tag) for action, elem in events], +4553 expected) +
4554 +
4555 - def test_simple_xml(self): +
4556 for chunk_size in (None, 1, 5): +4557 #with self.subTest(chunk_size=chunk_size): +4558 parser = self.etree.XMLPullParser() +4559 self.assert_event_tags(parser, []) +4560 self._feed(parser, "<!-- comment -->\n", chunk_size) +4561 self.assert_event_tags(parser, []) +4562 self._feed(parser, +4563 "<root>\n <element key='value'>text</element", +4564 chunk_size) +4565 self.assert_event_tags(parser, []) +4566 self._feed(parser, ">\n", chunk_size) +4567 self.assert_event_tags(parser, [('end', 'element')]) +4568 self._feed(parser, "<element>text</element>tail\n", chunk_size) +4569 self._feed(parser, "<empty-element/>\n", chunk_size) +4570 self.assert_event_tags(parser, [ +4571 ('end', 'element'), +4572 ('end', 'empty-element'), +4573 ]) +4574 self._feed(parser, "</root>\n", chunk_size) +4575 self.assert_event_tags(parser, [('end', 'root')]) +4576 root = self._close_and_return_root(parser) +4577 self.assertEqual(root.tag, 'root') +
4578 +
4579 - def test_feed_while_iterating(self): +
4580 parser = self.etree.XMLPullParser() +4581 it = parser.read_events() +4582 self._feed(parser, "<root>\n <element key='value'>text</element>\n") +4583 action, elem = next(it) +4584 self.assertEqual((action, elem.tag), ('end', 'element')) +4585 self._feed(parser, "</root>\n") +4586 action, elem = next(it) +4587 self.assertEqual((action, elem.tag), ('end', 'root')) +4588 with self.assertRaises(StopIteration): +4589 next(it) +
4590 +
4591 - def test_simple_xml_with_ns(self): +
4592 parser = self.etree.XMLPullParser() +4593 self.assert_event_tags(parser, []) +4594 self._feed(parser, "<!-- comment -->\n") +4595 self.assert_event_tags(parser, []) +4596 self._feed(parser, "<root xmlns='namespace'>\n") +4597 self.assert_event_tags(parser, []) +4598 self._feed(parser, "<element key='value'>text</element") +4599 self.assert_event_tags(parser, []) +4600 self._feed(parser, ">\n") +4601 self.assert_event_tags(parser, [('end', '{namespace}element')]) +4602 self._feed(parser, "<element>text</element>tail\n") +4603 self._feed(parser, "<empty-element/>\n") +4604 self.assert_event_tags(parser, [ +4605 ('end', '{namespace}element'), +4606 ('end', '{namespace}empty-element'), +4607 ]) +4608 self._feed(parser, "</root>\n") +4609 self.assert_event_tags(parser, [('end', '{namespace}root')]) +4610 root = self._close_and_return_root(parser) +4611 self.assertEqual(root.tag, '{namespace}root') +
4612 +
4613 - def test_ns_events(self): +
4614 parser = self.etree.XMLPullParser(events=('start-ns', 'end-ns')) +4615 self._feed(parser, "<!-- comment -->\n") +4616 self._feed(parser, "<root xmlns='namespace'>\n") +4617 self.assertEqual( +4618 list(parser.read_events()), +4619 [('start-ns', ('', 'namespace'))]) +4620 self._feed(parser, "<element key='value'>text</element") +4621 self._feed(parser, ">\n") +4622 self._feed(parser, "<element>text</element>tail\n") +4623 self._feed(parser, "<empty-element/>\n") +4624 self._feed(parser, "</root>\n") +4625 self.assertEqual(list(parser.read_events()), [('end-ns', None)]) +4626 parser.close() +
4627 +
4628 - def test_ns_events_end_ns_only(self): +
4629 parser = self.etree.XMLPullParser(events=['end-ns']) +4630 self._feed(parser, "<!-- comment -->\n") +4631 self._feed(parser, "<root xmlns='namespace' xmlns:a='abc' xmlns:b='xyz'>\n") +4632 self.assertEqual(list(parser.read_events()), []) +4633 self._feed(parser, "<a:element key='value'>text</a:element") +4634 self._feed(parser, ">\n") +4635 self._feed(parser, "<b:element>text</b:element>tail\n") +4636 self._feed(parser, "<empty-element/>\n") +4637 self.assertEqual(list(parser.read_events()), []) +4638 self._feed(parser, "</root>\n") +4639 self.assertEqual(list(parser.read_events()), [ +4640 ('end-ns', None), +4641 ('end-ns', None), +4642 ('end-ns', None), +4643 ]) +4644 parser.close() +
4645 +4646 @et_needs_pyversion(3,8) +
4647 - def test_ns_events_start(self): +
4648 parser = self.etree.XMLPullParser(events=('start-ns', 'start', 'end')) +4649 self._feed(parser, "<tag xmlns='abc' xmlns:p='xyz'>\n") +4650 self.assert_event_tuples(parser, [ +4651 ('start-ns', ('', 'abc')), +4652 ('start-ns', ('p', 'xyz')), +4653 ], max_events=2) +4654 self.assert_event_tags(parser, [ +4655 ('start', '{abc}tag'), +4656 ], max_events=1) +4657 +4658 self._feed(parser, "<child />\n") +4659 self.assert_event_tags(parser, [ +4660 ('start', '{abc}child'), +4661 ('end', '{abc}child'), +4662 ]) +4663 +4664 self._feed(parser, "</tag>\n") +4665 parser.close() +4666 self.assert_event_tags(parser, [ +4667 ('end', '{abc}tag'), +4668 ]) +
4669 +4670 @et_needs_pyversion(3,8) +
4671 - def test_ns_events_start_end(self): +
4672 parser = self.etree.XMLPullParser(events=('start-ns', 'start', 'end', 'end-ns')) +4673 self._feed(parser, "<tag xmlns='abc' xmlns:p='xyz'>\n") +4674 self.assert_event_tuples(parser, [ +4675 ('start-ns', ('', 'abc')), +4676 ('start-ns', ('p', 'xyz')), +4677 ], max_events=2) +4678 self.assert_event_tags(parser, [ +4679 ('start', '{abc}tag'), +4680 ], max_events=1) +4681 +4682 self._feed(parser, "<child />\n") +4683 self.assert_event_tags(parser, [ +4684 ('start', '{abc}child'), +4685 ('end', '{abc}child'), +4686 ]) +4687 +4688 self._feed(parser, "</tag>\n") +4689 parser.close() +4690 self.assert_event_tags(parser, [ +4691 ('end', '{abc}tag'), +4692 ], max_events=1) +4693 self.assert_event_tuples(parser, [ +4694 ('end-ns', None), +4695 ('end-ns', None), +4696 ]) +
4697 +
4698 - def test_events(self): +
4699 parser = self.etree.XMLPullParser(events=()) +4700 self._feed(parser, "<root/>\n") +4701 self.assert_event_tags(parser, []) +4702 +4703 parser = self.etree.XMLPullParser(events=('start', 'end')) +4704 self._feed(parser, "<!-- text here -->\n") +4705 self.assert_events(parser, []) +4706 +4707 parser = self.etree.XMLPullParser(events=('start', 'end')) +4708 self._feed(parser, "<root>\n") +4709 self.assert_event_tags(parser, [('start', 'root')]) +4710 self._feed(parser, "<element key='value'>text</element") +4711 self.assert_event_tags(parser, [('start', 'element')]) +4712 self._feed(parser, ">\n") +4713 self.assert_event_tags(parser, [('end', 'element')]) +4714 self._feed(parser, +4715 "<element xmlns='foo'>text<empty-element/></element>tail\n") +4716 self.assert_event_tags(parser, [ +4717 ('start', '{foo}element'), +4718 ('start', '{foo}empty-element'), +4719 ('end', '{foo}empty-element'), +4720 ('end', '{foo}element'), +4721 ]) +4722 self._feed(parser, "</root>") +4723 root = self._close_and_return_root(parser) +4724 self.assert_event_tags(parser, [('end', 'root')]) +4725 self.assertEqual(root.tag, 'root') +4726 +4727 parser = self.etree.XMLPullParser(events=('start',)) +4728 self._feed(parser, "<!-- comment -->\n") +4729 self.assert_event_tags(parser, []) +4730 self._feed(parser, "<root>\n") +4731 self.assert_event_tags(parser, [('start', 'root')]) +4732 self._feed(parser, "<element key='value'>text</element") +4733 self.assert_event_tags(parser, [('start', 'element')]) +4734 self._feed(parser, ">\n") +4735 self.assert_event_tags(parser, []) +4736 self._feed(parser, +4737 "<element xmlns='foo'>text<empty-element/></element>tail\n") +4738 self.assert_event_tags(parser, [ +4739 ('start', '{foo}element'), +4740 ('start', '{foo}empty-element'), +4741 ]) +4742 self._feed(parser, "</root>") +4743 root = self._close_and_return_root(parser) +4744 self.assertEqual(root.tag, 'root') +
4745 +4746 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4747 - def test_events_comment(self): +
4748 parser = self.etree.XMLPullParser(events=('start', 'comment', 'end')) +4749 self._feed(parser, "<!-- text here -->\n") +4750 self.assert_events(parser, [('comment', (self.etree.Comment, ' text here '))]) +4751 self._feed(parser, "<!-- more text here -->\n") +4752 self.assert_events(parser, [('comment', (self.etree.Comment, ' more text here '))]) +4753 self._feed(parser, "<root-tag>text") +4754 self.assert_event_tags(parser, [('start', 'root-tag')]) +4755 self._feed(parser, "<!-- inner comment-->\n") +4756 self.assert_events(parser, [('comment', (self.etree.Comment, ' inner comment'))]) +4757 self._feed(parser, "</root-tag>\n") +4758 self.assert_event_tags(parser, [('end', 'root-tag')]) +4759 self._feed(parser, "<!-- outer comment -->\n") +4760 self.assert_events(parser, [('comment', (self.etree.Comment, ' outer comment '))]) +4761 +4762 parser = self.etree.XMLPullParser(events=('comment',)) +4763 self._feed(parser, "<!-- text here -->\n") +4764 self.assert_events(parser, [('comment', (self.etree.Comment, ' text here '))]) +
4765 +4766 @et_needs_pyversion(3, 8, 0, 'alpha', 4) +
4767 - def test_events_pi(self): +
4768 # Note: lxml's PIs have target+text, ET's PIs have both in "text" +4769 parser = self.etree.XMLPullParser(events=('start', 'pi', 'end')) +4770 self._feed(parser, "<?pitarget?>\n") +4771 self.assert_event_tags(parser, [('pi', self.etree.PI)]) +4772 parser = self.etree.XMLPullParser(events=('pi',)) +4773 self._feed(parser, "<?pitarget some text ?>\n") +4774 self.assert_event_tags(parser, [('pi', self.etree.PI)]) +
4775 +
4776 - def test_events_sequence(self): +
4777 # Test that events can be some sequence that's not just a tuple or list +4778 eventset = {'end', 'start'} +4779 parser = self.etree.XMLPullParser(events=eventset) +4780 self._feed(parser, "<foo>bar</foo>") +4781 self.assert_event_tags(parser, [('start', 'foo'), ('end', 'foo')]) +4782 +4783 class DummyIter(object): +4784 def __init__(self): +4785 self.events = iter(['start', 'end', 'start-ns']) +
4786 def __iter__(self): +4787 return self +
4788 def __next__(self): +4789 return next(self.events) +4790 def next(self): +4791 return next(self.events) +4792 +4793 parser = self.etree.XMLPullParser(events=DummyIter()) +4794 self._feed(parser, "<foo>bar</foo>") +4795 self.assert_event_tags(parser, [('start', 'foo'), ('end', 'foo')]) +4796 +
4797 - def test_unknown_event(self): +
4798 with self.assertRaises(ValueError): +4799 self.etree.XMLPullParser(events=('start', 'end', 'bogus')) +
4800 +
4801 +4802 -class _C14NTest(unittest.TestCase): +
4803 etree = None +4804 maxDiff = None +4805 +4806 if not hasattr(unittest.TestCase, 'subTest'): +4807 @contextmanager +
4808 - def subTest(self, name, **kwargs): +
4809 try: +4810 yield +4811 except unittest.SkipTest: +4812 raise +4813 except Exception as e: +4814 print("Subtest {} failed: {}".format(name, e)) +4815 raise +
4816 +
4817 - def _canonicalize(self, input_file, **options): +
4818 return self.etree.canonicalize(from_file=input_file, **options) +
4819 +4820 # +4821 # simple roundtrip tests (from c14n.py) +4822 +
4823 - def c14n_roundtrip(self, xml, **options): +
4824 return self.etree.canonicalize(xml, **options) +
4825 +
4826 - def test_simple_roundtrip(self): +
4827 c14n_roundtrip = self.c14n_roundtrip +4828 # Basics +4829 self.assertEqual(c14n_roundtrip("<doc/>"), '<doc></doc>') +4830 self.assertEqual(c14n_roundtrip("<doc xmlns='uri'/>"), # FIXME +4831 '<doc xmlns="uri"></doc>') +4832 self.assertEqual(c14n_roundtrip("<prefix:doc xmlns:prefix='uri'/>"), +4833 '<prefix:doc xmlns:prefix="uri"></prefix:doc>') +4834 self.assertEqual(c14n_roundtrip("<doc xmlns:prefix='uri'><prefix:bar/></doc>"), +4835 '<doc><prefix:bar xmlns:prefix="uri"></prefix:bar></doc>') +4836 self.assertEqual(c14n_roundtrip("<elem xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' />"), +4837 '<elem></elem>') +4838 +4839 # C14N spec +4840 self.assertEqual(c14n_roundtrip("<doc>Hello, world!<!-- Comment 1 --></doc>"), +4841 '<doc>Hello, world!</doc>') +4842 self.assertEqual(c14n_roundtrip("<value>&#x32;</value>"), +4843 '<value>2</value>') +4844 self.assertEqual(c14n_roundtrip('<compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>'), +4845 '<compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>') +4846 self.assertEqual(c14n_roundtrip('''<compute expr='value>"0" &amp;&amp; value&lt;"10" ?"valid":"error"'>valid</compute>'''), +4847 '<compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>') +4848 self.assertEqual(c14n_roundtrip("<norm attr=' &apos; &#x20;&#13;&#xa;&#9; &apos; '/>"), +4849 '<norm attr=" \' &#xD;&#xA;&#x9; \' "></norm>') +4850 self.assertEqual(c14n_roundtrip("<normNames attr=' A &#x20;&#13;&#xa;&#9; B '/>"), +4851 '<normNames attr=" A &#xD;&#xA;&#x9; B "></normNames>') +4852 self.assertEqual(c14n_roundtrip("<normId id=' &apos; &#x20;&#13;&#xa;&#9; &apos; '/>"), +4853 '<normId id=" \' &#xD;&#xA;&#x9; \' "></normId>') +
4854 +4855 # fragments from PJ's tests +4856 #self.assertEqual(c14n_roundtrip("<doc xmlns:x='http://example.com/x' xmlns='http://example.com/default'><b y:a1='1' xmlns='http://example.com/default' a3='3' xmlns:y='http://example.com/y' y:a2='2'/></doc>"), +4857 #'<doc xmlns:x="http://example.com/x"><b xmlns:y="http://example.com/y" a3="3" y:a1="1" y:a2="2"></b></doc>') +4858 +
4859 - def test_c14n_exclusion(self): +
4860 c14n_roundtrip = self.c14n_roundtrip +4861 xml = textwrap.dedent("""\ +4862 <root xmlns:x="http://example.com/x"> +4863 <a x:attr="attrx"> +4864 <b>abtext</b> +4865 </a> +4866 <b>btext</b> +4867 <c> +4868 <x:d>dtext</x:d> +4869 </c> +4870 </root> +4871 """) +4872 self.assertEqual( +4873 c14n_roundtrip(xml, strip_text=True), +4874 '<root>' +4875 '<a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a>' +4876 '<b>btext</b>' +4877 '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>' +4878 '</root>') +4879 self.assertEqual( +4880 c14n_roundtrip(xml, strip_text=True, exclude_attrs=['{http://example.com/x}attr']), +4881 '<root>' +4882 '<a><b>abtext</b></a>' +4883 '<b>btext</b>' +4884 '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>' +4885 '</root>') +4886 self.assertEqual( +4887 c14n_roundtrip(xml, strip_text=True, exclude_tags=['{http://example.com/x}d']), +4888 '<root>' +4889 '<a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a>' +4890 '<b>btext</b>' +4891 '<c></c>' +4892 '</root>') +4893 self.assertEqual( +4894 c14n_roundtrip(xml, strip_text=True, exclude_attrs=['{http://example.com/x}attr'], +4895 exclude_tags=['{http://example.com/x}d']), +4896 '<root>' +4897 '<a><b>abtext</b></a>' +4898 '<b>btext</b>' +4899 '<c></c>' +4900 '</root>') +4901 self.assertEqual( +4902 c14n_roundtrip(xml, strip_text=True, exclude_tags=['a', 'b']), +4903 '<root>' +4904 '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>' +4905 '</root>') +4906 self.assertEqual( +4907 c14n_roundtrip(xml, exclude_tags=['a', 'b']), +4908 '<root>\n' +4909 ' \n' +4910 ' \n' +4911 ' <c>\n' +4912 ' <x:d xmlns:x="http://example.com/x">dtext</x:d>\n' +4913 ' </c>\n' +4914 '</root>') +4915 self.assertEqual( +4916 c14n_roundtrip(xml, strip_text=True, exclude_tags=['{http://example.com/x}d', 'b']), +4917 '<root>' +4918 '<a xmlns:x="http://example.com/x" x:attr="attrx"></a>' +4919 '<c></c>' +4920 '</root>') +4921 self.assertEqual( +4922 c14n_roundtrip(xml, exclude_tags=['{http://example.com/x}d', 'b']), +4923 '<root>\n' +4924 ' <a xmlns:x="http://example.com/x" x:attr="attrx">\n' +4925 ' \n' +4926 ' </a>\n' +4927 ' \n' +4928 ' <c>\n' +4929 ' \n' +4930 ' </c>\n' +4931 '</root>') +
4932 +4933 # +4934 # basic method=c14n tests from the c14n 2.0 specification. uses +4935 # test files under xmltestdata/c14n-20. +4936 +4937 # note that this uses generated C14N versions of the standard ET.write +4938 # output, not roundtripped C14N (see above). +4939 +
4940 - def test_xml_c14n2(self): +
4941 datadir = os.path.join(os.path.dirname(__file__), "c14n-20") +4942 full_path = partial(os.path.join, datadir) +4943 +4944 files = [filename[:-4] for filename in sorted(os.listdir(datadir)) +4945 if filename.endswith('.xml')] +4946 input_files = [ +4947 filename for filename in files +4948 if filename.startswith('in') +4949 ] +4950 configs = { +4951 filename: { +4952 # <c14n2:PrefixRewrite>sequential</c14n2:PrefixRewrite> +4953 option.tag.split('}')[-1]: ((option.text or '').strip(), option) +4954 for option in self.etree.parse(full_path(filename) + ".xml").getroot() +4955 } +4956 for filename in files +4957 if filename.startswith('c14n') +4958 } +4959 +4960 tests = { +4961 input_file: [ +4962 (filename, configs[filename.rsplit('_', 1)[-1]]) +4963 for filename in files +4964 if filename.startswith('out_%s_' % input_file) +4965 and filename.rsplit('_', 1)[-1] in configs +4966 ] +4967 for input_file in input_files +4968 } +4969 +4970 # Make sure we found all test cases. +4971 self.assertEqual(30, len([ +4972 output_file for output_files in tests.values() +4973 for output_file in output_files])) +4974 +4975 def get_option(config, option_name, default=None): +4976 return config.get(option_name, (default, ()))[0] +
4977 +4978 for input_file, output_files in tests.items(): +4979 for output_file, config in output_files: +4980 keep_comments = get_option( +4981 config, 'IgnoreComments') == 'true' # no, it's right :) +4982 strip_text = get_option( +4983 config, 'TrimTextNodes') == 'true' +4984 rewrite_prefixes = get_option( +4985 config, 'PrefixRewrite') == 'sequential' +4986 if 'QNameAware' in config: +4987 qattrs = [ +4988 "{%s}%s" % (el.get('NS'), el.get('Name')) +4989 for el in config['QNameAware'][1].findall( +4990 '{http://www.w3.org/2010/xml-c14n2}QualifiedAttr') +4991 ] +4992 qtags = [ +4993 "{%s}%s" % (el.get('NS'), el.get('Name')) +4994 for el in config['QNameAware'][1].findall( +4995 '{http://www.w3.org/2010/xml-c14n2}Element') +4996 ] +4997 else: +4998 qtags = qattrs = None +4999 +5000 # Build subtest description from config. +5001 config_descr = ','.join( +5002 "%s=%s" % (name, value or ','.join(c.tag.split('}')[-1] for c in children)) +5003 for name, (value, children) in sorted(config.items()) +5004 ) +5005 +5006 with self.subTest("{}({})".format(output_file, config_descr)): +5007 if input_file == 'inNsRedecl' and not rewrite_prefixes: +5008 self.skipTest( +5009 "Redeclared namespace handling is not supported in {}".format( +5010 output_file)) +5011 if input_file == 'inNsSuperfluous' and not rewrite_prefixes: +5012 self.skipTest( +5013 "Redeclared namespace handling is not supported in {}".format( +5014 output_file)) +5015 if 'QNameAware' in config and config['QNameAware'][1].find( +5016 '{http://www.w3.org/2010/xml-c14n2}XPathElement') is not None: +5017 self.skipTest( +5018 "QName rewriting in XPath text is not supported in {}".format( +5019 output_file)) +5020 +5021 f = full_path(input_file + ".xml") +5022 if input_file == 'inC14N5': +5023 # Hack: avoid setting up external entity resolution in the parser. +5024 with open(full_path('world.txt'), 'rb') as entity_file: +5025 with open(f, 'rb') as f: +5026 f = io.BytesIO(f.read().replace(b'&ent2;', entity_file.read().strip())) +5027 +5028 text = self._canonicalize( +5029 f, +5030 with_comments=keep_comments, +5031 strip_text=strip_text, +5032 rewrite_prefixes=rewrite_prefixes, +5033 qname_aware_tags=qtags, qname_aware_attrs=qattrs) +5034 +5035 with io.open(full_path(output_file + ".xml"), 'r', encoding='utf8') as f: +5036 expected = f.read() +5037 if input_file == 'inC14N3' and self.etree is not etree: +5038 # FIXME: cET resolves default attributes but ET does not! +5039 expected = expected.replace(' attr="default"', '') +5040 text = text.replace(' attr="default"', '') +5041 self.assertEqual(expected, text) +
5042 +5043 +5044 if etree: +
5045 - class ETreeTestCase(_ETreeTestCaseBase): +
5046 etree = etree +
5047 +
5048 - class ETreePullTestCase(_XMLPullParserTest): +
5049 etree = etree +
5050 +
5051 - class ETreeElementSlicingTest(_ElementSlicingTest): +
5052 etree = etree +
5053 +
5054 - class ETreeC14NTest(_C14NTest): +
5055 etree = etree +
5056 +
5057 - class ETreeC14N2WriteTest(ETreeC14NTest): +
5058 - def _canonicalize(self, input_file, with_comments=True, strip_text=False, +5059 rewrite_prefixes=False, qname_aware_tags=None, qname_aware_attrs=None, +5060 **options): +
5061 if rewrite_prefixes or qname_aware_attrs or qname_aware_tags: +5062 self.skipTest("C14N 2.0 feature not supported with ElementTree.write()") +5063 +5064 parser = self.etree.XMLParser(attribute_defaults=True, collect_ids=False) +5065 tree = self.etree.parse(input_file, parser) +5066 out = io.BytesIO() +5067 tree.write( +5068 out, method='c14n2', +5069 with_comments=with_comments, strip_text=strip_text, +5070 **options) +5071 return out.getvalue().decode('utf8') +
5072 +
5073 - class ETreeC14N2TostringTest(ETreeC14NTest): +
5074 - def _canonicalize(self, input_file, with_comments=True, strip_text=False, +5075 rewrite_prefixes=False, qname_aware_tags=None, qname_aware_attrs=None, +5076 **options): +
5077 if rewrite_prefixes or qname_aware_attrs or qname_aware_tags: +5078 self.skipTest("C14N 2.0 feature not supported with ElementTree.tostring()") +5079 +5080 parser = self.etree.XMLParser(attribute_defaults=True, collect_ids=False) +5081 tree = self.etree.parse(input_file, parser) +5082 return self.etree.tostring( +5083 tree, method='c14n2', +5084 with_comments=with_comments, strip_text=strip_text, +5085 **options).decode('utf8') +
5086 +5087 +5088 if ElementTree: +
5089 - class ElementTreeTestCase(_ETreeTestCaseBase): +
5090 etree = ElementTree +5091 +5092 @classmethod +
5093 - def setUpClass(cls): +
5094 import warnings +5095 # ElementTree warns about getiterator() in recent Pythons +5096 warnings.filterwarnings( +5097 'ignore', +5098 r'This method will be removed.*\.iter\(\).*instead', +5099 PendingDeprecationWarning) +
5100 +5101 filter_by_version( +5102 ElementTreeTestCase, +5103 ElementTreeTestCase.required_versions_ET, ET_VERSION) +5104 +5105 if hasattr(ElementTree, 'XMLPullParser'): +
5106 - class ElementTreePullTestCase(_XMLPullParserTest): +
5108 else: +5109 ElementTreePullTestCase = None +5110 +5111 if hasattr(ElementTree, 'canonicalize'): +
5112 - class ElementTreeC14NTest(_C14NTest): +
5114 else: +5115 ElementTreeC14NTest = None +
5116 +5117 - class ElementTreeElementSlicingTest(_ElementSlicingTest): +
5119 +5120 +5121 if cElementTree: +
5122 - class CElementTreeTestCase(_ETreeTestCaseBase): +
5124 +5125 filter_by_version( +5126 CElementTreeTestCase, +5127 CElementTreeTestCase.required_versions_cET, CET_VERSION) +
5128 +5129 - class CElementTreeElementSlicingTest(_ElementSlicingTest): +
5131 +
5132 +5133 -def test_suite(): +
5134 suite = unittest.TestSuite() +5135 if etree: +5136 suite.addTests([unittest.makeSuite(ETreeTestCase)]) +5137 suite.addTests([unittest.makeSuite(ETreePullTestCase)]) +5138 suite.addTests([unittest.makeSuite(ETreeElementSlicingTest)]) +5139 suite.addTests([unittest.makeSuite(ETreeC14NTest)]) +5140 suite.addTests([unittest.makeSuite(ETreeC14N2WriteTest)]) +5141 suite.addTests([unittest.makeSuite(ETreeC14N2TostringTest)]) +5142 if ElementTree: +5143 suite.addTests([unittest.makeSuite(ElementTreeTestCase)]) +5144 if ElementTreePullTestCase: +5145 suite.addTests([unittest.makeSuite(ElementTreePullTestCase)]) +5146 if ElementTreeC14NTest: +5147 suite.addTests([unittest.makeSuite(ElementTreeC14NTest)]) +5148 suite.addTests([unittest.makeSuite(ElementTreeElementSlicingTest)]) +5149 if cElementTree: +5150 suite.addTests([unittest.makeSuite(CElementTreeTestCase)]) +5151 suite.addTests([unittest.makeSuite(CElementTreeElementSlicingTest)]) +5152 return suite +
5153 +5154 if __name__ == '__main__': +5155 print('to test use test.py %s' % __file__) +5156 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html b/doc/html/api/lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html new file mode 100644 index 00000000..99cbfdd5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html @@ -0,0 +1,363 @@ + + + + + lxml.tests.test_elementtree.CElementTreeElementSlicingTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class CElementTreeElementSlicingTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CElementTreeElementSlicingTest

source code

+
+            object --+        
+                     |        
+unittest.case.TestCase --+    
+                         |    
+       _ElementSlicingTest --+
+                             |
+                            CElementTreeElementSlicingTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ElementSlicingTest: + test_delslice, + test_getslice_negative_steps, + test_getslice_range, + test_getslice_single_index, + test_getslice_steps, + test_setslice_negative_steps, + test_setslice_range, + test_setslice_single_index, + test_setslice_steps +

+ +

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..16f3534e --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.CElementTreeTestCase-class.html @@ -0,0 +1,653 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+               _ETreeTestCaseBase --+
+                                    |
+                                   CElementTreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ETreeTestCaseBase: + XMLParser, + assertEncodingDeclaration, + assertRegex, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib, + test_attrib_as_attrib, + test_attrib_clear, + test_attrib_copy, + test_attrib_deepcopy, + test_attrib_dict, + test_attrib_get, + 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_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_namespace_roundtrip, + test_attribute_namespace_roundtrip_replaced, + test_attribute_set, + test_attribute_str, + test_attribute_update_attrib, + 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_get, + 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_extra, + test_element_with_attributes_extra_duplicate, + 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_bytes, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_feed_parser_unicode, + test_findall, + test_findall_ns, + test_findall_wildcard, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getchildren, + 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_name_interning, + test_insert_negative, + test_insert_tail, + test_interface, + test_iselement, + test_iter, + test_iter_remove_tail, + test_iteration, + test_iteration_clear_tail, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_set_tail_empty, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_incomplete, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_only_end_ns, + test_iterparse_set_ns_attribute, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_late_tail, + test_late_tail_mix_pi_comments, + 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_end_ns, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_error_in_close, + test_parser_target_error_in_end, + test_parser_target_error_in_start, + test_parser_target_error_in_start_and_close, + test_parser_target_property, + test_parser_target_start_end_ns, + 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_register_namespace, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_remove_while_iterating, + 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_end_exact, + 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_comment, + test_treebuilder_pi, + 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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+

Inherited from _ETreeTestCaseBase: + required_versions_ET, + required_versions_cET +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html new file mode 100644 index 00000000..ce89e848 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html @@ -0,0 +1,424 @@ + + + + + lxml.tests.test_elementtree.ETreeC14N2TostringTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeC14N2TostringTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeC14N2TostringTest

source code

+
+            object --+            
+                     |            
+unittest.case.TestCase --+        
+                         |        
+                 _C14NTest --+    
+                             |    
+                 ETreeC14NTest --+
+                                 |
+                                ETreeC14N2TostringTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_canonicalize(self, + input_file, + with_comments=True, + strip_text=False, + rewrite_prefixes=False, + qname_aware_tags=None, + qname_aware_attrs=None, + **options) + source code + +
+ +
+

Inherited from _C14NTest: + c14n_roundtrip, + subTest, + test_c14n_exclusion, + test_simple_roundtrip, + test_xml_c14n2 +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from ETreeC14NTest: + etree +

+

Inherited from _C14NTest: + maxDiff +

+

Inherited from unittest.case.TestCase: + longMessage +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

_canonicalize(self, + input_file, + with_comments=True, + strip_text=False, + rewrite_prefixes=False, + qname_aware_tags=None, + qname_aware_attrs=None, + **options) +

+
source code  +
+ + +
+
Overrides: + _C14NTest._canonicalize +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html new file mode 100644 index 00000000..7db9f487 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html @@ -0,0 +1,424 @@ + + + + + lxml.tests.test_elementtree.ETreeC14N2WriteTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeC14N2WriteTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeC14N2WriteTest

source code

+
+            object --+            
+                     |            
+unittest.case.TestCase --+        
+                         |        
+                 _C14NTest --+    
+                             |    
+                 ETreeC14NTest --+
+                                 |
+                                ETreeC14N2WriteTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_canonicalize(self, + input_file, + with_comments=True, + strip_text=False, + rewrite_prefixes=False, + qname_aware_tags=None, + qname_aware_attrs=None, + **options) + source code + +
+ +
+

Inherited from _C14NTest: + c14n_roundtrip, + subTest, + test_c14n_exclusion, + test_simple_roundtrip, + test_xml_c14n2 +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from ETreeC14NTest: + etree +

+

Inherited from _C14NTest: + maxDiff +

+

Inherited from unittest.case.TestCase: + longMessage +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

_canonicalize(self, + input_file, + with_comments=True, + strip_text=False, + rewrite_prefixes=False, + qname_aware_tags=None, + qname_aware_attrs=None, + **options) +

+
source code  +
+ + +
+
Overrides: + _C14NTest._canonicalize +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ETreeC14NTest-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeC14NTest-class.html new file mode 100644 index 00000000..a941203b --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeC14NTest-class.html @@ -0,0 +1,399 @@ + + + + + lxml.tests.test_elementtree.ETreeC14NTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeC14NTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeC14NTest

source code

+
+            object --+        
+                     |        
+unittest.case.TestCase --+    
+                         |    
+                 _C14NTest --+
+                             |
+                            ETreeC14NTest
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _C14NTest: + c14n_roundtrip, + subTest, + test_c14n_exclusion, + test_simple_roundtrip, + test_xml_c14n2 +

+

Inherited from _C14NTest (private): + _canonicalize +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from _C14NTest: + maxDiff +

+

Inherited from unittest.case.TestCase: + longMessage +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.ETreeElementSlicingTest-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeElementSlicingTest-class.html new file mode 100644 index 00000000..13b6bc79 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeElementSlicingTest-class.html @@ -0,0 +1,397 @@ + + + + + lxml.tests.test_elementtree.ETreeElementSlicingTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeElementSlicingTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeElementSlicingTest

source code

+
+            object --+        
+                     |        
+unittest.case.TestCase --+    
+                         |    
+       _ElementSlicingTest --+
+                             |
+                            ETreeElementSlicingTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ElementSlicingTest: + test_delslice, + test_getslice_negative_steps, + test_getslice_range, + test_getslice_single_index, + test_getslice_steps, + test_setslice_negative_steps, + test_setslice_range, + test_setslice_single_index, + test_setslice_steps +

+ +

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.ETreePullTestCase-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreePullTestCase-class.html new file mode 100644 index 00000000..6b0c678c --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreePullTestCase-class.html @@ -0,0 +1,402 @@ + + + + + lxml.tests.test_elementtree.ETreePullTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreePullTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreePullTestCase

source code

+
+            object --+        
+                     |        
+unittest.case.TestCase --+    
+                         |    
+        _XMLPullParserTest --+
+                             |
+                            ETreePullTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _XMLPullParserTest: + assert_event_tags, + assert_event_tuples, + assert_events, + test_events, + test_events_comment, + test_events_pi, + test_events_sequence, + test_feed_while_iterating, + test_ns_events, + test_ns_events_end_ns_only, + test_ns_events_start, + test_ns_events_start_end, + test_simple_xml, + test_simple_xml_with_ns, + test_unknown_event +

+

Inherited from _XMLPullParserTest (private): + _close_and_return_root, + _feed +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.ETreeTestCase-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html new file mode 100644 index 00000000..5b00cf59 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html @@ -0,0 +1,687 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+               _ETreeTestCaseBase --+
+                                    |
+                                   ETreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ETreeTestCaseBase: + XMLParser, + assertEncodingDeclaration, + assertRegex, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib, + test_attrib_as_attrib, + test_attrib_clear, + test_attrib_copy, + test_attrib_deepcopy, + test_attrib_dict, + test_attrib_get, + 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_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_namespace_roundtrip, + test_attribute_namespace_roundtrip_replaced, + test_attribute_set, + test_attribute_str, + test_attribute_update_attrib, + 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_get, + 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_extra, + test_element_with_attributes_extra_duplicate, + 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_bytes, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_feed_parser_unicode, + test_findall, + test_findall_ns, + test_findall_wildcard, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getchildren, + 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_name_interning, + test_insert_negative, + test_insert_tail, + test_interface, + test_iselement, + test_iter, + test_iter_remove_tail, + test_iteration, + test_iteration_clear_tail, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_set_tail_empty, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_incomplete, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_only_end_ns, + test_iterparse_set_ns_attribute, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_late_tail, + test_late_tail_mix_pi_comments, + 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_end_ns, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_error_in_close, + test_parser_target_error_in_end, + test_parser_target_error_in_start, + test_parser_target_error_in_start_and_close, + test_parser_target_property, + test_parser_target_start_end_ns, + 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_register_namespace, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_remove_while_iterating, + 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_end_exact, + 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_comment, + test_treebuilder_pi, + 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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from _ETreeTestCaseBase: + required_versions_ET, + required_versions_cET +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.ElementTreeElementSlicingTest-class.html b/doc/html/api/lxml.tests.test_elementtree.ElementTreeElementSlicingTest-class.html new file mode 100644 index 00000000..b62514a4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ElementTreeElementSlicingTest-class.html @@ -0,0 +1,397 @@ + + + + + lxml.tests.test_elementtree.ElementTreeElementSlicingTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ElementTreeElementSlicingTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTreeElementSlicingTest

source code

+
+            object --+        
+                     |        
+unittest.case.TestCase --+    
+                         |    
+       _ElementSlicingTest --+
+                             |
+                            ElementTreeElementSlicingTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ElementSlicingTest: + test_delslice, + test_getslice_negative_steps, + test_getslice_range, + test_getslice_single_index, + test_getslice_steps, + test_setslice_negative_steps, + test_setslice_range, + test_setslice_single_index, + test_setslice_steps +

+ +

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ hash(x) +
+
+
+
Value:
+
xml.etree.ElementTree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..fc4d1040 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ElementTreeTestCase-class.html @@ -0,0 +1,746 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+               _ETreeTestCaseBase --+
+                                    |
+                                   ElementTreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

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

Inherited from _ETreeTestCaseBase: + XMLParser, + assertEncodingDeclaration, + assertRegex, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib, + test_attrib_as_attrib, + test_attrib_clear, + test_attrib_copy, + test_attrib_deepcopy, + test_attrib_dict, + test_attrib_get, + 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_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_namespace_roundtrip, + test_attribute_namespace_roundtrip_replaced, + test_attribute_set, + test_attribute_str, + test_attribute_update_attrib, + 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_get, + 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_extra, + test_element_with_attributes_extra_duplicate, + 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_bytes, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_feed_parser_unicode, + test_findall, + test_findall_ns, + test_findall_wildcard, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getchildren, + 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_name_interning, + test_insert_negative, + test_insert_tail, + test_interface, + test_iselement, + test_iter, + test_iter_remove_tail, + test_iteration, + test_iteration_clear_tail, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_set_tail_empty, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_incomplete, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_only_end_ns, + test_iterparse_set_ns_attribute, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_late_tail, + test_late_tail_mix_pi_comments, + 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_end_ns, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_error_in_close, + test_parser_target_error_in_end, + test_parser_target_error_in_start, + test_parser_target_error_in_start_and_close, + test_parser_target_property, + test_parser_target_start_end_ns, + 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_register_namespace, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_remove_while_iterating, + 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_end_exact, + 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_comment, + test_treebuilder_pi, + 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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+   + + + + + + +
setUpClass(cls)
+ Hook method for setting up class fixture before running tests in the class.
+ source code + +
+ +
+

Inherited from unittest.case.TestCase: + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ hash(x) +
+

Inherited from _ETreeTestCaseBase: + required_versions_ET, + required_versions_cET +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

setUpClass(cls) +
Class Method +

+
source code  +
+ + Hook method for setting up class fixture before running tests in the class. +
+
Overrides: + unittest.case.TestCase.setUpClass +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ hash(x) +
+
+
+
Value:
+
xml.etree.ElementTree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree._C14NTest-class.html b/doc/html/api/lxml.tests.test_elementtree._C14NTest-class.html new file mode 100644 index 00000000..5f4786ea --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree._C14NTest-class.html @@ -0,0 +1,502 @@ + + + + + lxml.tests.test_elementtree._C14NTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class _C14NTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _C14NTest

source code

+
+            object --+    
+                     |    
+unittest.case.TestCase --+
+                         |
+                        _C14NTest
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
subTest(*args, + **kwds) + source code + +
+ +
+   + + + + + + +
_canonicalize(self, + input_file, + **options) + source code + +
+ +
+   + + + + + + +
c14n_roundtrip(self, + xml, + **options) + source code + +
+ +
+   + + + + + + +
test_simple_roundtrip(self) + source code + +
+ +
+   + + + + + + +
test_c14n_exclusion(self) + source code + +
+ +
+   + + + + + + +
test_xml_c14n2(self) + source code + +
+ +
+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+   + + maxDiff = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

subTest(*args, + **kwds) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @contextmanager
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..98c78f75 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree._ETreeTestCaseBase-class.html @@ -0,0 +1,5372 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               _ETreeTestCaseBase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
XMLParser(self, + **kwargs) + source code + +
+ +
+   + + + + + + +
assertRegex(self, + *args, + **kwargs) + source code + +
+ +
+   + + + + + + +
test_interface(self, + *args) + source code + +
+ +
+   + + + + + + +
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_attrib(self) + source code + +
+ +
+   + + + + + + +
test_attrib_get(self) + source code + +
+ +
+   + + + + + + +
test_attrib_dict(self) + source code + +
+ +
+   + + + + + + +
test_attrib_copy(self) + source code + +
+ +
+   + + + + + + +
test_attrib_deepcopy(self) + source code + +
+ +
+   + + + + + + +
test_attributes_get(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_update_attrib(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_contains(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set(self) + source code + +
+ +
+   + + + + + + +
test_attrib_as_attrib(self) + source code + +
+ +
+   + + + + + + +
test_attribute_iterator(self) + source code + +
+ +
+   + + + + + + +
test_attribute_manipulation(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_set_tail_empty(self) + source code + +
+ +
+   + + + + + + +
test_iteration_clear_tail(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_itertext(self) + source code + +
+ +
+   + + + + + + +
test_itertext_child(self) + source code + +
+ +
+   + + + + + + +
test_findall(self) + source code + +
+ +
+   + + + + + + +
test_findall_ns(self) + source code + +
+ +
+   + + + + + + +
test_findall_wildcard(self, + *args) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes_keywords(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes_extra(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes_extra_duplicate(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_name_interning(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_remove_while_iterating(self) + source code + +
+ +
+   + + + + + + +
test_getchildren(self) + source code + +
+ +
+   + + + + + + +
test_makeelement(self) + source code + +
+ +
+   + + + + + + +
test_iter(self) + source code + +
+ +
+   + + + + + + +
test_iter_remove_tail(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_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_end(self) + source code + +
+ +
+   + + + + + + +
test_setslice_end_exact(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_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_attribute_namespace_roundtrip(self) + source code + +
+ +
+   + + + + + + +
test_attribute_namespace_roundtrip_replaced(self) + source code + +
+ +
+   + + + + + + +
test_register_namespace(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_incomplete(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_set_ns_attribute(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_only_end_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_bytes(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_unicode(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_property(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_tag(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_error_in_start(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_error_in_end(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_error_in_close(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_error_in_start_and_close(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_start_end_ns(self, + *args) + source code + +
+ +
+   + + + + + + +
test_parser_target_end_ns(self, + *args) + source code + +
+ +
+   + + + + + + +
test_treebuilder(self) + source code + +
+ +
+   + + + + + + +
test_treebuilder_target(self) + source code + +
+ +
+   + + + + + + +
test_treebuilder_comment(self, + *args) + source code + +
+ +
+   + + + + + + +
test_treebuilder_pi(self, + *args) + source code + +
+ +
+   + + + + + + +
test_late_tail(self) + source code + +
+ +
+   + + + + + + +
test_late_tail_mix_pi_comments(self, + *args) + 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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+   + + required_versions_ET = {'test_comment_text': (1, 3), 'test_com... +
+   + + required_versions_cET = {} +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

test_interface(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 6)
  • +
+
+
+
+ +
+ +
+ + +
+

test_findall_wildcard(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_parser_target_start_end_ns(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_parser_target_end_ns(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_treebuilder_comment(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_treebuilder_pi(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_late_tail_mix_pi_comments(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

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 +
+
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

required_versions_ET

+ +
+
+
+
Value:
+
+{'test_comment_text': (1, 3),
+ 'test_comment_whitespace': (1, 3),
+ 'test_extend': (1, 3),
+ 'test_feed_parser_error_broken': (1, 3),
+ 'test_feed_parser_error_close_empty': (1, 3),
+ 'test_feed_parser_error_close_incomplete': (1, 3),
+ 'test_feed_parser_error_position': (1, 3),
+ 'test_fromstringlist': (1, 3),
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree._ElementSlicingTest-class.html b/doc/html/api/lxml.tests.test_elementtree._ElementSlicingTest-class.html new file mode 100644 index 00000000..c26a73ce --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree._ElementSlicingTest-class.html @@ -0,0 +1,548 @@ + + + + + lxml.tests.test_elementtree._ElementSlicingTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class _ElementSlicingTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementSlicingTest

source code

+
+            object --+    
+                     |    
+unittest.case.TestCase --+
+                         |
+                        _ElementSlicingTest
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_elem_tags(self, + elemlist) + source code + +
+ +
+   + + + + + + +
_subelem_tags(self, + elem) + source code + +
+ +
+   + + + + + + +
_make_elem_with_children(self, + numchildren)
+ Create an Element with a tag 'a', with the given amount of children +named 'a0', 'a1' ... and so on.
+ source code + +
+ +
+   + + + + + + +
test_getslice_single_index(self) + source code + +
+ +
+   + + + + + + +
test_getslice_range(self) + source code + +
+ +
+   + + + + + + +
test_getslice_steps(self) + source code + +
+ +
+   + + + + + + +
test_getslice_negative_steps(self) + source code + +
+ +
+   + + + + + + +
test_delslice(self) + source code + +
+ +
+   + + + + + + +
test_setslice_single_index(self) + source code + +
+ +
+   + + + + + + +
test_setslice_range(self) + source code + +
+ +
+   + + + + + + +
test_setslice_steps(self) + source code + +
+ +
+   + + + + + + +
test_setslice_negative_steps(self) + source code + +
+ +
+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree._XMLPullParserTest-class.html b/doc/html/api/lxml.tests.test_elementtree._XMLPullParserTest-class.html new file mode 100644 index 00000000..cefc9cc3 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree._XMLPullParserTest-class.html @@ -0,0 +1,755 @@ + + + + + lxml.tests.test_elementtree._XMLPullParserTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class _XMLPullParserTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XMLPullParserTest

source code

+
+            object --+    
+                     |    
+unittest.case.TestCase --+
+                         |
+                        _XMLPullParserTest
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_close_and_return_root(self, + parser) + source code + +
+ +
+   + + + + + + +
_feed(self, + parser, + data, + chunk_size=None) + source code + +
+ +
+   + + + + + + +
assert_events(self, + parser, + expected, + max_events=None) + source code + +
+ +
+   + + + + + + +
assert_event_tuples(self, + parser, + expected, + max_events=None) + source code + +
+ +
+   + + + + + + +
assert_event_tags(self, + parser, + expected, + max_events=None) + source code + +
+ +
+   + + + + + + +
test_simple_xml(self) + source code + +
+ +
+   + + + + + + +
test_feed_while_iterating(self) + source code + +
+ +
+   + + + + + + +
test_simple_xml_with_ns(self) + source code + +
+ +
+   + + + + + + +
test_ns_events(self) + source code + +
+ +
+   + + + + + + +
test_ns_events_end_ns_only(self) + source code + +
+ +
+   + + + + + + +
test_ns_events_start(self, + *args) + source code + +
+ +
+   + + + + + + +
test_ns_events_start_end(self, + *args) + source code + +
+ +
+   + + + + + + +
test_events(self) + source code + +
+ +
+   + + + + + + +
test_events_comment(self, + *args) + source code + +
+ +
+   + + + + + + +
test_events_pi(self, + *args) + source code + +
+ +
+   + + + + + + +
test_events_sequence(self) + source code + +
+ +
+   + + + + + + +
test_unknown_event(self) + source code + +
+ +
+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

test_ns_events_start(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8)
  • +
+
+
+
+ +
+ +
+ + +
+

test_ns_events_start_end(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8)
  • +
+
+
+
+ +
+ +
+ + +
+

test_events_comment(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+ +
+ +
+ + +
+

test_events_pi(self, + *args) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @et_needs_pyversion(3, 8, 0, 'alpha', 4)
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..5990c937 --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors-module.html @@ -0,0 +1,244 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..3e0e67e3 --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors-pysrc.html @@ -0,0 +1,380 @@ + + + + + lxml.tests.test_errors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_errors + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_errors

+
+ 1  # -*- coding: utf-8 -*- 
+ 2  import unittest, doctest 
+ 3   
+ 4  # These tests check that error handling in the Pyrex code is 
+ 5  # complete. 
+ 6  # It is likely that if there are errors, instead of failing the code 
+ 7  # will simply crash. 
+ 8   
+ 9  import sys, gc, os.path 
+10  from lxml import etree 
+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 HelperTestCase 
+17   
+18   
+
19 -class ErrorTestCase(HelperTestCase): +
20 etree = etree +21 +
22 - def test_bad_element(self): +
23 # attrib argument of Element() should be a dictionary, so if +24 # we pass a string we should get an error. +25 self.assertRaises(TypeError, self.etree.Element, 'a', 'b') +
26 +
27 - def test_empty_parse(self): +
28 self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '') +
29 +
31 # test if cyclic reference can crash etree +32 Element = self.etree.Element +33 getrefcount = sys.getrefcount +34 +35 # must disable tracing as it could change the refcounts +36 trace_func = sys.gettrace() +37 try: +38 sys.settrace(None) +39 gc.collect() +40 +41 count = getrefcount(None) +42 +43 l = [Element('name'), Element('name')] +44 l.append(l) +45 +46 del l +47 gc.collect() +48 count = getrefcount(None) - count +49 +50 self.assertEqual(count, 0) +51 finally: +52 sys.settrace(trace_func) +
53 +
55 broken_xml_name = 'test_broken.xml' +56 broken_xml_path = os.path.join(this_dir, broken_xml_name) +57 fail_msg = 'test_broken.xml should raise an etree.XMLSyntaxError' +58 try: +59 etree.parse(broken_xml_path) +60 except etree.XMLSyntaxError as e: +61 # invariant +62 self.assertEqual(e.position, (e.lineno, e.offset + 1), 'position and lineno/offset out of sync') +63 # SyntaxError info derived from file & contents +64 self.assertTrue(e.filename.endswith(broken_xml_name), 'filename must be preserved') +65 self.assertEqual(e.lineno, 1) +66 self.assertEqual(e.offset, 10) +67 except Exception as e: +68 self.fail('{0}, not {1}'.format(fail_msg, type(e))) +69 else: +70 self.fail('test_broken.xml should raise an etree.XMLSyntaxError') +
71 +72 +
73 -def test_suite(): +
74 suite = unittest.TestSuite() +75 suite.addTests([unittest.makeSuite(ErrorTestCase)]) +76 return suite +
77 +78 if __name__ == '__main__': +79 print('to test use test.py %s' % __file__) +80 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..2fe4eea5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors.ErrorTestCase-class.html @@ -0,0 +1,451 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ErrorTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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 + +
+ +
+   + + + + + + +
test_xmlsyntaxerror_has_info(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..8894caba --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree-module.html @@ -0,0 +1,254 @@ + + + + + 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 +
+   + + XMLPullParserTest +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = '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 00000000..3e70db99 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree-pysrc.html @@ -0,0 +1,15460 @@ + + + + + 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  from __future__ import absolute_import 
+  11   
+  12  from collections import OrderedDict 
+  13  import os.path 
+  14  import unittest 
+  15  import copy 
+  16  import sys 
+  17  import re 
+  18  import gc 
+  19  import operator 
+  20  import textwrap 
+  21  import zlib 
+  22  import gzip 
+  23   
+  24  from .common_imports import etree, StringIO, BytesIO, HelperTestCase 
+  25  from .common_imports import fileInTestDir, fileUrlInTestDir, read_file, path2url, tmpfile 
+  26  from .common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_doctest 
+  27  from .common_imports import canonicalize, _str, _bytes 
+  28   
+  29  print(""" 
+  30  TESTED VERSION: %s""" % etree.__version__ + """ 
+  31      Python:           %r""" % (sys.version_info,) + """ 
+  32      lxml.etree:       %r""" % (etree.LXML_VERSION,) + """ 
+  33      libxml used:      %r""" % (etree.LIBXML_VERSION,) + """ 
+  34      libxml compiled:  %r""" % (etree.LIBXML_COMPILED_VERSION,) + """ 
+  35      libxslt used:     %r""" % (etree.LIBXSLT_VERSION,) + """ 
+  36      libxslt compiled: %r""" % (etree.LIBXSLT_COMPILED_VERSION,) + """ 
+  37      FS encoding:      %s""" % (sys.getfilesystemencoding(),) + """ 
+  38      Default encoding: %s""" % (sys.getdefaultencoding(),) + """ 
+  39      Max Unicode:      %s""" % (sys.maxunicode,) + """ 
+  40  """) 
+  41   
+  42  try: 
+  43      _unicode = unicode 
+  44  except NameError: 
+  45      # Python 3 
+  46      _unicode = str 
+  47   
+  48   
+
49 -class ETreeOnlyTestCase(HelperTestCase): +
50 """Tests only for etree, not ElementTree""" + 51 etree = etree + 52 +
53 - def test_version(self): +
54 self.assertTrue(isinstance(etree.__version__, _unicode)) + 55 self.assertTrue(isinstance(etree.LXML_VERSION, tuple)) + 56 self.assertEqual(len(etree.LXML_VERSION), 4) + 57 self.assertTrue(isinstance(etree.LXML_VERSION[0], int)) + 58 self.assertTrue(isinstance(etree.LXML_VERSION[1], int)) + 59 self.assertTrue(isinstance(etree.LXML_VERSION[2], int)) + 60 self.assertTrue(isinstance(etree.LXML_VERSION[3], int)) + 61 self.assertTrue(etree.__version__.startswith( + 62 str(etree.LXML_VERSION[0]))) +
63 +
64 - def test_c_api(self): +
65 if hasattr(self.etree, '__pyx_capi__'): + 66 # newer Pyrex compatible C-API + 67 self.assertTrue(isinstance(self.etree.__pyx_capi__, dict)) + 68 self.assertTrue(len(self.etree.__pyx_capi__) > 0) + 69 else: + 70 # older C-API mechanism + 71 self.assertTrue(hasattr(self.etree, '_import_c_api')) +
72 +
73 - def test_include_paths(self): +
74 import lxml + 75 includes = lxml.get_include() + 76 self.assertTrue(includes) + 77 self.assertTrue(len(includes) >= 2) + 78 self.assertTrue(os.path.join(os.path.dirname(lxml.__file__), 'includes') in includes, + 79 includes) +
80 +
81 - def test_element_names(self): +
82 Element = self.etree.Element + 83 el = Element('name') + 84 self.assertEqual(el.tag, 'name') + 85 el = Element('{}name') + 86 self.assertEqual(el.tag, 'name') +
87 +
88 - def test_element_name_empty(self): +
89 Element = self.etree.Element + 90 el = Element('name') + 91 self.assertRaises(ValueError, Element, '{}') + 92 self.assertRaises(ValueError, setattr, el, 'tag', '{}') + 93 + 94 self.assertRaises(ValueError, Element, '{test}') + 95 self.assertRaises(ValueError, setattr, el, 'tag', '{test}') +
96 +
97 - def test_element_name_colon(self): +
98 Element = self.etree.Element + 99 self.assertRaises(ValueError, Element, 'p:name') + 100 self.assertRaises(ValueError, Element, '{test}p:name') + 101 + 102 el = Element('name') + 103 self.assertRaises(ValueError, setattr, el, 'tag', 'p:name') +
104 +
105 - def test_element_name_quote(self): +
106 Element = self.etree.Element + 107 self.assertRaises(ValueError, Element, "p'name") + 108 self.assertRaises(ValueError, Element, 'p"name') + 109 + 110 self.assertRaises(ValueError, Element, "{test}p'name") + 111 self.assertRaises(ValueError, Element, '{test}p"name') + 112 + 113 el = Element('name') + 114 self.assertRaises(ValueError, setattr, el, 'tag', "p'name") + 115 self.assertRaises(ValueError, setattr, el, 'tag', 'p"name') +
116 +
117 - def test_element_name_space(self): +
118 Element = self.etree.Element + 119 self.assertRaises(ValueError, Element, ' name ') + 120 self.assertRaises(ValueError, Element, 'na me') + 121 self.assertRaises(ValueError, Element, '{test} name') + 122 + 123 el = Element('name') + 124 self.assertRaises(ValueError, setattr, el, 'tag', ' name ') +
125 +
126 - def test_subelement_name_empty(self): +
127 Element = self.etree.Element + 128 SubElement = self.etree.SubElement + 129 + 130 el = Element('name') + 131 self.assertRaises(ValueError, SubElement, el, '{}') + 132 self.assertRaises(ValueError, SubElement, el, '{test}') +
133 +
134 - def test_subelement_name_colon(self): +
135 Element = self.etree.Element + 136 SubElement = self.etree.SubElement + 137 + 138 el = Element('name') + 139 self.assertRaises(ValueError, SubElement, el, 'p:name') + 140 self.assertRaises(ValueError, SubElement, el, '{test}p:name') +
141 +
142 - def test_subelement_name_quote(self): +
143 Element = self.etree.Element + 144 SubElement = self.etree.SubElement + 145 + 146 el = Element('name') + 147 self.assertRaises(ValueError, SubElement, el, "p'name") + 148 self.assertRaises(ValueError, SubElement, el, "{test}p'name") + 149 + 150 self.assertRaises(ValueError, SubElement, el, 'p"name') + 151 self.assertRaises(ValueError, SubElement, el, '{test}p"name') +
152 +
153 - def test_subelement_name_space(self): +
154 Element = self.etree.Element + 155 SubElement = self.etree.SubElement + 156 + 157 el = Element('name') + 158 self.assertRaises(ValueError, SubElement, el, ' name ') + 159 self.assertRaises(ValueError, SubElement, el, 'na me') + 160 self.assertRaises(ValueError, SubElement, el, '{test} name') +
161 +
163 Element = self.etree.Element + 164 SubElement = self.etree.SubElement + 165 + 166 el = Element('name') + 167 self.assertRaises(ValueError, SubElement, el, 'name', {'a b c' : 'abc'}) + 168 self.assertRaises(ValueError, SubElement, el, 'name', {'a' : 'a\0\n'}) + 169 self.assertEqual(0, len(el)) +
170 +
171 - def test_qname_empty(self): +
172 QName = self.etree.QName + 173 self.assertRaises(ValueError, QName, '') + 174 self.assertRaises(ValueError, QName, None) + 175 self.assertRaises(ValueError, QName, None, None) + 176 self.assertRaises(ValueError, QName, 'test', '') +
177 +
178 - def test_qname_none(self): +
179 QName = self.etree.QName + 180 q = QName(None, 'TAG') + 181 self.assertEqual('TAG', q) + 182 self.assertEqual('TAG', q.localname) + 183 self.assertEqual(None, q.namespace) +
184 +
185 - def test_qname_colon(self): +
186 QName = self.etree.QName + 187 self.assertRaises(ValueError, QName, 'p:name') + 188 self.assertRaises(ValueError, QName, 'test', 'p:name') +
189 +
190 - def test_qname_space(self): +
191 QName = self.etree.QName + 192 self.assertRaises(ValueError, QName, ' name ') + 193 self.assertRaises(ValueError, QName, 'na me') + 194 self.assertRaises(ValueError, QName, 'test', ' name') +
195 +
197 # ET doesn't have namespace/localname properties on QNames + 198 QName = self.etree.QName + 199 namespace, localname = 'http://myns', 'a' + 200 qname = QName(namespace, localname) + 201 self.assertEqual(namespace, qname.namespace) + 202 self.assertEqual(localname, qname.localname) +
203 +
204 - def test_qname_element(self): +
205 # ET doesn't have namespace/localname properties on QNames + 206 QName = self.etree.QName + 207 qname1 = QName('http://myns', 'a') + 208 a = self.etree.Element(qname1, nsmap={'p' : 'http://myns'}) + 209 + 210 qname2 = QName(a) + 211 self.assertEqual(a.tag, qname1.text) + 212 self.assertEqual(a.tag, qname1) + 213 self.assertEqual(qname1.text, qname2.text) + 214 self.assertEqual(qname1, qname2.text) + 215 self.assertEqual(qname1.text, qname2) + 216 self.assertEqual(qname1, qname2) +
217 +
218 - def test_qname_text_resolve(self): +
219 # ET doesn't resove QNames as text values + 220 etree = self.etree + 221 qname = etree.QName('http://myns', 'a') + 222 a = etree.Element(qname, nsmap={'p' : 'http://myns'}) + 223 a.text = qname + 224 + 225 self.assertEqual("p:a", a.text) +
226 +
227 - def test_nsmap_prefix_invalid(self): +
228 etree = self.etree + 229 self.assertRaises(ValueError, + 230 etree.Element, "root", nsmap={'"' : 'testns'}) + 231 self.assertRaises(ValueError, + 232 etree.Element, "root", nsmap={'&' : 'testns'}) + 233 self.assertRaises(ValueError, + 234 etree.Element, "root", nsmap={'a:b' : 'testns'}) +
235 +
236 - def test_clear_keep_tail(self): +
237 XML = self.etree.XML + 238 tostring = self.etree.tostring + 239 a = XML('<a aa="A"><b ba="B">B1</b>B2<c ca="C">C1</c>C2</a>') + 240 a[0].clear(keep_tail=True) + 241 self.assertEqual(_bytes('<a aa="A"><b/>B2<c ca="C">C1</c>C2</a>'), tostring(a)) +
242 +
243 - def test_attribute_has_key(self): +
244 # ET in Py 3.x has no "attrib.has_key()" method + 245 XML = self.etree.XML + 246 + 247 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 248 self.assertEqual( + 249 True, root.attrib.has_key('bar')) + 250 self.assertEqual( + 251 False, root.attrib.has_key('baz')) + 252 self.assertEqual( + 253 False, root.attrib.has_key('hah')) + 254 self.assertEqual( + 255 True, + 256 root.attrib.has_key('{http://ns.codespeak.net/test}baz')) +
257 +
258 - def test_attribute_set(self): +
259 Element = self.etree.Element + 260 root = Element("root") + 261 root.set("attr", "TEST") + 262 self.assertEqual("TEST", root.get("attr")) +
263 +
265 # ElementTree accepts arbitrary attribute values + 266 # lxml.etree allows only strings + 267 Element = self.etree.Element + 268 + 269 root = Element("root") + 270 root.set("attr", "TEST") + 271 self.assertEqual("TEST", root.get("attr")) + 272 self.assertRaises(TypeError, root.set, "newattr", 5) +
273 +
274 - def test_attrib_and_keywords(self): +
275 Element = self.etree.Element + 276 + 277 root = Element("root") + 278 root.set("attr", "TEST") + 279 self.assertEqual("TEST", root.attrib["attr"]) + 280 + 281 root2 = Element("root2", root.attrib, attr2='TOAST') + 282 self.assertEqual("TEST", root2.attrib["attr"]) + 283 self.assertEqual("TOAST", root2.attrib["attr2"]) + 284 self.assertEqual(None, root.attrib.get("attr2")) +
285 +
286 - def test_attrib_order(self): +
287 Element = self.etree.Element + 288 + 289 keys = ["attr%d" % i for i in range(12, 4, -1)] + 290 values = ["TEST-%d" % i for i in range(12, 4, -1)] + 291 items = list(zip(keys, values)) + 292 + 293 root = Element("root") + 294 for key, value in items: + 295 root.set(key, value) + 296 self.assertEqual(keys, root.attrib.keys()) + 297 self.assertEqual(values, root.attrib.values()) + 298 + 299 attr_order = [ + 300 ('attr_99', 'TOAST-1'), + 301 ('attr_98', 'TOAST-2'), + 302 ] + 303 ordered_dict_types = [OrderedDict, lambda x:x] + 304 if sys.version_info >= (3, 6): + 305 ordered_dict_types.append(dict) + 306 else: + 307 # Keyword arguments are not ordered in Py<3.6, and thus get sorted. + 308 attr_order.sort() + 309 attr_order += items + 310 expected_keys = [attr[0] for attr in attr_order] + 311 expected_values = [attr[1] for attr in attr_order] + 312 expected_items = list(zip(expected_keys, expected_values)) + 313 + 314 for dict_type in ordered_dict_types: + 315 root2 = Element("root2", dict_type(root.attrib), + 316 attr_99='TOAST-1', attr_98='TOAST-2') + 317 + 318 try: + 319 self.assertSequenceEqual(expected_keys, root2.attrib.keys()) + 320 self.assertSequenceEqual(expected_values, root2.attrib.values()) + 321 self.assertSequenceEqual(expected_items, root2.attrib.items()) + 322 except AssertionError as exc: + 323 exc.args = ("Order of '%s': %s" % (dict_type.__name__, exc.args[0]),) + exc.args[1:] + 324 raise + 325 + 326 self.assertEqual(keys, root.attrib.keys()) + 327 self.assertEqual(values, root.attrib.values()) +
328 +
329 - def test_attribute_set_invalid(self): +
330 # ElementTree accepts arbitrary attribute values + 331 # lxml.etree allows only strings, or None for (html5) boolean attributes + 332 Element = self.etree.Element + 333 root = Element("root") + 334 self.assertRaises(TypeError, root.set, "newattr", 5) + 335 self.assertRaises(TypeError, root.set, "newattr", object) + 336 self.assertRaises(TypeError, root.set, "newattr", None) + 337 self.assertRaises(TypeError, root.set, "newattr") +
338 +
339 - def test_strip_attributes(self): +
340 XML = self.etree.XML + 341 xml = _bytes('<test a="5" b="10" c="20"><x a="4" b="2"/></test>') + 342 + 343 root = XML(xml) + 344 self.etree.strip_attributes(root, 'a') + 345 self.assertEqual(_bytes('<test b="10" c="20"><x b="2"></x></test>'), + 346 self._writeElement(root)) + 347 + 348 root = XML(xml) + 349 self.etree.strip_attributes(root, 'b', 'c') + 350 self.assertEqual(_bytes('<test a="5"><x a="4"></x></test>'), + 351 self._writeElement(root)) +
352 +
353 - def test_strip_attributes_ns(self): +
354 XML = self.etree.XML + 355 xml = _bytes('<test xmlns:n="http://test/ns" a="6" b="10" c="20" n:a="5"><x a="4" n:b="2"/></test>') + 356 + 357 root = XML(xml) + 358 self.etree.strip_attributes(root, 'a') + 359 self.assertEqual( + 360 _bytes('<test xmlns:n="http://test/ns" b="10" c="20" n:a="5"><x n:b="2"></x></test>'), + 361 self._writeElement(root)) + 362 + 363 root = XML(xml) + 364 self.etree.strip_attributes(root, '{http://test/ns}a', 'c') + 365 self.assertEqual( + 366 _bytes('<test xmlns:n="http://test/ns" a="6" b="10"><x a="4" n:b="2"></x></test>'), + 367 self._writeElement(root)) + 368 + 369 root = XML(xml) + 370 self.etree.strip_attributes(root, '{http://test/ns}*') + 371 self.assertEqual( + 372 _bytes('<test xmlns:n="http://test/ns" a="6" b="10" c="20"><x a="4"></x></test>'), + 373 self._writeElement(root)) +
374 +
375 - def test_strip_elements(self): +
376 XML = self.etree.XML + 377 xml = _bytes('<test><a><b><c/></b></a><x><a><b/><c/></a></x></test>') + 378 + 379 root = XML(xml) + 380 self.etree.strip_elements(root, 'a') + 381 self.assertEqual(_bytes('<test><x></x></test>'), + 382 self._writeElement(root)) + 383 + 384 root = XML(xml) + 385 self.etree.strip_elements(root, 'b', 'c', 'X', 'Y', 'Z') + 386 self.assertEqual(_bytes('<test><a></a><x><a></a></x></test>'), + 387 self._writeElement(root)) + 388 + 389 root = XML(xml) + 390 self.etree.strip_elements(root, 'c') + 391 self.assertEqual(_bytes('<test><a><b></b></a><x><a><b></b></a></x></test>'), + 392 self._writeElement(root)) +
393 +
394 - def test_strip_elements_ns(self): +
395 XML = self.etree.XML + 396 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>') + 397 + 398 root = XML(xml) + 399 self.etree.strip_elements(root, 'a') + 400 self.assertEqual(_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>'), + 401 self._writeElement(root)) + 402 + 403 root = XML(xml) + 404 self.etree.strip_elements(root, '{urn:a}b', 'c') + 405 self.assertEqual(_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>'), + 406 self._writeElement(root)) + 407 + 408 root = XML(xml) + 409 self.etree.strip_elements(root, '{urn:a}*', 'c') + 410 self.assertEqual(_bytes('<test>TEST<x>X<a>A<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 411 self._writeElement(root)) + 412 + 413 root = XML(xml) + 414 self.etree.strip_elements(root, '{urn:a}*', 'c', with_tail=False) + 415 self.assertEqual(_bytes('<test>TESTAT<x>X<a>ABT<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 416 self._writeElement(root)) +
417 +
418 - def test_strip_tags(self): +
419 XML = self.etree.XML + 420 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>') + 421 + 422 root = XML(xml) + 423 self.etree.strip_tags(root, 'a') + 424 self.assertEqual(_bytes('<test>TESTA<b>B<c></c>CT</b>BTAT<x>XA<b></b>BT<c></c>CTAT</x>XT</test>'), + 425 self._writeElement(root)) + 426 + 427 root = XML(xml) + 428 self.etree.strip_tags(root, 'b', 'c', 'X', 'Y', 'Z') + 429 self.assertEqual(_bytes('<test>TEST<a>ABCTBT</a>AT<x>X<a>ABTCT</a>AT</x>XT</test>'), + 430 self._writeElement(root)) + 431 + 432 root = XML(xml) + 433 self.etree.strip_tags(root, 'c') + 434 self.assertEqual(_bytes('<test>TEST<a>A<b>BCT</b>BT</a>AT<x>X<a>A<b></b>BTCT</a>AT</x>XT</test>'), + 435 self._writeElement(root)) +
436 +
437 - def test_strip_tags_pi_comment(self): +
438 XML = self.etree.XML + 439 PI = self.etree.ProcessingInstruction + 440 Comment = self.etree.Comment + 441 xml = _bytes('<!--comment1-->\n<?PI1?>\n<test>TEST<!--comment2-->XT<?PI2?></test>\n<!--comment3-->\n<?PI1?>') + 442 + 443 root = XML(xml) + 444 self.etree.strip_tags(root, PI) + 445 self.assertEqual(_bytes('<!--comment1-->\n<?PI1?>\n<test>TEST<!--comment2-->XT</test>\n<!--comment3-->\n<?PI1?>'), + 446 self._writeElement(root)) + 447 + 448 root = XML(xml) + 449 self.etree.strip_tags(root, Comment) + 450 self.assertEqual(_bytes('<!--comment1-->\n<?PI1?>\n<test>TESTXT<?PI2?></test>\n<!--comment3-->\n<?PI1?>'), + 451 self._writeElement(root)) + 452 + 453 root = XML(xml) + 454 self.etree.strip_tags(root, PI, Comment) + 455 self.assertEqual(_bytes('<!--comment1-->\n<?PI1?>\n<test>TESTXT</test>\n<!--comment3-->\n<?PI1?>'), + 456 self._writeElement(root)) + 457 + 458 root = XML(xml) + 459 self.etree.strip_tags(root, Comment, PI) + 460 self.assertEqual(_bytes('<!--comment1-->\n<?PI1?>\n<test>TESTXT</test>\n<!--comment3-->\n<?PI1?>'), + 461 self._writeElement(root)) +
462 +
464 XML = self.etree.XML + 465 ElementTree = self.etree.ElementTree + 466 PI = self.etree.ProcessingInstruction + 467 Comment = self.etree.Comment + 468 xml = _bytes('<!--comment1-->\n<?PI1?>\n<test>TEST<!--comment2-->XT<?PI2?></test>\n<!--comment3-->\n<?PI1?>') + 469 + 470 root = XML(xml) + 471 self.etree.strip_tags(ElementTree(root), PI) + 472 self.assertEqual(_bytes('<!--comment1-->\n<test>TEST<!--comment2-->XT</test>\n<!--comment3-->'), + 473 self._writeElement(root)) + 474 + 475 root = XML(xml) + 476 self.etree.strip_tags(ElementTree(root), Comment) + 477 self.assertEqual(_bytes('<?PI1?>\n<test>TESTXT<?PI2?></test>\n<?PI1?>'), + 478 self._writeElement(root)) + 479 + 480 root = XML(xml) + 481 self.etree.strip_tags(ElementTree(root), PI, Comment) + 482 self.assertEqual(_bytes('<test>TESTXT</test>'), + 483 self._writeElement(root)) + 484 + 485 root = XML(xml) + 486 self.etree.strip_tags(ElementTree(root), Comment, PI) + 487 self.assertEqual(_bytes('<test>TESTXT</test>'), + 488 self._writeElement(root)) +
489 +
490 - def test_strip_tags_doc_style(self): +
491 XML = self.etree.XML + 492 xml = _bytes(''' + 493 <div> + 494 <div> + 495 I like <strong>sheep</strong>. + 496 <br/> + 497 I like lots of <strong>sheep</strong>. + 498 <br/> + 499 Click <a href="http://www.sheep.com">here</a> + 500 for <a href="http://www.sheep.com">those</a> sheep. + 501 <br/> + 502 </div> + 503 </div> + 504 '''.strip()) + 505 + 506 root = XML(xml) + 507 self.etree.strip_tags(root, 'a') + 508 self.assertEqual(re.sub(_bytes('</?a[^>]*>'), _bytes(''), xml).replace(_bytes('<br/>'), _bytes('<br></br>')), + 509 self._writeElement(root)) + 510 + 511 root = XML(xml) + 512 self.etree.strip_tags(root, 'a', 'br') + 513 self.assertEqual(re.sub(_bytes('</?a[^>]*>'), _bytes(''), + 514 re.sub(_bytes('<br[^>]*>'), _bytes(''), xml)), + 515 self._writeElement(root)) +
516 +
517 - def test_strip_tags_ns(self): +
518 XML = self.etree.XML + 519 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>') + 520 + 521 root = XML(xml) + 522 self.etree.strip_tags(root, 'a') + 523 self.assertEqual(_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>'), + 524 self._writeElement(root)) + 525 + 526 root = XML(xml) + 527 self.etree.strip_tags(root, '{urn:a}b', 'c') + 528 self.assertEqual(_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>'), + 529 self._writeElement(root)) + 530 + 531 root = XML(xml) + 532 self.etree.strip_tags(root, '{urn:a}*', 'c') + 533 self.assertEqual(_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>'), + 534 self._writeElement(root)) +
535 +
536 - def test_strip_tags_and_remove(self): +
537 # previously crashed + 538 HTML = self.etree.HTML + 539 root = HTML(_bytes('<div><h1>title</h1> <b>foo</b> <p>boo</p></div>'))[0][0] + 540 self.assertEqual(_bytes('<div><h1>title</h1> <b>foo</b> <p>boo</p></div>'), + 541 self.etree.tostring(root)) + 542 self.etree.strip_tags(root, 'b') + 543 self.assertEqual(_bytes('<div><h1>title</h1> foo <p>boo</p></div>'), + 544 self.etree.tostring(root)) + 545 root.remove(root[0]) + 546 self.assertEqual(_bytes('<div><p>boo</p></div>'), + 547 self.etree.tostring(root)) +
548 +
549 - def test_pi(self): +
550 # lxml.etree separates target and text + 551 Element = self.etree.Element + 552 SubElement = self.etree.SubElement + 553 ProcessingInstruction = self.etree.ProcessingInstruction + 554 + 555 a = Element('a') + 556 a.append(ProcessingInstruction('foo', 'some more text')) + 557 self.assertEqual(a[0].target, 'foo') + 558 self.assertEqual(a[0].text, 'some more text') +
559 +
560 - def test_pi_parse(self): +
561 XML = self.etree.XML + 562 root = XML(_bytes("<test><?mypi my test ?></test>")) + 563 self.assertEqual(root[0].target, "mypi") + 564 self.assertEqual(root[0].text, "my test ") +
565 +
567 XML = self.etree.XML + 568 root = XML(_bytes("<test><?mypi my='1' test=\" abc \" quotes=\"' '\" only names ?></test>")) + 569 self.assertEqual(root[0].target, "mypi") + 570 self.assertEqual(root[0].get('my'), "1") + 571 self.assertEqual(root[0].get('test'), " abc ") + 572 self.assertEqual(root[0].get('quotes'), "' '") + 573 self.assertEqual(root[0].get('only'), None) + 574 self.assertEqual(root[0].get('names'), None) + 575 self.assertEqual(root[0].get('nope'), None) +
576 +
578 XML = self.etree.XML + 579 root = XML(_bytes("<test><?mypi my='1' test=\" abc \" quotes=\"' '\" only names ?></test>")) + 580 self.assertEqual(root[0].target, "mypi") + 581 self.assertEqual(root[0].attrib['my'], "1") + 582 self.assertEqual(root[0].attrib['test'], " abc ") + 583 self.assertEqual(root[0].attrib['quotes'], "' '") + 584 self.assertRaises(KeyError, root[0].attrib.__getitem__, 'only') + 585 self.assertRaises(KeyError, root[0].attrib.__getitem__, 'names') + 586 self.assertRaises(KeyError, root[0].attrib.__getitem__, 'nope') +
587 +
588 - def test_deepcopy_pi(self): +
589 # previously caused a crash + 590 ProcessingInstruction = self.etree.ProcessingInstruction + 591 + 592 a = ProcessingInstruction("PI", "ONE") + 593 b = copy.deepcopy(a) + 594 b.text = "ANOTHER" + 595 + 596 self.assertEqual('ONE', a.text) + 597 self.assertEqual('ANOTHER', b.text) +
598 +
600 XML = self.etree.XML + 601 tostring = self.etree.tostring + 602 root = XML(_bytes("<?mypi my test ?><test/><!--comment -->")) + 603 tree1 = self.etree.ElementTree(root) + 604 self.assertEqual(_bytes("<?mypi my test ?><test/><!--comment -->"), + 605 tostring(tree1)) + 606 + 607 tree2 = copy.deepcopy(tree1) + 608 self.assertEqual(_bytes("<?mypi my test ?><test/><!--comment -->"), + 609 tostring(tree2)) + 610 + 611 root2 = copy.deepcopy(tree1.getroot()) + 612 self.assertEqual(_bytes("<test/>"), + 613 tostring(root2)) +
614 +
616 XML = self.etree.XML + 617 tostring = self.etree.tostring + 618 xml = _bytes('<!DOCTYPE test [\n<!ENTITY entity "tasty">\n]>\n<test/>') + 619 root = XML(xml) + 620 tree1 = self.etree.ElementTree(root) + 621 self.assertEqual(xml, tostring(tree1)) + 622 + 623 tree2 = copy.deepcopy(tree1) + 624 self.assertEqual(xml, tostring(tree2)) + 625 + 626 root2 = copy.deepcopy(tree1.getroot()) + 627 self.assertEqual(_bytes("<test/>"), + 628 tostring(root2)) +
629 +
630 - def test_deepcopy_pi_dtd(self): +
631 XML = self.etree.XML + 632 tostring = self.etree.tostring + 633 xml = _bytes('<!-- comment --><!DOCTYPE test [\n<!ENTITY entity "tasty">\n]>\n<test/>') + 634 root = XML(xml) + 635 tree1 = self.etree.ElementTree(root) + 636 self.assertEqual(xml, tostring(tree1)) + 637 + 638 tree2 = copy.deepcopy(tree1) + 639 self.assertEqual(xml, tostring(tree2)) +
640 +
641 - def test_parse_remove_comments(self): +
642 fromstring = self.etree.fromstring + 643 tostring = self.etree.tostring + 644 XMLParser = self.etree.XMLParser + 645 + 646 xml = _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 647 parser = XMLParser(remove_comments=True) + 648 root = fromstring(xml, parser) + 649 self.assertEqual( + 650 _bytes('<a><b><c/></b></a>'), + 651 tostring(root)) +
652 +
653 - def test_parse_remove_pis(self): +
654 parse = self.etree.parse + 655 tostring = self.etree.tostring + 656 XMLParser = self.etree.XMLParser + 657 + 658 xml = _bytes('<?test?><a><?A?><b><?B?><c/></b><?C?></a><?tail?>') + 659 + 660 f = BytesIO(xml) + 661 tree = parse(f) + 662 self.assertEqual( + 663 xml, + 664 tostring(tree)) + 665 + 666 parser = XMLParser(remove_pis=True) + 667 tree = parse(f, parser) + 668 self.assertEqual( + 669 _bytes('<a><b><c/></b></a>'), + 670 tostring(tree)) +
671 +
673 # ET raises IOError only + 674 parse = self.etree.parse + 675 self.assertRaises(TypeError, parse, 'notthere.xml', object()) +
676 +
678 # ET removes comments + 679 iterparse = self.etree.iterparse + 680 tostring = self.etree.tostring + 681 + 682 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 683 events = list(iterparse(f)) + 684 root = events[-1][1] + 685 self.assertEqual(3, len(events)) + 686 self.assertEqual( + 687 _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>'), + 688 tostring(root)) +
689 +
690 - def test_iterparse_comments(self): +
691 # ET removes comments + 692 iterparse = self.etree.iterparse + 693 tostring = self.etree.tostring + 694 + 695 def name(event, el): + 696 if event == 'comment': + 697 return el.text + 698 else: + 699 return el.tag +
700 + 701 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 702 events = list(iterparse(f, events=('end', 'comment'))) + 703 root = events[-1][1] + 704 self.assertEqual(6, len(events)) + 705 self.assertEqual(['A', ' B ', 'c', 'b', 'C', 'a'], + 706 [ name(*item) for item in events ]) + 707 self.assertEqual( + 708 _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>'), + 709 tostring(root)) +
710 +
711 - def test_iterparse_pis(self): +
712 # ET removes pis + 713 iterparse = self.etree.iterparse + 714 tostring = self.etree.tostring + 715 ElementTree = self.etree.ElementTree + 716 + 717 def name(event, el): + 718 if event == 'pi': + 719 return el.target, el.text + 720 else: + 721 return el.tag +
722 + 723 f = BytesIO('<?pia a?><a><?pib b?><b><?pic c?><c/></b><?pid d?></a><?pie e?>') + 724 events = list(iterparse(f, events=('end', 'pi'))) + 725 root = events[-2][1] + 726 self.assertEqual(8, len(events)) + 727 self.assertEqual([('pia','a'), ('pib','b'), ('pic','c'), 'c', 'b', + 728 ('pid','d'), 'a', ('pie','e')], + 729 [ name(*item) for item in events ]) + 730 self.assertEqual( + 731 _bytes('<?pia a?><a><?pib b?><b><?pic c?><c/></b><?pid d?></a><?pie e?>'), + 732 tostring(ElementTree(root))) + 733 +
735 iterparse = self.etree.iterparse + 736 tostring = self.etree.tostring + 737 + 738 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 739 events = list(iterparse(f, remove_comments=True, + 740 events=('end', 'comment'))) + 741 root = events[-1][1] + 742 self.assertEqual(3, len(events)) + 743 self.assertEqual(['c', 'b', 'a'], + 744 [ el.tag for (event, el) in events ]) + 745 self.assertEqual( + 746 _bytes('<a><b><c/></b></a>'), + 747 tostring(root)) +
748 +
749 - def test_iterparse_broken(self): +
750 iterparse = self.etree.iterparse + 751 f = BytesIO('<a><b><c/></a>') + 752 # ET raises ExpatError, lxml raises XMLSyntaxError + 753 self.assertRaises(self.etree.XMLSyntaxError, list, iterparse(f)) +
754 +
756 iterparse = self.etree.iterparse + 757 f = BytesIO('<a><b><c/></a>') + 758 it = iterparse(f, events=('start', 'end'), recover=True) + 759 events = [(ev, el.tag) for ev, el in it] + 760 root = it.root + 761 self.assertTrue(root is not None) + 762 + 763 self.assertEqual(1, events.count(('start', 'a'))) + 764 self.assertEqual(1, events.count(('end', 'a'))) + 765 + 766 self.assertEqual(1, events.count(('start', 'b'))) + 767 self.assertEqual(1, events.count(('end', 'b'))) + 768 + 769 self.assertEqual(1, events.count(('start', 'c'))) + 770 self.assertEqual(1, events.count(('end', 'c'))) +
771 +
773 iterparse = self.etree.iterparse + 774 f = BytesIO('<a><b><c/></d><b><c/></a></b>') + 775 it = iterparse(f, events=('start', 'end'), recover=True) + 776 events = [(ev, el.tag) for ev, el in it] + 777 root = it.root + 778 self.assertTrue(root is not None) + 779 + 780 self.assertEqual(1, events.count(('start', 'a'))) + 781 self.assertEqual(1, events.count(('end', 'a'))) + 782 + 783 self.assertEqual(2, events.count(('start', 'b'))) + 784 self.assertEqual(2, events.count(('end', 'b'))) + 785 + 786 self.assertEqual(2, events.count(('start', 'c'))) + 787 self.assertEqual(2, events.count(('end', 'c'))) +
788 +
789 - def test_iterparse_strip(self): +
790 iterparse = self.etree.iterparse + 791 f = BytesIO(""" + 792 <a> \n \n <b> b test </b> \n + 793 + 794 \n\t <c> \n </c> </a> \n """) + 795 iterator = iterparse(f, remove_blank_text=True) + 796 text = [ (element.text, element.tail) + 797 for event, element in iterator ] + 798 self.assertEqual( + 799 [(" b test ", None), (" \n ", None), (None, None)], + 800 text) +
801 +
802 - def test_iterparse_tag(self): +
803 iterparse = self.etree.iterparse + 804 f = BytesIO('<a><b><d/></b><c/></a>') + 805 + 806 iterator = iterparse(f, tag="b", events=('start', 'end')) + 807 events = list(iterator) + 808 root = iterator.root + 809 self.assertEqual( + 810 [('start', root[0]), ('end', root[0])], + 811 events) +
812 +
813 - def test_iterparse_tag_all(self): +
814 iterparse = self.etree.iterparse + 815 f = BytesIO('<a><b><d/></b><c/></a>') + 816 + 817 iterator = iterparse(f, tag="*", events=('start', 'end')) + 818 events = list(iterator) + 819 self.assertEqual( + 820 8, + 821 len(events)) +
822 +
823 - def test_iterparse_tag_ns(self): +
824 iterparse = self.etree.iterparse + 825 f = BytesIO('<a xmlns="urn:test:1"><b><d/></b><c/></a>') + 826 + 827 iterator = iterparse(f, tag="{urn:test:1}b", events=('start', 'end')) + 828 events = list(iterator) + 829 root = iterator.root + 830 self.assertEqual( + 831 [('start', root[0]), ('end', root[0])], + 832 events) +
833 +
834 - def test_iterparse_tag_ns_empty(self): +
835 iterparse = self.etree.iterparse + 836 f = BytesIO('<a><b><d/></b><c/></a>') + 837 iterator = iterparse(f, tag="{}b", events=('start', 'end')) + 838 events = list(iterator) + 839 root = iterator.root + 840 self.assertEqual( + 841 [('start', root[0]), ('end', root[0])], + 842 events) + 843 + 844 f = BytesIO('<a xmlns="urn:test:1"><b><d/></b><c/></a>') + 845 iterator = iterparse(f, tag="{}b", events=('start', 'end')) + 846 events = list(iterator) + 847 root = iterator.root + 848 self.assertEqual([], events) +
849 +
850 - def test_iterparse_tag_ns_all(self): +
851 iterparse = self.etree.iterparse + 852 f = BytesIO('<a xmlns="urn:test:1"><b><d/></b><c/></a>') + 853 iterator = iterparse(f, tag="{urn:test:1}*", events=('start', 'end')) + 854 events = list(iterator) + 855 self.assertEqual(8, len(events)) +
856 +
858 iterparse = self.etree.iterparse + 859 f = BytesIO('<a xmlns="urn:test:1"><b><d/></b><c/></a>') + 860 iterator = iterparse(f, tag="{}*", events=('start', 'end')) + 861 events = list(iterator) + 862 self.assertEqual([], events) + 863 + 864 f = BytesIO('<a><b><d/></b><c/></a>') + 865 iterator = iterparse(f, tag="{}*", events=('start', 'end')) + 866 events = list(iterator) + 867 self.assertEqual(8, len(events)) +
868 +
870 text = _str('Søk på nettet') + 871 wrong_declaration = "<?xml version='1.0' encoding='UTF-8'?>" + 872 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) + 873 ).encode('iso-8859-1') + 874 + 875 self.assertRaises(self.etree.ParseError, + 876 list, self.etree.iterparse(BytesIO(xml_latin1))) +
877 +
879 text = _str('Søk på nettet', encoding="UTF-8") + 880 wrong_declaration = "<?xml version='1.0' encoding='UTF-8'?>" + 881 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) + 882 ).encode('iso-8859-1') + 883 + 884 iterator = self.etree.iterparse(BytesIO(xml_latin1), + 885 encoding="iso-8859-1") + 886 self.assertEqual(1, len(list(iterator))) + 887 + 888 a = iterator.root + 889 self.assertEqual(a.text, text) +
890 +
891 - def test_iterparse_keep_cdata(self): +
892 tostring = self.etree.tostring + 893 f = BytesIO('<root><![CDATA[test]]></root>') + 894 context = self.etree.iterparse(f, strip_cdata=False) + 895 content = [ el.text for event,el in context ] + 896 + 897 self.assertEqual(['test'], content) + 898 self.assertEqual(_bytes('<root><![CDATA[test]]></root>'), + 899 tostring(context.root)) +
900 +
902 self.assertRaises( + 903 LookupError, self.etree.XMLParser, encoding="hopefully unknown") +
904 +
905 - def test_parser_encoding(self): +
906 self.etree.XMLParser(encoding="ascii") + 907 self.etree.XMLParser(encoding="utf-8") + 908 self.etree.XMLParser(encoding="iso-8859-1") +
909 +
910 - def test_feed_parser_recover(self): +
911 parser = self.etree.XMLParser(recover=True) + 912 + 913 parser.feed('<?xml version=') + 914 parser.feed('"1.0"?><ro') + 915 parser.feed('ot><') + 916 parser.feed('a test="works"') + 917 parser.feed('><othertag/></root') # <a> not closed! + 918 parser.feed('>') + 919 + 920 root = parser.close() + 921 + 922 self.assertEqual(root.tag, "root") + 923 self.assertEqual(len(root), 1) + 924 self.assertEqual(root[0].tag, "a") + 925 self.assertEqual(root[0].get("test"), "works") + 926 self.assertEqual(len(root[0]), 1) + 927 self.assertEqual(root[0][0].tag, "othertag") +
928 # FIXME: would be nice to get some errors logged ... + 929 #self.assertTrue(len(parser.error_log) > 0, "error log is empty") + 930 +
932 # test that recover mode plays nicely with the no-id-dict setup + 933 parser = self.etree.XMLParser(recover=True, collect_ids=False) + 934 + 935 parser.feed('<?xml version=') + 936 parser.feed('"1.0"?><ro') + 937 parser.feed('ot xml:id="123"><') + 938 parser.feed('a test="works" xml:id=') + 939 parser.feed('"321"><othertag/></root') # <a> not closed! + 940 parser.feed('>') + 941 + 942 root = parser.close() + 943 + 944 self.assertEqual(root.tag, "root") + 945 self.assertEqual(len(root), 1) + 946 self.assertEqual(root[0].tag, "a") + 947 self.assertEqual(root[0].get("test"), "works") + 948 self.assertEqual(root[0].attrib, { + 949 'test': 'works', + 950 '{http://www.w3.org/XML/1998/namespace}id': '321'}) + 951 self.assertEqual(len(root[0]), 1) + 952 self.assertEqual(root[0][0].tag, "othertag") +
953 # FIXME: would be nice to get some errors logged ... + 954 #self.assertTrue(len(parser.error_log) > 0, "error log is empty") + 955 +
957 assertEqual = self.assertEqual + 958 assertFalse = self.assertFalse + 959 + 960 events = [] + 961 class Target(object): + 962 def start(self, tag, attrib): + 963 events.append("start") + 964 assertFalse(attrib) + 965 assertEqual("TAG", tag) +
966 def end(self, tag): + 967 events.append("end") + 968 assertEqual("TAG", tag) + 969 def close(self): + 970 return "DONE" # no Element! + 971 + 972 parser = self.etree.XMLParser(target=Target()) + 973 tree = self.etree.ElementTree() + 974 + 975 self.assertRaises(TypeError, + 976 tree.parse, BytesIO("<TAG/>"), parser=parser) + 977 self.assertEqual(["start", "end"], events) + 978 +
980 # ET doesn't call .close() on errors + 981 events = [] + 982 class Target(object): + 983 def start(self, tag, attrib): + 984 events.append("start-" + tag) +
985 def end(self, tag): + 986 events.append("end-" + tag) + 987 if tag == 'a': + 988 raise ValueError("dead and gone") + 989 def data(self, data): + 990 events.append("data-" + data) + 991 def close(self): + 992 events.append("close") + 993 return "DONE" + 994 + 995 parser = self.etree.XMLParser(target=Target()) + 996 + 997 try: + 998 parser.feed(_bytes('<root>A<a>ca</a>B</root>')) + 999 done = parser.close() +1000 self.fail("error expected, but parsing succeeded") +1001 except ValueError: +1002 done = 'value error received as expected' +1003 +1004 self.assertEqual(["start-root", "data-A", "start-a", +1005 "data-ca", "end-a", "close"], +1006 events) +1007 +
1009 # ET doesn't call .close() on errors +1010 events = [] +1011 class Target(object): +1012 def start(self, tag, attrib): +1013 events.append("start-" + tag) +
1014 def end(self, tag): +1015 events.append("end-" + tag) +1016 if tag == 'a': +1017 raise ValueError("dead and gone") +1018 def data(self, data): +1019 events.append("data-" + data) +1020 def close(self): +1021 events.append("close") +1022 return "DONE" +1023 +1024 parser = self.etree.XMLParser(target=Target()) +1025 +1026 try: +1027 done = self.etree.fromstring(_bytes('<root>A<a>ca</a>B</root>'), +1028 parser=parser) +1029 self.fail("error expected, but parsing succeeded") +1030 except ValueError: +1031 done = 'value error received as expected' +1032 +1033 self.assertEqual(["start-root", "data-A", "start-a", +1034 "data-ca", "end-a", "close"], +1035 events) +1036 +
1038 # test that target parsing works nicely with the no-id-hash setup +1039 events = [] +1040 class Target(object): +1041 def start(self, tag, attrib): +1042 events.append("start-" + tag) +
1043 def end(self, tag): +1044 events.append("end-" + tag) +1045 def data(self, data): +1046 events.append("data-" + data) +1047 def comment(self, text): +1048 events.append("comment-" + text) +1049 def close(self): +1050 return "DONE" +1051 +1052 parser = self.etree.XMLParser(target=Target(), collect_ids=False) +1053 +1054 parser.feed(_bytes('<!--a--><root xml:id="123">A<!--b-->')) +1055 parser.feed(_bytes('<sub xml:id="321"/>B</root>')) +1056 done = parser.close() +1057 +1058 self.assertEqual("DONE", done) +1059 self.assertEqual(["comment-a", "start-root", "data-A", "comment-b", +1060 "start-sub", "end-sub", "data-B", "end-root"], +1061 events) +1062 +
1063 - def test_parser_target_comment(self): +
1064 events = [] +1065 class Target(object): +1066 def start(self, tag, attrib): +1067 events.append("start-" + tag) +
1068 def end(self, tag): +1069 events.append("end-" + tag) +1070 def data(self, data): +1071 events.append("data-" + data) +1072 def comment(self, text): +1073 events.append("comment-" + text) +1074 def close(self): +1075 return "DONE" +1076 +1077 parser = self.etree.XMLParser(target=Target()) +1078 +1079 parser.feed(_bytes('<!--a--><root>A<!--b--><sub/><!--c-->B</root><!--d-->')) +1080 done = parser.close() +1081 +1082 self.assertEqual("DONE", done) +1083 self.assertEqual(["comment-a", "start-root", "data-A", "comment-b", +1084 "start-sub", "end-sub", "comment-c", "data-B", +1085 "end-root", "comment-d"], +1086 events) +1087 +
1088 - def test_parser_target_pi(self): +
1089 events = [] +1090 class Target(object): +1091 def start(self, tag, attrib): +1092 events.append("start-" + tag) +
1093 def end(self, tag): +1094 events.append("end-" + tag) +1095 def data(self, data): +1096 events.append("data-" + data) +1097 def pi(self, target, data): +1098 events.append("pi-" + target + "-" + data) +1099 def close(self): +1100 return "DONE" +1101 +1102 parser = self.etree.XMLParser(target=Target()) +1103 +1104 parser.feed(_bytes('<?test a?><root>A<?test b?>B</root><?test c?>')) +1105 done = parser.close() +1106 +1107 self.assertEqual("DONE", done) +1108 self.assertEqual(["pi-test-a", "start-root", "data-A", "pi-test-b", +1109 "data-B", "end-root", "pi-test-c"], +1110 events) +1111 +
1112 - def test_parser_target_cdata(self): +
1113 events = [] +1114 class Target(object): +1115 def start(self, tag, attrib): +1116 events.append("start-" + tag) +
1117 def end(self, tag): +1118 events.append("end-" + tag) +1119 def data(self, data): +1120 events.append("data-" + data) +1121 def close(self): +1122 return "DONE" +1123 +1124 parser = self.etree.XMLParser(target=Target(), +1125 strip_cdata=False) +1126 +1127 parser.feed(_bytes('<root>A<a><![CDATA[ca]]></a>B</root>')) +1128 done = parser.close() +1129 +1130 self.assertEqual("DONE", done) +1131 self.assertEqual(["start-root", "data-A", "start-a", +1132 "data-ca", "end-a", "data-B", "end-root"], +1133 events) +1134 +
1135 - def test_parser_target_recover(self): +
1136 events = [] +1137 class Target(object): +1138 def start(self, tag, attrib): +1139 events.append("start-" + tag) +
1140 def end(self, tag): +1141 events.append("end-" + tag) +1142 def data(self, data): +1143 events.append("data-" + data) +1144 def close(self): +1145 events.append("close") +1146 return "DONE" +1147 +1148 parser = self.etree.XMLParser(target=Target(), +1149 recover=True) +1150 +1151 parser.feed(_bytes('<root>A<a>ca</a>B</not-root>')) +1152 done = parser.close() +1153 +1154 self.assertEqual("DONE", done) +1155 self.assertEqual(["start-root", "data-A", "start-a", +1156 "data-ca", "end-a", "data-B", +1157 "end-root", "close"], +1158 events) +1159 +
1160 - def test_iterwalk_tag(self): +
1161 iterwalk = self.etree.iterwalk +1162 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) +1163 +1164 iterator = iterwalk(root, tag="b", events=('start', 'end')) +1165 events = list(iterator) +1166 self.assertEqual( +1167 [('start', root[0]), ('end', root[0])], +1168 events) +
1169 +
1170 - def test_iterwalk_tag_all(self): +
1171 iterwalk = self.etree.iterwalk +1172 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) +1173 +1174 iterator = iterwalk(root, tag="*", events=('start', 'end')) +1175 events = list(iterator) +1176 self.assertEqual( +1177 8, +1178 len(events)) +
1179 +
1180 - def test_iterwalk(self): +
1181 iterwalk = self.etree.iterwalk +1182 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) +1183 +1184 events = list(iterwalk(root)) +1185 self.assertEqual( +1186 [('end', root[0]), ('end', root[1]), ('end', root)], +1187 events) +
1188 +
1190 iterwalk = self.etree.iterwalk +1191 root = self.etree.XML( +1192 b'<!--C0--><a><!--Ca--><b><!--Cb--></b><!--Cc--><c/></a><!--C99-->') +1193 +1194 iterator = iterwalk(root, events=('start', 'end', 'comment')) +1195 events = list(iterator) +1196 self.assertEqual( +1197 [('start', root), ('comment', root[0]), +1198 ('start', root[1]), ('comment', root[1][0]), ('end', root[1]), +1199 ('comment', root[2]), ('start', root[3]), ('end', root[3]), +1200 ('end', root), +1201 ], +1202 events) +
1203 +
1204 - def test_iterwalk_comments_tree(self): +
1205 iterwalk = self.etree.iterwalk +1206 root = self.etree.XML( +1207 b'<!--C0--><a><!--Ca--><b><!--Cb--></b><!--Cc--><c/></a><!--C99-->') +1208 +1209 iterator = iterwalk(self.etree.ElementTree(root), events=('start', 'end', 'comment')) +1210 events = list(iterator) +1211 self.assertEqual( +1212 [('comment', root.getprevious()), +1213 ('start', root), ('comment', root[0]), # <a> +1214 ('start', root[1]), ('comment', root[1][0]), ('end', root[1]), # <b> +1215 ('comment', root[2]), ('start', root[3]), ('end', root[3]), # <c> +1216 ('end', root), ('comment', root.getnext()), +1217 ], +1218 events) +
1219 +
1221 iterwalk = self.etree.iterwalk +1222 root = self.etree.XML( +1223 b'<?C0?><a><?Ca?><b><?Cb?></b><?Cc?><c/></a><?C99?>') +1224 +1225 iterator = iterwalk(root, events=('start', 'end', 'pi')) +1226 events = list(iterator) +1227 self.assertEqual( +1228 [('start', root), ('pi', root[0]), +1229 ('start', root[1]), ('pi', root[1][0]), ('end', root[1]), +1230 ('pi', root[2]), ('start', root[3]), ('end', root[3]), +1231 ('end', root), +1232 ], +1233 events) +
1234 +
1235 - def test_iterwalk_pis_tree(self): +
1236 iterwalk = self.etree.iterwalk +1237 root = self.etree.XML( +1238 b'<?C0?><a><?Ca?><b><?Cb?></b><?Cc?><c/></a><?C99?>') +1239 +1240 iterator = iterwalk(self.etree.ElementTree(root), events=('start', 'end', 'pi')) +1241 events = list(iterator) +1242 self.assertEqual( +1243 [('pi', root.getprevious()), +1244 ('start', root), ('pi', root[0]), # <a> +1245 ('start', root[1]), ('pi', root[1][0]), ('end', root[1]), # <b> +1246 ('pi', root[2]), ('start', root[3]), ('end', root[3]), # <c> +1247 ('end', root), ('pi', root.getnext()), +1248 ], +1249 events) +
1250 +
1252 iterwalk = self.etree.iterwalk +1253 root = self.etree.XML( +1254 b'<!--C0--><?C0?><!--C1--><a><?Ca?><b><!--Cb--></b><?Cc?><c/></a><!--C99--><?C99?>') +1255 +1256 iterator = iterwalk(self.etree.ElementTree(root), events=('start', 'end', 'pi', 'comment')) +1257 events = list(iterator) +1258 self.assertEqual( +1259 [('comment', root.getprevious().getprevious().getprevious()), +1260 ('pi', root.getprevious().getprevious()), +1261 ('comment', root.getprevious()), +1262 ('start', root), ('pi', root[0]), # <a> +1263 ('start', root[1]), ('comment', root[1][0]), ('end', root[1]), # <b> +1264 ('pi', root[2]), ('start', root[3]), ('end', root[3]), # <c> +1265 ('end', root), ('comment', root.getnext()), ('pi', root.getnext().getnext()), +1266 ], +1267 events) +
1268 +
1270 iterwalk = self.etree.iterwalk +1271 root = self.etree.XML( +1272 b'<!--C0--><?C0?><!--C1--><a><?Ca?><b><!--Cb--></b><?Cc?><c/></a><!--C99--><?C99?>') +1273 +1274 iterator = iterwalk(self.etree.ElementTree(root), events=('start', 'end')) +1275 events = list(iterator) +1276 self.assertEqual( +1277 [('start', root), # <a> +1278 ('start', root[1]), ('end', root[1]), # <b> +1279 ('start', root[3]), ('end', root[3]), # <c> +1280 ('end', root), +1281 ], +1282 events) +
1283 +
1284 - def test_iterwalk_start(self): +
1285 iterwalk = self.etree.iterwalk +1286 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) +1287 +1288 iterator = iterwalk(root, events=('start',)) +1289 events = list(iterator) +1290 self.assertEqual( +1291 [('start', root), ('start', root[0]), ('start', root[1])], +1292 events) +
1293 +
1294 - def test_iterwalk_start_end(self): +
1295 iterwalk = self.etree.iterwalk +1296 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) +1297 +1298 iterator = iterwalk(root, events=('start','end')) +1299 events = list(iterator) +1300 self.assertEqual( +1301 [('start', root), ('start', root[0]), ('end', root[0]), +1302 ('start', root[1]), ('end', root[1]), ('end', root)], +1303 events) +
1304 +
1305 - def test_iterwalk_start_tags(self): +
1306 iterwalk = self.etree.iterwalk +1307 root = self.etree.XML(_bytes('<a><b></b><c/><b><d/></b></a>')) +1308 +1309 iterator = iterwalk(root, events=('start',), tag='b') +1310 events = list(iterator) +1311 self.assertEqual( +1312 [('start', root[0]), ('start', root[2])], +1313 events) +
1314 +
1316 iterwalk = self.etree.iterwalk +1317 root = self.etree.XML(_bytes('<a><b></b><c/><b><d/></b></a>')) +1318 +1319 iterator = iterwalk(root, events=('start', 'end'), tag='b') +1320 events = list(iterator) +1321 self.assertEqual( +1322 [('start', root[0]), ('end', root[0]), ('start', root[2]), ('end', root[2])], +1323 events) +
1324 +
1326 iterwalk = self.etree.iterwalk +1327 root = self.etree.XML(_bytes('<a><b></b><c/><b><d/></b></a>')) +1328 +1329 iterator = iterwalk(root, events=('start', 'end'), tag=('b', 'a')) +1330 events = list(iterator) +1331 self.assertEqual( +1332 [('start', root), +1333 ('start', root[0]), ('end', root[0]), +1334 ('start', root[2]), ('end', root[2]), +1335 ('end', root), +1336 ], +1337 events) +
1338 +
1339 - def test_iterwalk_clear(self): +
1340 iterwalk = self.etree.iterwalk +1341 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) +1342 +1343 iterator = iterwalk(root) +1344 for event, elem in iterator: +1345 elem.clear() +1346 +1347 self.assertEqual(0, +1348 len(root)) +
1349 +
1350 - def test_iterwalk_attrib_ns(self): +
1351 iterwalk = self.etree.iterwalk +1352 root = self.etree.XML(_bytes('<a xmlns="ns1"><b><c xmlns="ns2"/></b></a>')) +1353 +1354 attr_name = '{testns}bla' +1355 events = [] +1356 iterator = iterwalk(root, events=('start','end','start-ns','end-ns')) +1357 for event, elem in iterator: +1358 events.append(event) +1359 if event == 'start': +1360 if elem.tag != '{ns1}a': +1361 elem.set(attr_name, 'value') +1362 +1363 self.assertEqual( +1364 ['start-ns', 'start', 'start', 'start-ns', 'start', +1365 'end', 'end-ns', 'end', 'end', 'end-ns'], +1366 events) +1367 +1368 self.assertEqual( +1369 None, +1370 root.get(attr_name)) +1371 self.assertEqual( +1372 'value', +1373 root[0].get(attr_name)) +
1374 +
1375 - def test_iterwalk_end_skip(self): +
1376 iterwalk = self.etree.iterwalk +1377 root = self.etree.XML(_bytes('<a><b><c/></b><d><e/></d></a>')) +1378 +1379 iterator = iterwalk(root) +1380 tags = [] +1381 for event, elem in iterator: +1382 tags.append(elem.tag) +1383 # requesting a skip after an 'end' event should never have an effect +1384 iterator.skip_subtree() +1385 +1386 self.assertEqual(['c', 'b', 'e', 'd', 'a'], tags) +
1387 +
1389 iterwalk = self.etree.iterwalk +1390 root = self.etree.XML(_bytes('<a><b><c/></b><d><e/></d></a>')) +1391 +1392 iterator = iterwalk(root, events=('start', 'end')) +1393 tags = [] +1394 for event, elem in iterator: +1395 tags.append((event, elem.tag)) +1396 if elem.tag in ('b', 'e'): +1397 # skipping should only have an effect on 'start', not on 'end' +1398 iterator.skip_subtree() +1399 +1400 self.assertEqual( +1401 [('start', 'a'), +1402 ('start', 'b'), ('end', 'b'), # ignored child 'c' +1403 ('start', 'd'), +1404 ('start', 'e'), ('end', 'e'), +1405 ('end', 'd'), +1406 ('end', 'a')], +1407 tags) +
1408 +
1409 - def test_iterwalk_ns_skip(self): +
1410 iterwalk = self.etree.iterwalk +1411 root = self.etree.XML(_bytes( +1412 '<a xmlns="ns1"><b xmlns="nsb"><c xmlns="ns2"/></b><d xmlns="ns2"><e/></d></a>')) +1413 +1414 events = [] +1415 iterator = iterwalk(root, events=('start','start-ns','end-ns')) +1416 for event, elem in iterator: +1417 if event in ('start-ns', 'end-ns'): +1418 events.append((event, elem)) +1419 if event == 'start-ns' and elem == ('', 'nsb'): +1420 events.append('skip') +1421 iterator.skip_subtree() +1422 else: +1423 events.append((event, elem.tag)) +1424 +1425 self.assertEqual( +1426 [('start-ns', ('', 'ns1')), +1427 ('start', '{ns1}a'), +1428 ('start-ns', ('', 'nsb')), +1429 'skip', +1430 ('start', '{nsb}b'), +1431 ('end-ns', None), +1432 ('start-ns', ('', 'ns2')), +1433 ('start', '{ns2}d'), +1434 ('start', '{ns2}e'), +1435 ('end-ns', None), +1436 ('end-ns', None) +1437 ], +1438 events) +
1439 +
1440 - def test_iterwalk_getiterator(self): +
1441 iterwalk = self.etree.iterwalk +1442 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) +1443 +1444 counts = [] +1445 for event, elem in iterwalk(root): +1446 counts.append(len(list(elem.getiterator()))) +1447 self.assertEqual( +1448 [1,2,1,4], +1449 counts) +
1450 +
1451 - def test_itertext_comment_pi(self): +
1452 # https://bugs.launchpad.net/lxml/+bug/1844674 +1453 XML = self.etree.XML +1454 root = XML(_bytes( +1455 "<root>RTEXT<a></a>ATAIL<b/><!-- COMMENT -->CTAIL<?PI PITEXT?> PITAIL </root>" +1456 )) +1457 +1458 text = list(root.itertext()) +1459 self.assertEqual(["RTEXT", "ATAIL", "CTAIL", " PITAIL "], +1460 text) +
1461 +
1462 - def test_resolve_string_dtd(self): +
1463 parse = self.etree.parse +1464 parser = self.etree.XMLParser(dtd_validation=True) +1465 assertEqual = self.assertEqual +1466 test_url = _str("__nosuch.dtd") +1467 +1468 class MyResolver(self.etree.Resolver): +1469 def resolve(self, url, id, context): +1470 assertEqual(url, test_url) +1471 return self.resolve_string( +1472 _str('''<!ENTITY myentity "%s"> +1473 <!ELEMENT doc ANY>''') % url, context) +
1474 +1475 parser.resolvers.add(MyResolver()) +1476 +1477 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url +1478 tree = parse(StringIO(xml), parser) +1479 root = tree.getroot() +1480 self.assertEqual(root.text, test_url) +1481 +
1482 - def test_resolve_bytes_dtd(self): +
1483 parse = self.etree.parse +1484 parser = self.etree.XMLParser(dtd_validation=True) +1485 assertEqual = self.assertEqual +1486 test_url = _str("__nosuch.dtd") +1487 +1488 class MyResolver(self.etree.Resolver): +1489 def resolve(self, url, id, context): +1490 assertEqual(url, test_url) +1491 return self.resolve_string( +1492 (_str('''<!ENTITY myentity "%s"> +1493 <!ELEMENT doc ANY>''') % url).encode('utf-8'), +1494 context) +
1495 +1496 parser.resolvers.add(MyResolver()) +1497 +1498 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url +1499 tree = parse(StringIO(xml), parser) +1500 root = tree.getroot() +1501 self.assertEqual(root.text, test_url) +1502 +
1503 - def test_resolve_filelike_dtd(self): +
1504 parse = self.etree.parse +1505 parser = self.etree.XMLParser(dtd_validation=True) +1506 assertEqual = self.assertEqual +1507 test_url = _str("__nosuch.dtd") +1508 +1509 class MyResolver(self.etree.Resolver): +1510 def resolve(self, url, id, context): +1511 assertEqual(url, test_url) +1512 return self.resolve_file( +1513 SillyFileLike( +1514 _str('''<!ENTITY myentity "%s"> +1515 <!ELEMENT doc ANY>''') % url), context) +
1516 +1517 parser.resolvers.add(MyResolver()) +1518 +1519 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url +1520 tree = parse(StringIO(xml), parser) +1521 root = tree.getroot() +1522 self.assertEqual(root.text, test_url) +1523 +
1524 - def test_resolve_filename_dtd(self): +
1525 parse = self.etree.parse +1526 parser = self.etree.XMLParser(attribute_defaults=True) +1527 assertEqual = self.assertEqual +1528 test_url = _str("__nosuch.dtd") +1529 +1530 class MyResolver(self.etree.Resolver): +1531 def resolve(self, url, id, context): +1532 assertEqual(url, test_url) +1533 return self.resolve_filename( +1534 fileInTestDir('test.dtd'), context) +
1535 +1536 parser.resolvers.add(MyResolver()) +1537 +1538 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url +1539 tree = parse(StringIO(xml), parser) +1540 root = tree.getroot() +1541 self.assertEqual( +1542 root.attrib, {'default': 'valueA'}) +1543 self.assertEqual( +1544 root[0].attrib, {'default': 'valueB'}) +1545 +
1547 parse = self.etree.parse +1548 parser = self.etree.XMLParser(attribute_defaults=True) +1549 assertEqual = self.assertEqual +1550 test_url = _str("__nosuch.dtd") +1551 +1552 class MyResolver(self.etree.Resolver): +1553 def resolve(self, url, id, context): +1554 expected = fileUrlInTestDir(test_url) +1555 url = url.replace('file://', 'file:') # depends on libxml2 version +1556 expected = expected.replace('file://', 'file:') +1557 assertEqual(url, expected) +1558 return self.resolve_filename( +1559 fileUrlInTestDir('test.dtd'), context) +
1560 +1561 parser.resolvers.add(MyResolver()) +1562 +1563 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url +1564 tree = parse(StringIO(xml), parser, +1565 base_url=fileUrlInTestDir('__test.xml')) +1566 root = tree.getroot() +1567 self.assertEqual( +1568 root.attrib, {'default': 'valueA'}) +1569 self.assertEqual( +1570 root[0].attrib, {'default': 'valueB'}) +1571 +
1572 - def test_resolve_file_dtd(self): +
1573 parse = self.etree.parse +1574 parser = self.etree.XMLParser(attribute_defaults=True) +1575 assertEqual = self.assertEqual +1576 test_url = _str("__nosuch.dtd") +1577 +1578 class MyResolver(self.etree.Resolver): +1579 def resolve(self, url, id, context): +1580 assertEqual(url, test_url) +1581 return self.resolve_file( +1582 open(fileInTestDir('test.dtd'), 'rb'), context) +
1583 +1584 parser.resolvers.add(MyResolver()) +1585 +1586 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url +1587 tree = parse(StringIO(xml), parser) +1588 root = tree.getroot() +1589 self.assertEqual( +1590 root.attrib, {'default': 'valueA'}) +1591 self.assertEqual( +1592 root[0].attrib, {'default': 'valueB'}) +1593 +
1594 - def test_resolve_empty(self): +
1595 parse = self.etree.parse +1596 parser = self.etree.XMLParser(load_dtd=True) +1597 assertEqual = self.assertEqual +1598 test_url = _str("__nosuch.dtd") +1599 +1600 class check(object): +1601 resolved = False +
1602 +1603 class MyResolver(self.etree.Resolver): +1604 def resolve(self, url, id, context): +1605 assertEqual(url, test_url) +1606 check.resolved = True +1607 return self.resolve_empty(context) +1608 +1609 parser.resolvers.add(MyResolver()) +1610 +1611 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url +1612 self.assertRaises(etree.XMLSyntaxError, parse, StringIO(xml), parser) +1613 self.assertTrue(check.resolved) +1614 +
1615 - def test_resolve_error(self): +
1616 parse = self.etree.parse +1617 parser = self.etree.XMLParser(dtd_validation=True) +1618 +1619 class _LocalException(Exception): +1620 pass +
1621 +1622 class MyResolver(self.etree.Resolver): +1623 def resolve(self, url, id, context): +1624 raise _LocalException +1625 +1626 parser.resolvers.add(MyResolver()) +1627 +1628 xml = '<!DOCTYPE doc SYSTEM "test"><doc>&myentity;</doc>' +1629 self.assertRaises(_LocalException, parse, BytesIO(xml), parser) +1630 +
1631 - def test_entity_parse(self): +
1632 parse = self.etree.parse +1633 tostring = self.etree.tostring +1634 parser = self.etree.XMLParser(resolve_entities=False) +1635 Entity = self.etree.Entity +1636 +1637 xml = _bytes('<!DOCTYPE doc SYSTEM "test"><doc>&myentity;</doc>') +1638 tree = parse(BytesIO(xml), parser) +1639 root = tree.getroot() +1640 self.assertEqual(root[0].tag, Entity) +1641 self.assertEqual(root[0].text, "&myentity;") +1642 self.assertEqual(root[0].tail, None) +1643 self.assertEqual(root[0].name, "myentity") +1644 +1645 self.assertEqual(_bytes('<doc>&myentity;</doc>'), +1646 tostring(root)) +
1647 +
1648 - def test_entity_restructure(self): +
1649 xml = _bytes('''<!DOCTYPE root [ <!ENTITY nbsp "&#160;"> ]> +1650 <root> +1651 <child1/> +1652 <child2/> +1653 <child3>&nbsp;</child3> +1654 </root>''') +1655 +1656 parser = self.etree.XMLParser(resolve_entities=False) +1657 root = etree.fromstring(xml, parser) +1658 self.assertEqual([ el.tag for el in root ], +1659 ['child1', 'child2', 'child3']) +1660 +1661 root[0] = root[-1] +1662 self.assertEqual([ el.tag for el in root ], +1663 ['child3', 'child2']) +1664 self.assertEqual(root[0][0].text, '&nbsp;') +1665 self.assertEqual(root[0][0].name, 'nbsp') +
1666 +
1667 - def test_entity_append(self): +
1668 Entity = self.etree.Entity +1669 Element = self.etree.Element +1670 tostring = self.etree.tostring +1671 +1672 root = Element("root") +1673 root.append( Entity("test") ) +1674 +1675 self.assertEqual(root[0].tag, Entity) +1676 self.assertEqual(root[0].text, "&test;") +1677 self.assertEqual(root[0].tail, None) +1678 self.assertEqual(root[0].name, "test") +1679 +1680 self.assertEqual(_bytes('<root>&test;</root>'), +1681 tostring(root)) +
1682 +
1683 - def test_entity_append_parsed(self): +
1684 Entity = self.etree.Entity +1685 Element = self.etree.Element +1686 parser = self.etree.XMLParser(resolve_entities=False) +1687 entity = self.etree.XML('''<!DOCTYPE data [ +1688 <!ENTITY a "a"> +1689 <!ENTITY b "&a;"> +1690 ]> +1691 <data>&b;</data> +1692 ''', parser) +1693 +1694 el = Element('test') +1695 el.append(entity) +1696 self.assertEqual(el.tag, 'test') +1697 self.assertEqual(el[0].tag, 'data') +1698 self.assertEqual(el[0][0].tag, Entity) +1699 self.assertEqual(el[0][0].name, 'b') +
1700 +
1701 - def test_entity_values(self): +
1702 Entity = self.etree.Entity +1703 self.assertEqual(Entity("test").text, '&test;') +1704 self.assertEqual(Entity("#17683").text, '&#17683;') +1705 self.assertEqual(Entity("#x1768").text, '&#x1768;') +1706 self.assertEqual(Entity("#x98AF").text, '&#x98AF;') +
1707 +
1708 - def test_entity_error(self): +
1709 Entity = self.etree.Entity +1710 self.assertRaises(ValueError, Entity, 'a b c') +1711 self.assertRaises(ValueError, Entity, 'a,b') +1712 self.assertRaises(ValueError, Entity, 'a\0b') +1713 self.assertRaises(ValueError, Entity, '#abc') +1714 self.assertRaises(ValueError, Entity, '#xxyz') +
1715 +
1716 - def test_cdata(self): +
1717 CDATA = self.etree.CDATA +1718 Element = self.etree.Element +1719 tostring = self.etree.tostring +1720 +1721 root = Element("root") +1722 root.text = CDATA('test') +1723 +1724 self.assertEqual('test', +1725 root.text) +1726 self.assertEqual(_bytes('<root><![CDATA[test]]></root>'), +1727 tostring(root)) +
1728 +
1729 - def test_cdata_tail(self): +
1730 CDATA = self.etree.CDATA +1731 Element = self.etree.Element +1732 SubElement = self.etree.SubElement +1733 tostring = self.etree.tostring +1734 +1735 root = Element("root") +1736 child = SubElement(root, 'child') +1737 child.tail = CDATA('test') +1738 +1739 self.assertEqual('test', child.tail) +1740 self.assertEqual(_bytes('<root><child/><![CDATA[test]]></root>'), +1741 tostring(root)) +1742 +1743 root = Element("root") +1744 root.tail = CDATA('test') +1745 +1746 self.assertEqual('test', root.tail) +1747 self.assertEqual(_bytes('<root/><![CDATA[test]]>'), +1748 tostring(root)) +
1749 +
1750 - def test_cdata_type(self): +
1751 CDATA = self.etree.CDATA +1752 Element = self.etree.Element +1753 root = Element("root") +1754 +1755 root.text = CDATA("test") +1756 self.assertEqual('test', root.text) +1757 +1758 root.text = CDATA(_str("test")) +1759 self.assertEqual('test', root.text) +1760 +1761 self.assertRaises(TypeError, CDATA, 1) +
1762 +
1763 - def test_cdata_errors(self): +
1764 CDATA = self.etree.CDATA +1765 Element = self.etree.Element +1766 +1767 root = Element("root") +1768 cdata = CDATA('test') +1769 +1770 self.assertRaises(TypeError, +1771 root.set, 'attr', cdata) +1772 self.assertRaises(TypeError, +1773 operator.setitem, root.attrib, 'attr', cdata) +
1774 +
1775 - def test_cdata_parser(self): +
1776 tostring = self.etree.tostring +1777 parser = self.etree.XMLParser(strip_cdata=False) +1778 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>'), parser) +1779 +1780 self.assertEqual('test', root.text) +1781 self.assertEqual(_bytes('<root><![CDATA[test]]></root>'), +1782 tostring(root)) +
1783 +
1784 - def test_cdata_xpath(self): +
1785 tostring = self.etree.tostring +1786 parser = self.etree.XMLParser(strip_cdata=False) +1787 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>'), parser) +1788 self.assertEqual(_bytes('<root><![CDATA[test]]></root>'), +1789 tostring(root)) +1790 +1791 self.assertEqual(['test'], root.xpath('//text()')) +
1792 +1793 # TypeError in etree, AssertionError in ElementTree; +
1794 - def test_setitem_assert(self): +
1795 Element = self.etree.Element +1796 SubElement = self.etree.SubElement +1797 +1798 a = Element('a') +1799 b = SubElement(a, 'b') +1800 +1801 self.assertRaises(TypeError, +1802 a.__setitem__, 0, 'foo') +
1803 +
1804 - def test_append_error(self): +
1805 Element = self.etree.Element +1806 root = Element('root') +1807 # raises AssertionError in ElementTree +1808 self.assertRaises(TypeError, root.append, None) +1809 self.assertRaises(TypeError, root.extend, [None]) +1810 self.assertRaises(TypeError, root.extend, [Element('one'), None]) +1811 self.assertEqual('one', root[0].tag) +
1812 +
1813 - def test_append_recursive_error(self): +
1814 Element = self.etree.Element +1815 SubElement = self.etree.SubElement +1816 root = Element('root') +1817 self.assertRaises(ValueError, root.append, root) +1818 child = SubElement(root, 'child') +1819 self.assertRaises(ValueError, child.append, root) +1820 child2 = SubElement(child, 'child2') +1821 self.assertRaises(ValueError, child2.append, root) +1822 self.assertRaises(ValueError, child2.append, child) +1823 self.assertEqual('child2', root[0][0].tag) +
1824 +
1825 - def test_addnext(self): +
1826 Element = self.etree.Element +1827 SubElement = self.etree.SubElement +1828 root = Element('root') +1829 SubElement(root, 'a') +1830 SubElement(root, 'b') +1831 +1832 self.assertEqual(['a', 'b'], +1833 [c.tag for c in root]) +1834 root[1].addnext(root[0]) +1835 self.assertEqual(['b', 'a'], +1836 [c.tag for c in root]) +
1837 +
1838 - def test_addprevious(self): +
1839 Element = self.etree.Element +1840 SubElement = self.etree.SubElement +1841 root = Element('root') +1842 SubElement(root, 'a') +1843 SubElement(root, 'b') +1844 +1845 self.assertEqual(['a', 'b'], +1846 [c.tag for c in root]) +1847 root[0].addprevious(root[1]) +1848 self.assertEqual(['b', 'a'], +1849 [c.tag for c in root]) +
1850 +
1851 - def test_addnext_cycle(self): +
1852 Element = self.etree.Element +1853 SubElement = self.etree.SubElement +1854 root = Element('root') +1855 a = SubElement(root, 'a') +1856 b = SubElement(a, 'b') +1857 # appending parent as sibling is forbidden +1858 self.assertRaises(ValueError, b.addnext, a) +1859 self.assertEqual(['a'], [c.tag for c in root]) +1860 self.assertEqual(['b'], [c.tag for c in a]) +
1861 +
1862 - def test_addprevious_cycle(self): +
1863 Element = self.etree.Element +1864 SubElement = self.etree.SubElement +1865 root = Element('root') +1866 a = SubElement(root, 'a') +1867 b = SubElement(a, 'b') +1868 # appending parent as sibling is forbidden +1869 self.assertRaises(ValueError, b.addprevious, a) +1870 self.assertEqual(['a'], [c.tag for c in root]) +1871 self.assertEqual(['b'], [c.tag for c in a]) +
1872 +
1873 - def test_addnext_cycle_long(self): +
1874 Element = self.etree.Element +1875 SubElement = self.etree.SubElement +1876 root = Element('root') +1877 a = SubElement(root, 'a') +1878 b = SubElement(a, 'b') +1879 c = SubElement(b, 'c') +1880 # appending parent as sibling is forbidden +1881 self.assertRaises(ValueError, c.addnext, a) +
1882 +
1883 - def test_addprevious_cycle_long(self): +
1884 Element = self.etree.Element +1885 SubElement = self.etree.SubElement +1886 root = Element('root') +1887 a = SubElement(root, 'a') +1888 b = SubElement(a, 'b') +1889 c = SubElement(b, 'c') +1890 # appending parent as sibling is forbidden +1891 self.assertRaises(ValueError, c.addprevious, a) +
1892 +
1893 - def test_addprevious_noops(self): +
1894 Element = self.etree.Element +1895 SubElement = self.etree.SubElement +1896 root = Element('root') +1897 a = SubElement(root, 'a') +1898 b = SubElement(root, 'b') +1899 a.addprevious(a) +1900 self.assertEqual('a', root[0].tag) +1901 self.assertEqual('b', root[1].tag) +1902 b.addprevious(b) +1903 self.assertEqual('a', root[0].tag) +1904 self.assertEqual('b', root[1].tag) +1905 b.addprevious(a) +1906 self.assertEqual('a', root[0].tag) +1907 self.assertEqual('b', root[1].tag) +
1908 +
1909 - def test_addnext_noops(self): +
1910 Element = self.etree.Element +1911 SubElement = self.etree.SubElement +1912 root = Element('root') +1913 a = SubElement(root, 'a') +1914 b = SubElement(root, 'b') +1915 a.addnext(a) +1916 self.assertEqual('a', root[0].tag) +1917 self.assertEqual('b', root[1].tag) +1918 b.addnext(b) +1919 self.assertEqual('a', root[0].tag) +1920 self.assertEqual('b', root[1].tag) +1921 a.addnext(b) +1922 self.assertEqual('a', root[0].tag) +1923 self.assertEqual('b', root[1].tag) +
1924 +
1925 - def test_addnext_root(self): +
1926 Element = self.etree.Element +1927 a = Element('a') +1928 b = Element('b') +1929 self.assertRaises(TypeError, a.addnext, b) +
1930 +
1931 - def test_addprevious_pi(self): +
1932 Element = self.etree.Element +1933 SubElement = self.etree.SubElement +1934 PI = self.etree.PI +1935 root = Element('root') +1936 SubElement(root, 'a') +1937 pi = PI('TARGET', 'TEXT') +1938 pi.tail = "TAIL" +1939 +1940 self.assertEqual(_bytes('<root><a></a></root>'), +1941 self._writeElement(root)) +1942 root[0].addprevious(pi) +1943 self.assertEqual(_bytes('<root><?TARGET TEXT?>TAIL<a></a></root>'), +1944 self._writeElement(root)) +
1945 +
1946 - def test_addprevious_root_pi(self): +
1947 Element = self.etree.Element +1948 PI = self.etree.PI +1949 root = Element('root') +1950 pi = PI('TARGET', 'TEXT') +1951 pi.tail = "TAIL" +1952 +1953 self.assertEqual(_bytes('<root></root>'), +1954 self._writeElement(root)) +1955 root.addprevious(pi) +1956 self.assertEqual(_bytes('<?TARGET TEXT?>\n<root></root>'), +1957 self._writeElement(root)) +
1958 +
1959 - def test_addnext_pi(self): +
1960 Element = self.etree.Element +1961 SubElement = self.etree.SubElement +1962 PI = self.etree.PI +1963 root = Element('root') +1964 SubElement(root, 'a') +1965 pi = PI('TARGET', 'TEXT') +1966 pi.tail = "TAIL" +1967 +1968 self.assertEqual(_bytes('<root><a></a></root>'), +1969 self._writeElement(root)) +1970 root[0].addnext(pi) +1971 self.assertEqual(_bytes('<root><a></a><?TARGET TEXT?>TAIL</root>'), +1972 self._writeElement(root)) +
1973 +
1974 - def test_addnext_root_pi(self): +
1975 Element = self.etree.Element +1976 PI = self.etree.PI +1977 root = Element('root') +1978 pi = PI('TARGET', 'TEXT') +1979 pi.tail = "TAIL" +1980 +1981 self.assertEqual(_bytes('<root></root>'), +1982 self._writeElement(root)) +1983 root.addnext(pi) +1984 self.assertEqual(_bytes('<root></root>\n<?TARGET TEXT?>'), +1985 self._writeElement(root)) +
1986 +
1987 - def test_addnext_comment(self): +
1988 Element = self.etree.Element +1989 SubElement = self.etree.SubElement +1990 Comment = self.etree.Comment +1991 root = Element('root') +1992 SubElement(root, 'a') +1993 comment = Comment('TEXT ') +1994 comment.tail = "TAIL" +1995 +1996 self.assertEqual(_bytes('<root><a></a></root>'), +1997 self._writeElement(root)) +1998 root[0].addnext(comment) +1999 self.assertEqual(_bytes('<root><a></a><!--TEXT -->TAIL</root>'), +2000 self._writeElement(root)) +
2001 +
2002 - def test_addnext_root_comment(self): +
2003 Element = self.etree.Element +2004 Comment = self.etree.Comment +2005 root = Element('root') +2006 comment = Comment('TEXT ') +2007 comment.tail = "TAIL" +2008 +2009 self.assertEqual(_bytes('<root></root>'), +2010 self._writeElement(root)) +2011 root.addnext(comment) +2012 self.assertEqual(_bytes('<root></root>\n<!--TEXT -->'), +2013 self._writeElement(root)) +
2014 +
2015 - def test_addprevious_comment(self): +
2016 Element = self.etree.Element +2017 SubElement = self.etree.SubElement +2018 Comment = self.etree.Comment +2019 root = Element('root') +2020 SubElement(root, 'a') +2021 comment = Comment('TEXT ') +2022 comment.tail = "TAIL" +2023 +2024 self.assertEqual(_bytes('<root><a></a></root>'), +2025 self._writeElement(root)) +2026 root[0].addprevious(comment) +2027 self.assertEqual(_bytes('<root><!--TEXT -->TAIL<a></a></root>'), +2028 self._writeElement(root)) +
2029 +
2031 Element = self.etree.Element +2032 Comment = self.etree.Comment +2033 root = Element('root') +2034 comment = Comment('TEXT ') +2035 comment.tail = "TAIL" +2036 +2037 self.assertEqual(_bytes('<root></root>'), +2038 self._writeElement(root)) +2039 root.addprevious(comment) +2040 self.assertEqual(_bytes('<!--TEXT -->\n<root></root>'), +2041 self._writeElement(root)) +
2042 +2043 # ET's Elements have items() and key(), but not values() +
2044 - def test_attribute_values(self): +
2045 XML = self.etree.XML +2046 +2047 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) +2048 values = root.values() +2049 values.sort() +2050 self.assertEqual(['Alpha', 'Beta', 'Gamma'], values) +
2051 +2052 # gives error in ElementTree +
2053 - def test_comment_empty(self): +
2054 Element = self.etree.Element +2055 Comment = self.etree.Comment +2056 +2057 a = Element('a') +2058 a.append(Comment()) +2059 self.assertEqual( +2060 _bytes('<a><!----></a>'), +2061 self._writeElement(a)) +
2062 +2063 # ElementTree ignores comments +
2064 - def test_comment_parse_empty(self): +
2065 ElementTree = self.etree.ElementTree +2066 tostring = self.etree.tostring +2067 +2068 xml = _bytes('<a><b/><!----><c/></a>') +2069 f = BytesIO(xml) +2070 doc = ElementTree(file=f) +2071 a = doc.getroot() +2072 self.assertEqual( +2073 '', +2074 a[1].text) +2075 self.assertEqual( +2076 xml, +2077 tostring(a)) +
2078 +2079 # ElementTree ignores comments +
2080 - def test_comment_no_proxy_yet(self): +
2081 ElementTree = self.etree.ElementTree +2082 +2083 f = BytesIO('<a><b></b><!-- hoi --><c></c></a>') +2084 doc = ElementTree(file=f) +2085 a = doc.getroot() +2086 self.assertEqual( +2087 ' hoi ', +2088 a[1].text) +
2089 +2090 # does not raise an exception in ElementTree +
2091 - def test_comment_immutable(self): +
2092 Element = self.etree.Element +2093 Comment = self.etree.Comment +2094 +2095 c = Comment() +2096 el = Element('myel') +2097 +2098 self.assertRaises(TypeError, c.append, el) +2099 self.assertRaises(TypeError, c.insert, 0, el) +2100 self.assertRaises(TypeError, c.set, "myattr", "test") +
2101 +
2103 c = self.etree.Comment() +2104 self.assertEqual(0, len(c.attrib)) +2105 +2106 self.assertFalse(c.attrib.__contains__('nope')) +2107 self.assertFalse('nope' in c.attrib) +2108 self.assertFalse('nope' in c.attrib.keys()) +2109 self.assertFalse('nope' in c.attrib.values()) +2110 self.assertFalse(('nope', 'huhu') in c.attrib.items()) +2111 +2112 self.assertEqual([], list(c.attrib)) +2113 self.assertEqual([], list(c.attrib.keys())) +2114 self.assertEqual([], list(c.attrib.items())) +2115 self.assertEqual([], list(c.attrib.values())) +2116 self.assertEqual([], list(c.attrib.iterkeys())) +2117 self.assertEqual([], list(c.attrib.iteritems())) +2118 self.assertEqual([], list(c.attrib.itervalues())) +2119 +2120 self.assertEqual('HUHU', c.attrib.pop('nope', 'HUHU')) +2121 self.assertRaises(KeyError, c.attrib.pop, 'nope') +2122 +2123 self.assertRaises(KeyError, c.attrib.__getitem__, 'only') +2124 self.assertRaises(KeyError, c.attrib.__getitem__, 'names') +2125 self.assertRaises(KeyError, c.attrib.__getitem__, 'nope') +2126 self.assertRaises(KeyError, c.attrib.__setitem__, 'nope', 'yep') +2127 self.assertRaises(KeyError, c.attrib.__delitem__, 'nope') +
2128 +2129 # test passing 'None' to dump() +
2130 - def test_dump_none(self): +
2131 self.assertRaises(TypeError, self.etree.dump, None) +
2132 +
2133 - def test_prefix(self): +
2134 ElementTree = self.etree.ElementTree +2135 +2136 f = BytesIO('<a xmlns:foo="http://www.infrae.com/ns/1"><foo:b/></a>') +2137 doc = ElementTree(file=f) +2138 a = doc.getroot() +2139 self.assertEqual( +2140 None, +2141 a.prefix) +2142 self.assertEqual( +2143 'foo', +2144 a[0].prefix) +
2145 +
2146 - def test_prefix_default_ns(self): +
2147 ElementTree = self.etree.ElementTree +2148 +2149 f = BytesIO('<a xmlns="http://www.infrae.com/ns/1"><b/></a>') +2150 doc = ElementTree(file=f) +2151 a = doc.getroot() +2152 self.assertEqual( +2153 None, +2154 a.prefix) +2155 self.assertEqual( +2156 None, +2157 a[0].prefix) +
2158 +
2159 - def test_getparent(self): +
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(b, 'd') +2167 self.assertEqual( +2168 None, +2169 a.getparent()) +2170 self.assertEqual( +2171 a, +2172 b.getparent()) +2173 self.assertEqual( +2174 b.getparent(), +2175 c.getparent()) +2176 self.assertEqual( +2177 b, +2178 d.getparent()) +
2179 +
2180 - def test_iterchildren(self): +
2181 XML = self.etree.XML +2182 +2183 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) +2184 result = [] +2185 for el in root.iterchildren(): +2186 result.append(el.tag) +2187 self.assertEqual(['one', 'two', 'three'], result) +
2188 +
2189 - def test_iterchildren_reversed(self): +
2190 XML = self.etree.XML +2191 +2192 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) +2193 result = [] +2194 for el in root.iterchildren(reversed=True): +2195 result.append(el.tag) +2196 self.assertEqual(['three', 'two', 'one'], result) +
2197 +
2198 - def test_iterchildren_tag(self): +
2199 XML = self.etree.XML +2200 +2201 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two></doc>')) +2202 result = [] +2203 for el in root.iterchildren(tag='two'): +2204 result.append(el.text) +2205 self.assertEqual(['Two', 'Bla'], result) +
2206 +
2208 XML = self.etree.XML +2209 +2210 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two></doc>')) +2211 result = [] +2212 for el in root.iterchildren('two'): +2213 result.append(el.text) +2214 self.assertEqual(['Two', 'Bla'], result) +
2215 +
2217 XML = self.etree.XML +2218 +2219 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two></doc>')) +2220 result = [] +2221 for el in root.iterchildren(reversed=True, tag='two'): +2222 result.append(el.text) +2223 self.assertEqual(['Bla', 'Two'], result) +
2224 +
2226 XML = self.etree.XML +2227 +2228 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two><three/></doc>')) +2229 result = [] +2230 for el in root.iterchildren(tag=['two', 'three']): +2231 result.append(el.text) +2232 self.assertEqual(['Two', 'Bla', None], result) +
2233 +
2235 XML = self.etree.XML +2236 +2237 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two><three/></doc>')) +2238 result = [] +2239 for el in root.iterchildren('two', 'three'): +2240 result.append(el.text) +2241 self.assertEqual(['Two', 'Bla', None], result) +
2242 +
2244 XML = self.etree.XML +2245 +2246 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two><three/></doc>')) +2247 result = [] +2248 for el in root.iterchildren(reversed=True, tag=['two', 'three']): +2249 result.append(el.text) +2250 self.assertEqual([None, 'Bla', 'Two'], result) +
2251 +
2252 - def test_iterancestors(self): +
2253 Element = self.etree.Element +2254 SubElement = self.etree.SubElement +2255 +2256 a = Element('a') +2257 b = SubElement(a, 'b') +2258 c = SubElement(a, 'c') +2259 d = SubElement(b, 'd') +2260 self.assertEqual( +2261 [], +2262 list(a.iterancestors())) +2263 self.assertEqual( +2264 [a], +2265 list(b.iterancestors())) +2266 self.assertEqual( +2267 [a], +2268 list(c.iterancestors())) +2269 self.assertEqual( +2270 [b, a], +2271 list(d.iterancestors())) +
2272 +
2273 - def test_iterancestors_tag(self): +
2274 Element = self.etree.Element +2275 SubElement = self.etree.SubElement +2276 +2277 a = Element('a') +2278 b = SubElement(a, 'b') +2279 c = SubElement(a, 'c') +2280 d = SubElement(b, 'd') +2281 self.assertEqual( +2282 [a], +2283 list(d.iterancestors('a'))) +2284 self.assertEqual( +2285 [a], +2286 list(d.iterancestors(tag='a'))) +2287 +2288 self.assertEqual( +2289 [b, a], +2290 list(d.iterancestors('*'))) +2291 self.assertEqual( +2292 [b, a], +2293 list(d.iterancestors(tag='*'))) +
2294 +
2296 Element = self.etree.Element +2297 SubElement = self.etree.SubElement +2298 +2299 a = Element('a') +2300 b = SubElement(a, 'b') +2301 c = SubElement(a, 'c') +2302 d = SubElement(b, 'd') +2303 self.assertEqual( +2304 [b, a], +2305 list(d.iterancestors(tag=('a', 'b')))) +2306 self.assertEqual( +2307 [b, a], +2308 list(d.iterancestors('a', 'b'))) +2309 +2310 self.assertEqual( +2311 [], +2312 list(d.iterancestors(tag=('w', 'x', 'y', 'z')))) +2313 self.assertEqual( +2314 [], +2315 list(d.iterancestors('w', 'x', 'y', 'z'))) +2316 +2317 self.assertEqual( +2318 [], +2319 list(d.iterancestors(tag=('d', 'x')))) +2320 self.assertEqual( +2321 [], +2322 list(d.iterancestors('d', 'x'))) +2323 +2324 self.assertEqual( +2325 [b, a], +2326 list(d.iterancestors(tag=('b', '*')))) +2327 self.assertEqual( +2328 [b, a], +2329 list(d.iterancestors('b', '*'))) +2330 +2331 self.assertEqual( +2332 [b], +2333 list(d.iterancestors(tag=('b', 'c')))) +2334 self.assertEqual( +2335 [b], +2336 list(d.iterancestors('b', 'c'))) +
2337 +
2338 - def test_iterdescendants(self): +
2339 Element = self.etree.Element +2340 SubElement = self.etree.SubElement +2341 +2342 a = Element('a') +2343 b = SubElement(a, 'b') +2344 c = SubElement(a, 'c') +2345 d = SubElement(b, 'd') +2346 e = SubElement(c, 'e') +2347 +2348 self.assertEqual( +2349 [b, d, c, e], +2350 list(a.iterdescendants())) +2351 self.assertEqual( +2352 [], +2353 list(d.iterdescendants())) +
2354 +
2355 - def test_iterdescendants_tag(self): +
2356 Element = self.etree.Element +2357 SubElement = self.etree.SubElement +2358 +2359 a = Element('a') +2360 b = SubElement(a, 'b') +2361 c = SubElement(a, 'c') +2362 d = SubElement(b, 'd') +2363 e = SubElement(c, 'e') +2364 +2365 self.assertEqual( +2366 [], +2367 list(a.iterdescendants('a'))) +2368 self.assertEqual( +2369 [], +2370 list(a.iterdescendants(tag='a'))) +2371 +2372 a2 = SubElement(e, 'a') +2373 self.assertEqual( +2374 [a2], +2375 list(a.iterdescendants('a'))) +2376 +2377 self.assertEqual( +2378 [a2], +2379 list(c.iterdescendants('a'))) +2380 self.assertEqual( +2381 [a2], +2382 list(c.iterdescendants(tag='a'))) +
2383 +
2385 Element = self.etree.Element +2386 SubElement = self.etree.SubElement +2387 +2388 a = Element('a') +2389 b = SubElement(a, 'b') +2390 c = SubElement(a, 'c') +2391 d = SubElement(b, 'd') +2392 e = SubElement(c, 'e') +2393 +2394 self.assertEqual( +2395 [b, e], +2396 list(a.iterdescendants(tag=('a', 'b', 'e')))) +2397 self.assertEqual( +2398 [b, e], +2399 list(a.iterdescendants('a', 'b', 'e'))) +2400 +2401 a2 = SubElement(e, 'a') +2402 self.assertEqual( +2403 [b, a2], +2404 list(a.iterdescendants(tag=('a', 'b')))) +2405 self.assertEqual( +2406 [b, a2], +2407 list(a.iterdescendants('a', 'b'))) +2408 +2409 self.assertEqual( +2410 [], +2411 list(c.iterdescendants(tag=('x', 'y', 'z')))) +2412 self.assertEqual( +2413 [], +2414 list(c.iterdescendants('x', 'y', 'z'))) +2415 +2416 self.assertEqual( +2417 [b, d, c, e, a2], +2418 list(a.iterdescendants(tag=('x', 'y', 'z', '*')))) +2419 self.assertEqual( +2420 [b, d, c, e, a2], +2421 list(a.iterdescendants('x', 'y', 'z', '*'))) +
2422 +
2423 - def test_getroottree(self): +
2424 Element = self.etree.Element +2425 SubElement = self.etree.SubElement +2426 +2427 a = Element('a') +2428 b = SubElement(a, 'b') +2429 c = SubElement(a, 'c') +2430 d = SubElement(b, 'd') +2431 self.assertEqual( +2432 a, +2433 a.getroottree().getroot()) +2434 self.assertEqual( +2435 a, +2436 b.getroottree().getroot()) +2437 self.assertEqual( +2438 a, +2439 d.getroottree().getroot()) +
2440 +
2441 - def test_getnext(self): +
2442 Element = self.etree.Element +2443 SubElement = self.etree.SubElement +2444 +2445 a = Element('a') +2446 b = SubElement(a, 'b') +2447 c = SubElement(a, 'c') +2448 self.assertEqual( +2449 None, +2450 a.getnext()) +2451 self.assertEqual( +2452 c, +2453 b.getnext()) +2454 self.assertEqual( +2455 None, +2456 c.getnext()) +
2457 +
2458 - def test_getprevious(self): +
2459 Element = self.etree.Element +2460 SubElement = self.etree.SubElement +2461 +2462 a = Element('a') +2463 b = SubElement(a, 'b') +2464 c = SubElement(a, 'c') +2465 d = SubElement(b, 'd') +2466 self.assertEqual( +2467 None, +2468 a.getprevious()) +2469 self.assertEqual( +2470 b, +2471 c.getprevious()) +2472 self.assertEqual( +2473 None, +2474 b.getprevious()) +
2475 +
2476 - def test_itersiblings(self): +
2477 Element = self.etree.Element +2478 SubElement = self.etree.SubElement +2479 +2480 a = Element('a') +2481 b = SubElement(a, 'b') +2482 c = SubElement(a, 'c') +2483 d = SubElement(b, 'd') +2484 self.assertEqual( +2485 [], +2486 list(a.itersiblings())) +2487 self.assertEqual( +2488 [c], +2489 list(b.itersiblings())) +2490 self.assertEqual( +2491 [], +2492 list(c.itersiblings())) +2493 self.assertEqual( +2494 [b], +2495 list(c.itersiblings(preceding=True))) +2496 self.assertEqual( +2497 [], +2498 list(b.itersiblings(preceding=True))) +
2499 +
2500 - def test_itersiblings_tag(self): +
2501 Element = self.etree.Element +2502 SubElement = self.etree.SubElement +2503 +2504 a = Element('a') +2505 b = SubElement(a, 'b') +2506 c = SubElement(a, 'c') +2507 d = SubElement(b, 'd') +2508 self.assertEqual( +2509 [], +2510 list(a.itersiblings(tag='XXX'))) +2511 self.assertEqual( +2512 [c], +2513 list(b.itersiblings(tag='c'))) +2514 self.assertEqual( +2515 [c], +2516 list(b.itersiblings(tag='*'))) +2517 self.assertEqual( +2518 [b], +2519 list(c.itersiblings(preceding=True, tag='b'))) +2520 self.assertEqual( +2521 [], +2522 list(c.itersiblings(preceding=True, tag='c'))) +
2523 +
2525 Element = self.etree.Element +2526 SubElement = self.etree.SubElement +2527 +2528 a = Element('a') +2529 b = SubElement(a, 'b') +2530 c = SubElement(a, 'c') +2531 d = SubElement(b, 'd') +2532 e = SubElement(a, 'e') +2533 self.assertEqual( +2534 [], +2535 list(a.itersiblings(tag=('XXX', 'YYY')))) +2536 self.assertEqual( +2537 [c, e], +2538 list(b.itersiblings(tag=('c', 'd', 'e')))) +2539 self.assertEqual( +2540 [b], +2541 list(c.itersiblings(preceding=True, tag=('b', 'b', 'c', 'd')))) +2542 self.assertEqual( +2543 [c, b], +2544 list(e.itersiblings(preceding=True, tag=('c', '*')))) +
2545 +
2546 - def test_parseid(self): +
2547 parseid = self.etree.parseid +2548 XML = self.etree.XML +2549 xml_text = _bytes(''' +2550 <!DOCTYPE document [ +2551 <!ELEMENT document (h1,p)*> +2552 <!ELEMENT h1 (#PCDATA)> +2553 <!ATTLIST h1 myid ID #REQUIRED> +2554 <!ELEMENT p (#PCDATA)> +2555 <!ATTLIST p someid ID #REQUIRED> +2556 ]> +2557 <document> +2558 <h1 myid="chapter1">...</h1> +2559 <p id="note1" class="note">...</p> +2560 <p>Regular paragraph.</p> +2561 <p xml:id="xmlid">XML:ID paragraph.</p> +2562 <p someid="warn1" class="warning">...</p> +2563 </document> +2564 ''') +2565 +2566 tree, dic = parseid(BytesIO(xml_text)) +2567 root = tree.getroot() +2568 root2 = XML(xml_text) +2569 self.assertEqual(self._writeElement(root), +2570 self._writeElement(root2)) +2571 expected = { +2572 "chapter1" : root[0], +2573 "xmlid" : root[3], +2574 "warn1" : root[4] +2575 } +2576 self.assertTrue("chapter1" in dic) +2577 self.assertTrue("warn1" in dic) +2578 self.assertTrue("xmlid" in dic) +2579 self._checkIDDict(dic, expected) +
2580 +
2581 - def test_XMLDTDID(self): +
2582 XMLDTDID = self.etree.XMLDTDID +2583 XML = self.etree.XML +2584 xml_text = _bytes(''' +2585 <!DOCTYPE document [ +2586 <!ELEMENT document (h1,p)*> +2587 <!ELEMENT h1 (#PCDATA)> +2588 <!ATTLIST h1 myid ID #REQUIRED> +2589 <!ELEMENT p (#PCDATA)> +2590 <!ATTLIST p someid ID #REQUIRED> +2591 ]> +2592 <document> +2593 <h1 myid="chapter1">...</h1> +2594 <p id="note1" class="note">...</p> +2595 <p>Regular paragraph.</p> +2596 <p xml:id="xmlid">XML:ID paragraph.</p> +2597 <p someid="warn1" class="warning">...</p> +2598 </document> +2599 ''') +2600 +2601 root, dic = XMLDTDID(xml_text) +2602 root2 = XML(xml_text) +2603 self.assertEqual(self._writeElement(root), +2604 self._writeElement(root2)) +2605 expected = { +2606 "chapter1" : root[0], +2607 "xmlid" : root[3], +2608 "warn1" : root[4] +2609 } +2610 self.assertTrue("chapter1" in dic) +2611 self.assertTrue("warn1" in dic) +2612 self.assertTrue("xmlid" in dic) +2613 self._checkIDDict(dic, expected) +
2614 +
2615 - def test_XMLDTDID_empty(self): +
2616 XMLDTDID = self.etree.XMLDTDID +2617 XML = self.etree.XML +2618 xml_text = _bytes(''' +2619 <document> +2620 <h1 myid="chapter1">...</h1> +2621 <p id="note1" class="note">...</p> +2622 <p>Regular paragraph.</p> +2623 <p someid="warn1" class="warning">...</p> +2624 </document> +2625 ''') +2626 +2627 root, dic = XMLDTDID(xml_text) +2628 root2 = XML(xml_text) +2629 self.assertEqual(self._writeElement(root), +2630 self._writeElement(root2)) +2631 expected = {} +2632 self._checkIDDict(dic, expected) +
2633 +
2634 - def test_XMLDTDID_no_id_dict(self): +
2635 XMLDTDID = self.etree.XMLDTDID +2636 XML = self.etree.XML +2637 xml_text = _bytes(''' +2638 <!DOCTYPE document [ +2639 <!ELEMENT document (h1,p)*> +2640 <!ELEMENT h1 (#PCDATA)> +2641 <!ATTLIST h1 myid ID #REQUIRED> +2642 <!ELEMENT p (#PCDATA)> +2643 <!ATTLIST p someid ID #REQUIRED> +2644 ]> +2645 <document> +2646 <h1 myid="chapter1">...</h1> +2647 <p id="note1" class="note">...</p> +2648 <p>Regular paragraph.</p> +2649 <p xml:id="xmlid">XML:ID paragraph.</p> +2650 <p someid="warn1" class="warning">...</p> +2651 </document> +2652 ''') +2653 +2654 parser = etree.XMLParser(collect_ids=False) +2655 root, dic = XMLDTDID(xml_text, parser=parser) +2656 root2 = XML(xml_text) +2657 self.assertEqual(self._writeElement(root), +2658 self._writeElement(root2)) +2659 self.assertFalse(dic) +2660 self._checkIDDict(dic, {}) +
2661 +
2662 - def _checkIDDict(self, dic, expected): +
2663 self.assertEqual(len(dic), +2664 len(expected)) +2665 self.assertEqual(sorted(dic.items()), +2666 sorted(expected.items())) +2667 if sys.version_info < (3,): +2668 self.assertEqual(sorted(dic.iteritems()), +2669 sorted(expected.iteritems())) +2670 self.assertEqual(sorted(dic.keys()), +2671 sorted(expected.keys())) +2672 if sys.version_info < (3,): +2673 self.assertEqual(sorted(dic.iterkeys()), +2674 sorted(expected.iterkeys())) +2675 if sys.version_info < (3,): +2676 self.assertEqual(sorted(dic.values()), +2677 sorted(expected.values())) +2678 self.assertEqual(sorted(dic.itervalues()), +2679 sorted(expected.itervalues())) +
2680 +
2681 - def test_register_namespace_xml(self): +
2682 self.assertRaises(ValueError, self.etree.register_namespace, +2683 "XML", "http://www.w3.org/XML/1998/namespace") +2684 self.assertRaises(ValueError, self.etree.register_namespace, +2685 "xml", "http://www.w3.org/XML/2345") +2686 self.etree.register_namespace("xml", "http://www.w3.org/XML/1998/namespace") # ok +
2687 +
2688 - def test_namespaces(self): +
2689 etree = self.etree +2690 +2691 r = {'foo': 'http://ns.infrae.com/foo'} +2692 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2693 self.assertEqual( +2694 'foo', +2695 e.prefix) +2696 self.assertEqual( +2697 _bytes('<foo:bar xmlns:foo="http://ns.infrae.com/foo"></foo:bar>'), +2698 self._writeElement(e)) +
2699 +
2700 - def test_namespaces_default(self): +
2701 etree = self.etree +2702 +2703 r = {None: 'http://ns.infrae.com/foo'} +2704 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2705 self.assertEqual( +2706 None, +2707 e.prefix) +2708 self.assertEqual( +2709 '{http://ns.infrae.com/foo}bar', +2710 e.tag) +2711 self.assertEqual( +2712 _bytes('<bar xmlns="http://ns.infrae.com/foo"></bar>'), +2713 self._writeElement(e)) +
2714 +
2716 etree = self.etree +2717 +2718 r = {None: 'http://ns.infrae.com/foo', 'p': 'http://test/'} +2719 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2720 self.assertEqual(None, e.prefix) +2721 self.assertEqual('{http://ns.infrae.com/foo}bar', e.tag) +2722 self.assertEqual( +2723 _bytes('<bar xmlns="http://ns.infrae.com/foo" xmlns:p="http://test/"></bar>'), +2724 self._writeElement(e)) +
2725 +
2727 etree = self.etree +2728 +2729 r = {None: 'http://ns.infrae.com/foo', +2730 'hoi': 'http://ns.infrae.com/hoi'} +2731 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2732 e.set('{http://ns.infrae.com/hoi}test', 'value') +2733 self.assertEqual( +2734 _bytes('<bar xmlns="http://ns.infrae.com/foo" xmlns:hoi="http://ns.infrae.com/hoi" hoi:test="value"></bar>'), +2735 self._writeElement(e)) +
2736 +
2738 etree = self.etree +2739 +2740 root = etree.Element('{http://test/ns}root', +2741 nsmap={None: 'http://test/ns'}) +2742 sub = etree.Element('{http://test/ns}sub', +2743 nsmap={'test': 'http://test/ns'}) +2744 +2745 sub.attrib['{http://test/ns}attr'] = 'value' +2746 self.assertEqual(sub.attrib['{http://test/ns}attr'], 'value') +2747 self.assertEqual( +2748 _bytes('<test:sub xmlns:test="http://test/ns" test:attr="value"/>'), +2749 etree.tostring(sub)) +2750 +2751 root.append(sub) +2752 self.assertEqual( +2753 _bytes('<root xmlns="http://test/ns">' +2754 '<sub xmlns:test="http://test/ns" test:attr="value"/>' +2755 '</root>'), +2756 etree.tostring(root)) +
2757 +
2759 etree = self.etree +2760 +2761 root = etree.Element('root') +2762 sub = etree.Element('{http://test/ns}sub', +2763 nsmap={'test': 'http://test/ns'}) +2764 +2765 sub.attrib['{http://test/ns}attr'] = 'value' +2766 self.assertEqual(sub.attrib['{http://test/ns}attr'], 'value') +2767 self.assertEqual( +2768 _bytes('<test:sub xmlns:test="http://test/ns" test:attr="value"/>'), +2769 etree.tostring(sub)) +2770 +2771 root.append(sub) +2772 self.assertEqual( +2773 _bytes('<root>' +2774 '<test:sub xmlns:test="http://test/ns" test:attr="value"/>' +2775 '</root>'), +2776 etree.tostring(root)) +
2777 +
2779 etree = self.etree +2780 +2781 root = etree.Element('root') +2782 sub = etree.Element('{http://test/ns}sub', +2783 nsmap={None: 'http://test/ns'}) +2784 +2785 sub.attrib['{http://test/ns}attr'] = 'value' +2786 self.assertEqual(sub.attrib['{http://test/ns}attr'], 'value') +2787 self.assertEqual( +2788 _bytes('<sub xmlns="http://test/ns" ' +2789 'xmlns:ns0="http://test/ns" ns0:attr="value"/>'), +2790 etree.tostring(sub)) +2791 +2792 root.append(sub) +2793 self.assertEqual( +2794 _bytes('<root>' +2795 '<sub xmlns="http://test/ns"' +2796 ' xmlns:ns0="http://test/ns" ns0:attr="value"/>' +2797 '</root>'), +2798 etree.tostring(root)) +
2799 +
2801 etree = self.etree +2802 +2803 root = etree.Element('{http://test/ns}root', +2804 nsmap={'test': 'http://test/ns', +2805 None: 'http://test/ns'}) +2806 sub = etree.Element('{http://test/ns}sub', +2807 nsmap={None: 'http://test/ns'}) +2808 +2809 sub.attrib['{http://test/ns}attr'] = 'value' +2810 self.assertEqual(sub.attrib['{http://test/ns}attr'], 'value') +2811 self.assertEqual( +2812 _bytes('<sub xmlns="http://test/ns" ' +2813 'xmlns:ns0="http://test/ns" ns0:attr="value"/>'), +2814 etree.tostring(sub)) +2815 +2816 root.append(sub) +2817 self.assertEqual( +2818 _bytes('<test:root xmlns:test="http://test/ns" xmlns="http://test/ns">' +2819 '<test:sub test:attr="value"/>' +2820 '</test:root>'), +2821 etree.tostring(root)) +
2822 +
2823 - def test_namespaces_elementtree(self): +
2824 etree = self.etree +2825 r = {None: 'http://ns.infrae.com/foo', +2826 'hoi': 'http://ns.infrae.com/hoi'} +2827 e = etree.Element('{http://ns.infrae.com/foo}z', nsmap=r) +2828 tree = etree.ElementTree(element=e) +2829 etree.SubElement(e, '{http://ns.infrae.com/hoi}x') +2830 self.assertEqual( +2831 _bytes('<z xmlns="http://ns.infrae.com/foo" xmlns:hoi="http://ns.infrae.com/hoi"><hoi:x></hoi:x></z>'), +2832 self._writeElement(e)) +
2833 +
2835 etree = self.etree +2836 +2837 r = {None: 'http://ns.infrae.com/foo'} +2838 e1 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2839 e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2840 +2841 e1.append(e2) +2842 +2843 self.assertEqual( +2844 None, +2845 e1.prefix) +2846 self.assertEqual( +2847 None, +2848 e1[0].prefix) +2849 self.assertEqual( +2850 '{http://ns.infrae.com/foo}bar', +2851 e1.tag) +2852 self.assertEqual( +2853 '{http://ns.infrae.com/foo}bar', +2854 e1[0].tag) +
2855 +
2857 etree = self.etree +2858 +2859 r = {None: 'http://ns.infrae.com/BAR'} +2860 e1 = etree.Element('{http://ns.infrae.com/BAR}bar', nsmap=r) +2861 e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +2862 +2863 e1.append(e2) +2864 +2865 self.assertEqual( +2866 None, +2867 e1.prefix) +2868 self.assertNotEqual( +2869 None, +2870 e2.prefix) +2871 self.assertEqual( +2872 '{http://ns.infrae.com/BAR}bar', +2873 e1.tag) +2874 self.assertEqual( +2875 '{http://ns.infrae.com/foo}bar', +2876 e2.tag) +
2877 +
2879 ns_href = "http://a.b.c" +2880 one = self.etree.fromstring( +2881 _bytes('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href)) +2882 baz = one[0][0] +2883 +2884 two = self.etree.fromstring( +2885 _bytes('<root xmlns:ns="%s"/>' % ns_href)) +2886 two.append(baz) +2887 del one # make sure the source document is deallocated +2888 +2889 self.assertEqual('{%s}baz' % ns_href, baz.tag) +2890 self.assertEqual( +2891 _bytes('<root xmlns:ns="%s"><ns:baz/></root>' % ns_href), +2892 self.etree.tostring(two)) +
2893 +
2894 - def test_namespace_cleanup(self): +
2895 xml = _bytes( +2896 '<foo xmlns="F" xmlns:x="x">' +2897 '<bar xmlns:ns="NS" xmlns:b="b" xmlns="B">' +2898 '<ns:baz/>' +2899 '</bar></foo>' +2900 ) +2901 root = self.etree.fromstring(xml) +2902 self.assertEqual(xml, self.etree.tostring(root)) +2903 self.etree.cleanup_namespaces(root) +2904 self.assertEqual( +2905 _bytes('<foo xmlns="F"><bar xmlns:ns="NS" xmlns="B"><ns:baz/></bar></foo>'), +2906 self.etree.tostring(root)) +
2907 +
2909 xml = _bytes( +2910 '<foo xmlns="F" xmlns:x="X" xmlns:a="A">' +2911 '<bar xmlns:ns="NS" xmlns:b="b" xmlns="B">' +2912 '<ns:baz a:test="attr"/>' +2913 '</bar></foo>' +2914 ) +2915 root = self.etree.fromstring(xml) +2916 self.assertEqual(xml, self.etree.tostring(root)) +2917 self.etree.cleanup_namespaces(root) +2918 self.assertEqual( +2919 _bytes('<foo xmlns="F" xmlns:a="A">' +2920 '<bar xmlns:ns="NS" xmlns="B">' +2921 '<ns:baz a:test="attr"/>' +2922 '</bar></foo>'), +2923 self.etree.tostring(root)) +
2924 +
2925 - def test_namespace_cleanup_many(self): +
2926 xml = ('<n12:foo ' + +2927 ' '.join('xmlns:n{n}="NS{n}"'.format(n=i) for i in range(100)) + +2928 '><n68:a/></n12:foo>').encode('utf8') +2929 root = self.etree.fromstring(xml) +2930 self.assertEqual(xml, self.etree.tostring(root)) +2931 self.etree.cleanup_namespaces(root) +2932 self.assertEqual( +2933 b'<n12:foo xmlns:n12="NS12" xmlns:n68="NS68"><n68:a/></n12:foo>', +2934 self.etree.tostring(root)) +
2935 +
2936 - def test_namespace_cleanup_deep(self): +
2937 xml = ('<root>' + +2938 ''.join('<a xmlns:n{n}="NS{n}">'.format(n=i) for i in range(100)) + +2939 '<n64:x/>' + '</a>'*100 + '</root>').encode('utf8') +2940 root = self.etree.fromstring(xml) +2941 self.assertEqual(xml, self.etree.tostring(root)) +2942 self.etree.cleanup_namespaces(root) +2943 self.assertEqual( +2944 b'<root>' + b'<a>'*64 + b'<a xmlns:n64="NS64">' + b'<a>'*35 + +2945 b'<n64:x/>' + b'</a>'*100 + b'</root>', +2946 self.etree.tostring(root)) +
2947 +
2949 xml = ('<root>' + +2950 ''.join('<a xmlns:n{n}="NS{n}">'.format(n=i) for i in range(100)) + +2951 '<n64:x xmlns:a="A" a:attr="X"/>' + +2952 '</a>'*100 + +2953 '</root>').encode('utf8') +2954 root = self.etree.fromstring(xml) +2955 self.assertEqual(xml, self.etree.tostring(root)) +2956 self.etree.cleanup_namespaces(root, top_nsmap={'n64': 'NS64'}) +2957 self.assertEqual( +2958 b'<root xmlns:n64="NS64">' + b'<a>'*100 + +2959 b'<n64:x xmlns:a="A" a:attr="X"/>' + b'</a>'*100 + b'</root>', +2960 self.etree.tostring(root)) +
2961 +
2963 xml = ('<root xmlns:n64="NS64" xmlns:foo="FOO" xmlns:unused1="UNUSED" xmlns:no="NO">' +2964 '<a xmlns:unused2="UNUSED"><n64:x xmlns:a="A" a:attr="X"/></a>' +2965 '<foo>foo:bar</foo>' +2966 '</root>').encode('utf8') +2967 root = self.etree.fromstring(xml) +2968 self.assertEqual(xml, self.etree.tostring(root)) +2969 self.etree.cleanup_namespaces(root, keep_ns_prefixes=['foo']) +2970 self.assertEqual( +2971 b'<root xmlns:n64="NS64" xmlns:foo="FOO">' +2972 b'<a><n64:x xmlns:a="A" a:attr="X"/></a>' +2973 b'<foo>foo:bar</foo>' +2974 b'</root>', +2975 self.etree.tostring(root)) +
2976 +
2978 xml = ('<root xmlns:n64="NS64" xmlns:unused1="UNUSED" xmlns:no="NO">' +2979 '<sub xmlns:foo="FOO">' +2980 '<a xmlns:unused2="UNUSED"><n64:x xmlns:a="A" a:attr="X"/></a>' +2981 '<foo>foo:bar</foo>' +2982 '</sub>' +2983 '</root>').encode('utf8') +2984 root = self.etree.fromstring(xml) +2985 self.assertEqual(xml, self.etree.tostring(root)) +2986 self.etree.cleanup_namespaces( +2987 root, +2988 top_nsmap={'foo': 'FOO', 'unused1': 'UNUSED'}, +2989 keep_ns_prefixes=['foo']) +2990 self.assertEqual( +2991 b'<root xmlns:n64="NS64" xmlns:foo="FOO">' +2992 b'<sub>' +2993 b'<a><n64:x xmlns:a="A" a:attr="X"/></a>' +2994 b'<foo>foo:bar</foo>' +2995 b'</sub>' +2996 b'</root>', +2997 self.etree.tostring(root)) +
2998 +
2999 - def test_element_nsmap(self): +
3000 etree = self.etree +3001 +3002 r = {None: 'http://ns.infrae.com/foo', +3003 'hoi': 'http://ns.infrae.com/hoi'} +3004 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +3005 self.assertEqual( +3006 r, +3007 e.nsmap) +
3008 +
3009 - def test_subelement_nsmap(self): +
3010 etree = self.etree +3011 +3012 re = {None: 'http://ns.infrae.com/foo', +3013 'hoi': 'http://ns.infrae.com/hoi'} +3014 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=re) +3015 +3016 rs = {None: 'http://ns.infrae.com/honk', +3017 'top': 'http://ns.infrae.com/top'} +3018 s = etree.SubElement(e, '{http://ns.infrae.com/honk}bar', nsmap=rs) +3019 +3020 r = re.copy() +3021 r.update(rs) +3022 self.assertEqual(re, e.nsmap) +3023 self.assertEqual(r, s.nsmap) +
3024 +
3025 - def test_html_prefix_nsmap(self): +
3026 etree = self.etree +3027 el = etree.HTML('<hha:page-description>aa</hha:page-description>').find('.//page-description') +3028 self.assertEqual({'hha': None}, el.nsmap) +
3029 +
3031 Element = self.etree.Element +3032 SubElement = self.etree.SubElement +3033 +3034 a = Element('a') +3035 b = SubElement(a, 'b') +3036 c = SubElement(a, 'c') +3037 d = SubElement(b, 'd') +3038 e = SubElement(c, 'e') +3039 f = SubElement(c, 'f') +3040 +3041 self.assertEqual( +3042 [a, b], +3043 list(a.getiterator('a', 'b'))) +3044 self.assertEqual( +3045 [], +3046 list(a.getiterator('x', 'y'))) +3047 self.assertEqual( +3048 [a, f], +3049 list(a.getiterator('f', 'a'))) +3050 self.assertEqual( +3051 [c, e, f], +3052 list(c.getiterator('c', '*', 'a'))) +3053 self.assertEqual( +3054 [], +3055 list(a.getiterator( (), () ))) +
3056 +
3058 Element = self.etree.Element +3059 SubElement = self.etree.SubElement +3060 +3061 a = Element('a') +3062 b = SubElement(a, 'b') +3063 c = SubElement(a, 'c') +3064 d = SubElement(b, 'd') +3065 e = SubElement(c, 'e') +3066 f = SubElement(c, 'f') +3067 +3068 self.assertEqual( +3069 [a, b], +3070 list(a.getiterator( ('a', 'b') ))) +3071 self.assertEqual( +3072 [], +3073 list(a.getiterator( ('x', 'y') ))) +3074 self.assertEqual( +3075 [a, f], +3076 list(a.getiterator( ('f', 'a') ))) +3077 self.assertEqual( +3078 [c, e, f], +3079 list(c.getiterator( ('c', '*', 'a') ))) +3080 self.assertEqual( +3081 [], +3082 list(a.getiterator( () ))) +
3083 +
3085 Element = self.etree.Element +3086 SubElement = self.etree.SubElement +3087 +3088 a = Element('{a}a') +3089 b = SubElement(a, '{a}b') +3090 c = SubElement(a, '{a}c') +3091 d = SubElement(b, '{b}d') +3092 e = SubElement(c, '{a}e') +3093 f = SubElement(c, '{b}f') +3094 g = SubElement(c, 'g') +3095 +3096 self.assertEqual( +3097 [a], +3098 list(a.getiterator('{a}a'))) +3099 self.assertEqual( +3100 [], +3101 list(a.getiterator('{b}a'))) +3102 self.assertEqual( +3103 [], +3104 list(a.getiterator('a'))) +3105 self.assertEqual( +3106 [a,b,d,c,e,f,g], +3107 list(a.getiterator('*'))) +3108 self.assertEqual( +3109 [f], +3110 list(c.getiterator('{b}*'))) +3111 self.assertEqual( +3112 [d, f], +3113 list(a.getiterator('{b}*'))) +3114 self.assertEqual( +3115 [g], +3116 list(a.getiterator('g'))) +3117 self.assertEqual( +3118 [g], +3119 list(a.getiterator('{}g'))) +3120 self.assertEqual( +3121 [g], +3122 list(a.getiterator('{}*'))) +
3123 +
3125 Element = self.etree.Element +3126 Comment = self.etree.Comment +3127 SubElement = self.etree.SubElement +3128 +3129 a = Element('{a}a') +3130 b = SubElement(a, '{nsA}b') +3131 c = SubElement(b, '{nsB}b') +3132 d = SubElement(a, 'b') +3133 e = SubElement(a, '{nsA}e') +3134 f = SubElement(e, '{nsB}e') +3135 g = SubElement(e, 'e') +3136 a.append(Comment('test')) +3137 +3138 self.assertEqual( +3139 [b, c, d], +3140 list(a.getiterator('{*}b'))) +3141 self.assertEqual( +3142 [e, f, g], +3143 list(a.getiterator('{*}e'))) +3144 self.assertEqual( +3145 [a, b, c, d, e, f, g], +3146 list(a.getiterator('{*}*'))) +
3147 +
3149 Element = self.etree.Element +3150 Entity = self.etree.Entity +3151 SubElement = self.etree.SubElement +3152 +3153 a = Element('a') +3154 b = SubElement(a, 'b') +3155 entity_b = Entity("TEST-b") +3156 b.append(entity_b) +3157 +3158 self.assertEqual( +3159 [entity_b], +3160 list(a.getiterator(Entity))) +3161 +3162 entity_a = Entity("TEST-a") +3163 a.append(entity_a) +3164 +3165 self.assertEqual( +3166 [entity_b, entity_a], +3167 list(a.getiterator(Entity))) +3168 +3169 self.assertEqual( +3170 [entity_b], +3171 list(b.getiterator(Entity))) +
3172 +
3174 Element = self.etree.Element +3175 Comment = self.etree.Comment +3176 PI = self.etree.PI +3177 SubElement = self.etree.SubElement +3178 +3179 a = Element('a') +3180 b = SubElement(a, 'b') +3181 a.append(Comment("test")) +3182 a.append(PI("pi", "content")) +3183 c = SubElement(a, 'c') +3184 +3185 self.assertEqual( +3186 [a, b, c], +3187 list(a.getiterator(Element))) +
3188 +
3190 # ElementTree iterates over everything here +3191 Element = self.etree.Element +3192 Comment = self.etree.Comment +3193 PI = self.etree.PI +3194 SubElement = self.etree.SubElement +3195 +3196 a = Element('a') +3197 b = SubElement(a, 'b') +3198 a.append(Comment("test")) +3199 a.append(PI("pi", "content")) +3200 c = SubElement(a, 'c') +3201 +3202 self.assertEqual( +3203 [a, b, c], +3204 list(a.getiterator('*'))) +
3205 +
3207 a = etree.Element("a") +3208 b = etree.SubElement(a, "b") +3209 c = etree.SubElement(a, "c") +3210 d1 = etree.SubElement(c, "d") +3211 d2 = etree.SubElement(c, "d") +3212 c.text = d1.text = 'TEXT' +3213 +3214 tree = etree.ElementTree(a) +3215 self.assertEqual('.', tree.getelementpath(a)) +3216 self.assertEqual('c/d[1]', tree.getelementpath(d1)) +3217 self.assertEqual('c/d[2]', tree.getelementpath(d2)) +3218 +3219 self.assertEqual(d1, tree.find(tree.getelementpath(d1))) +3220 self.assertEqual(d2, tree.find(tree.getelementpath(d2))) +3221 +3222 tree = etree.ElementTree(c) +3223 self.assertEqual('.', tree.getelementpath(c)) +3224 self.assertEqual('d[2]', tree.getelementpath(d2)) +3225 self.assertEqual(d2, tree.find(tree.getelementpath(d2))) +3226 +3227 tree = etree.ElementTree(b) # not a parent of a/c/d1/d2 +3228 self.assertEqual('.', tree.getelementpath(b)) +3229 self.assertRaises(ValueError, tree.getelementpath, a) +3230 self.assertRaises(ValueError, tree.getelementpath, c) +3231 self.assertRaises(ValueError, tree.getelementpath, d2) +
3232 +
3234 a = etree.Element("{http://ns1/}a") +3235 b = etree.SubElement(a, "{http://ns1/}b") +3236 c = etree.SubElement(a, "{http://ns1/}c") +3237 d1 = etree.SubElement(c, "{http://ns1/}d") +3238 d2 = etree.SubElement(c, "{http://ns2/}d") +3239 d3 = etree.SubElement(c, "{http://ns1/}d") +3240 +3241 tree = etree.ElementTree(a) +3242 self.assertEqual('.', tree.getelementpath(a)) +3243 self.assertEqual('{http://ns1/}c/{http://ns1/}d[1]', +3244 tree.getelementpath(d1)) +3245 self.assertEqual('{http://ns1/}c/{http://ns2/}d', +3246 tree.getelementpath(d2)) +3247 self.assertEqual('{http://ns1/}c/{http://ns1/}d[2]', +3248 tree.getelementpath(d3)) +3249 +3250 self.assertEqual(a, tree.find(tree.getelementpath(a))) +3251 self.assertEqual(b, tree.find(tree.getelementpath(b))) +3252 self.assertEqual(c, tree.find(tree.getelementpath(c))) +3253 self.assertEqual(d1, tree.find(tree.getelementpath(d1))) +3254 self.assertEqual(d2, tree.find(tree.getelementpath(d2))) +3255 self.assertEqual(d3, tree.find(tree.getelementpath(d3))) +3256 +3257 tree = etree.ElementTree(c) +3258 self.assertEqual('{http://ns1/}d[1]', tree.getelementpath(d1)) +3259 self.assertEqual('{http://ns2/}d', tree.getelementpath(d2)) +3260 self.assertEqual('{http://ns1/}d[2]', tree.getelementpath(d3)) +3261 self.assertEqual(d1, tree.find(tree.getelementpath(d1))) +3262 self.assertEqual(d2, tree.find(tree.getelementpath(d2))) +3263 self.assertEqual(d3, tree.find(tree.getelementpath(d3))) +3264 +3265 tree = etree.ElementTree(b) # not a parent of d1/d2 +3266 self.assertRaises(ValueError, tree.getelementpath, d1) +3267 self.assertRaises(ValueError, tree.getelementpath, d2) +
3268 +
3269 - def test_elementtree_find_qname(self): +
3270 XML = self.etree.XML +3271 ElementTree = self.etree.ElementTree +3272 QName = self.etree.QName +3273 tree = ElementTree(XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>'))) +3274 self.assertEqual(tree.find(QName("c")), tree.getroot()[2]) +
3275 +
3277 XML = self.etree.XML +3278 ElementTree = self.etree.ElementTree +3279 QName = self.etree.QName +3280 tree = ElementTree(XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>'))) +3281 self.assertEqual(len(list(tree.findall(QName("c")))), 1) +
3282 +
3284 XML = self.etree.XML +3285 ElementTree = self.etree.ElementTree +3286 QName = self.etree.QName +3287 tree = ElementTree(XML( +3288 _bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>'))) +3289 self.assertEqual(len(list(tree.findall(QName("b")))), 2) +3290 self.assertEqual(len(list(tree.findall(QName("X", "b")))), 1) +
3291 +
3292 - def test_findall_ns(self): +
3293 XML = self.etree.XML +3294 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>')) +3295 self.assertEqual(len(root.findall(".//{X}b")), 2) +3296 self.assertEqual(len(root.findall(".//{X}*")), 2) +3297 self.assertEqual(len(root.findall(".//b")), 3) +
3298 +
3300 XML = self.etree.XML +3301 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><y:b/></a>')) +3302 nsmap = {'xx': 'X'} +3303 self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 2) +3304 self.assertEqual(len(root.findall(".//xx:*", namespaces=nsmap)), 2) +3305 self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 2) +3306 nsmap = {'xx': 'Y'} +3307 self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 1) +3308 self.assertEqual(len(root.findall(".//xx:*", namespaces=nsmap)), 1) +3309 self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 2) +
3310 +
3311 - def test_findall_empty_prefix(self): +
3312 XML = self.etree.XML +3313 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><y:b/></a>')) +3314 nsmap = {'xx': 'X'} +3315 self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 2) +3316 nsmap = {'xx': 'X', None: 'Y'} +3317 self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 1) +3318 nsmap = {'xx': 'X', '': 'Y'} +3319 self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 1) +
3320 +
3321 - def test_findall_syntax_error(self): +
3322 XML = self.etree.XML +3323 root = XML(_bytes('<a><b><c/></b><b/><c><b/><b/></c><b/></a>')) +3324 self.assertRaises(SyntaxError, root.findall, '') +3325 self.assertRaises(SyntaxError, root.findall, '//') # absolute path on Element +3326 self.assertRaises(SyntaxError, root.findall, './//') +
3327 +
3328 - def test_index(self): +
3329 etree = self.etree +3330 e = etree.Element('foo') +3331 for i in range(10): +3332 etree.SubElement(e, 'a%s' % i) +3333 for i in range(10): +3334 self.assertEqual( +3335 i, +3336 e.index(e[i])) +3337 self.assertEqual( +3338 3, e.index(e[3], 3)) +3339 self.assertRaises( +3340 ValueError, e.index, e[3], 4) +3341 self.assertRaises( +3342 ValueError, e.index, e[3], 0, 2) +3343 self.assertRaises( +3344 ValueError, e.index, e[8], 0, -3) +3345 self.assertRaises( +3346 ValueError, e.index, e[8], -5, -3) +3347 self.assertEqual( +3348 8, e.index(e[8], 0, -1)) +3349 self.assertEqual( +3350 8, e.index(e[8], -12, -1)) +3351 self.assertEqual( +3352 0, e.index(e[0], -12, -1)) +
3353 +
3354 - def test_replace(self): +
3355 etree = self.etree +3356 e = etree.Element('foo') +3357 for i in range(10): +3358 el = etree.SubElement(e, 'a%s' % i) +3359 el.text = "text%d" % i +3360 el.tail = "tail%d" % i +3361 +3362 child0 = e[0] +3363 child1 = e[1] +3364 child2 = e[2] +3365 +3366 e.replace(e[0], e[1]) +3367 self.assertEqual( +3368 9, len(e)) +3369 self.assertEqual( +3370 child1, e[0]) +3371 self.assertEqual( +3372 child1.text, "text1") +3373 self.assertEqual( +3374 child1.tail, "tail1") +3375 self.assertEqual( +3376 child0.tail, "tail0") +3377 self.assertEqual( +3378 child2, e[1]) +3379 +3380 e.replace(e[-1], e[0]) +3381 self.assertEqual( +3382 child1, e[-1]) +3383 self.assertEqual( +3384 child1.text, "text1") +3385 self.assertEqual( +3386 child1.tail, "tail1") +3387 self.assertEqual( +3388 child2, e[0]) +
3389 +
3390 - def test_replace_new(self): +
3391 etree = self.etree +3392 e = etree.Element('foo') +3393 for i in range(10): +3394 etree.SubElement(e, 'a%s' % i) +3395 +3396 new_element = etree.Element("test") +3397 new_element.text = "TESTTEXT" +3398 new_element.tail = "TESTTAIL" +3399 child1 = e[1] +3400 e.replace(e[0], new_element) +3401 self.assertEqual( +3402 new_element, e[0]) +3403 self.assertEqual( +3404 "TESTTEXT", +3405 e[0].text) +3406 self.assertEqual( +3407 "TESTTAIL", +3408 e[0].tail) +3409 self.assertEqual( +3410 child1, e[1]) +
3411 +
3412 - def test_setslice_all_reversed(self): +
3413 Element = self.etree.Element +3414 SubElement = self.etree.SubElement +3415 +3416 a = Element('a') +3417 +3418 e = Element('e') +3419 f = Element('f') +3420 g = Element('g') +3421 +3422 a[:] = [e, f, g] +3423 self.assertEqual( +3424 [e, f, g], +3425 list(a)) +3426 +3427 a[::-1] = [e, f, g] +3428 self.assertEqual( +3429 [g, f, e], +3430 list(a)) +
3431 +
3432 - def test_setslice_step(self): +
3433 Element = self.etree.Element +3434 SubElement = self.etree.SubElement +3435 +3436 a = Element('a') +3437 b = SubElement(a, 'b') +3438 c = SubElement(a, 'c') +3439 d = SubElement(a, 'd') +3440 e = SubElement(a, 'e') +3441 +3442 x = Element('x') +3443 y = Element('y') +3444 +3445 a[1::2] = [x, y] +3446 self.assertEqual( +3447 [b, x, d, y], +3448 list(a)) +
3449 +
3450 - def test_setslice_step_negative(self): +
3451 Element = self.etree.Element +3452 SubElement = self.etree.SubElement +3453 +3454 a = Element('a') +3455 b = SubElement(a, 'b') +3456 c = SubElement(a, 'c') +3457 d = SubElement(a, 'd') +3458 e = SubElement(a, 'e') +3459 +3460 x = Element('x') +3461 y = Element('y') +3462 +3463 a[1::-1] = [x, y] +3464 self.assertEqual( +3465 [y, x, d, e], +3466 list(a)) +
3467 +
3469 Element = self.etree.Element +3470 SubElement = self.etree.SubElement +3471 +3472 a = Element('a') +3473 b = SubElement(a, 'b') +3474 c = SubElement(a, 'c') +3475 d = SubElement(a, 'd') +3476 e = SubElement(a, 'e') +3477 +3478 x = Element('x') +3479 y = Element('y') +3480 +3481 a[::-2] = [x, y] +3482 self.assertEqual( +3483 [b, y, d, x], +3484 list(a)) +
3485 +
3486 - def test_setslice_step_overrun(self): +
3487 Element = self.etree.Element +3488 SubElement = self.etree.SubElement +3489 try: +3490 slice +3491 except NameError: +3492 print("slice() not found") +3493 return +3494 +3495 a = Element('a') +3496 b = SubElement(a, 'b') +3497 c = SubElement(a, 'c') +3498 d = SubElement(a, 'd') +3499 e = SubElement(a, 'e') +3500 +3501 x = Element('x') +3502 y = Element('y') +3503 z = Element('z') +3504 +3505 self.assertRaises( +3506 ValueError, +3507 operator.setitem, a, slice(1,None,2), [x, y, z]) +3508 +3509 self.assertEqual( +3510 [b, c, d, e], +3511 list(a)) +
3512 +
3513 - def test_sourceline_XML(self): +
3514 XML = self.etree.XML +3515 root = XML(_bytes('''<?xml version="1.0"?> +3516 <root><test> +3517 +3518 <bla/></test> +3519 </root> +3520 ''')) +3521 +3522 self.assertEqual( +3523 [2, 2, 4], +3524 [ el.sourceline for el in root.getiterator() ]) +
3525 +
3526 - def test_large_sourceline_XML(self): +
3527 XML = self.etree.XML +3528 root = XML(_bytes( +3529 '<?xml version="1.0"?>\n' +3530 '<root>' + '\n' * 65536 + +3531 '<p>' + '\n' * 65536 + '</p>\n' + +3532 '<br/>\n' +3533 '</root>')) +3534 +3535 if self.etree.LIBXML_VERSION >= (2, 9): +3536 expected = [2, 131074, 131076] +3537 else: +3538 expected = [2, 65535, 65535] +3539 +3540 self.assertEqual(expected, [el.sourceline for el in root.iter()]) +
3541 +
3542 - def test_sourceline_parse(self): +
3543 parse = self.etree.parse +3544 tree = parse(fileInTestDir('include/test_xinclude.xml')) +3545 +3546 self.assertEqual( +3547 [1, 2, 3], +3548 [ el.sourceline for el in tree.getiterator() ]) +
3549 +
3551 iterparse = self.etree.iterparse +3552 lines = [ el.sourceline for (event, el) in +3553 iterparse(fileInTestDir('include/test_xinclude.xml')) ] +3554 +3555 self.assertEqual( +3556 [2, 3, 1], +3557 lines) +
3558 +
3560 iterparse = self.etree.iterparse +3561 lines = [ el.sourceline for (event, el) in +3562 iterparse(fileInTestDir('include/test_xinclude.xml'), +3563 events=("start",)) ] +3564 +3565 self.assertEqual( +3566 [1, 2, 3], +3567 lines) +
3568 +
3569 - def test_sourceline_element(self): +
3570 Element = self.etree.Element +3571 SubElement = self.etree.SubElement +3572 el = Element("test") +3573 self.assertEqual(None, el.sourceline) +3574 +3575 child = SubElement(el, "test") +3576 self.assertEqual(None, el.sourceline) +3577 self.assertEqual(None, child.sourceline) +
3578 +
3579 - def test_XML_base_url_docinfo(self): +
3580 etree = self.etree +3581 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +3582 docinfo = root.getroottree().docinfo +3583 self.assertEqual(docinfo.URL, "http://no/such/url") +
3584 +
3586 etree = self.etree +3587 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +3588 docinfo = root.getroottree().docinfo +3589 self.assertEqual(docinfo.URL, "http://no/such/url") +3590 docinfo.URL = "https://secret/url" +3591 self.assertEqual(docinfo.URL, "https://secret/url") +
3592 +
3594 etree = self.etree +3595 tree = etree.parse(BytesIO("<root/>"), base_url="http://no/such/url") +3596 docinfo = tree.docinfo +3597 self.assertEqual(docinfo.URL, "http://no/such/url") +
3598 +
3599 - def test_parse_base_url_docinfo(self): +
3600 etree = self.etree +3601 tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), +3602 base_url="http://no/such/url") +3603 docinfo = tree.docinfo +3604 self.assertEqual(docinfo.URL, "http://no/such/url") +
3605 +
3606 - def test_HTML_base_url_docinfo(self): +
3607 etree = self.etree +3608 root = etree.HTML(_bytes("<html/>"), base_url="http://no/such/url") +3609 docinfo = root.getroottree().docinfo +3610 self.assertEqual(docinfo.URL, "http://no/such/url") +
3611 +
3612 - def test_docinfo_public(self): +
3613 etree = self.etree +3614 xml_header = '<?xml version="1.0" encoding="ascii"?>' +3615 pub_id = "-//W3C//DTD XHTML 1.0 Transitional//EN" +3616 sys_id = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +3617 doctype_string = '<!DOCTYPE html PUBLIC "%s" "%s">' % (pub_id, sys_id) +3618 +3619 xml = _bytes(xml_header + doctype_string + '<html><body></body></html>') +3620 +3621 tree = etree.parse(BytesIO(xml)) +3622 docinfo = tree.docinfo +3623 self.assertEqual(docinfo.encoding, "ascii") +3624 self.assertEqual(docinfo.xml_version, "1.0") +3625 self.assertEqual(docinfo.public_id, pub_id) +3626 self.assertEqual(docinfo.system_url, sys_id) +3627 self.assertEqual(docinfo.root_name, 'html') +3628 self.assertEqual(docinfo.doctype, doctype_string) +
3629 +
3630 - def test_docinfo_system(self): +
3631 etree = self.etree +3632 xml_header = '<?xml version="1.0" encoding="UTF-8"?>' +3633 sys_id = "some.dtd" +3634 doctype_string = '<!DOCTYPE html SYSTEM "%s">' % sys_id +3635 xml = _bytes(xml_header + doctype_string + '<html><body></body></html>') +3636 +3637 tree = etree.parse(BytesIO(xml)) +3638 docinfo = tree.docinfo +3639 self.assertEqual(docinfo.encoding, "UTF-8") +3640 self.assertEqual(docinfo.xml_version, "1.0") +3641 self.assertEqual(docinfo.public_id, None) +3642 self.assertEqual(docinfo.system_url, sys_id) +3643 self.assertEqual(docinfo.root_name, 'html') +3644 self.assertEqual(docinfo.doctype, doctype_string) +
3645 +
3646 - def test_docinfo_empty(self): +
3647 etree = self.etree +3648 xml = _bytes('<html><body></body></html>') +3649 tree = etree.parse(BytesIO(xml)) +3650 docinfo = tree.docinfo +3651 self.assertEqual(docinfo.encoding, "UTF-8") +3652 self.assertEqual(docinfo.xml_version, "1.0") +3653 self.assertEqual(docinfo.public_id, None) +3654 self.assertEqual(docinfo.system_url, None) +3655 self.assertEqual(docinfo.root_name, 'html') +3656 self.assertEqual(docinfo.doctype, '') +
3657 +
3658 - def test_docinfo_name_only(self): +
3659 etree = self.etree +3660 xml = _bytes('<!DOCTYPE root><root></root>') +3661 tree = etree.parse(BytesIO(xml)) +3662 docinfo = tree.docinfo +3663 self.assertEqual(docinfo.encoding, "UTF-8") +3664 self.assertEqual(docinfo.xml_version, "1.0") +3665 self.assertEqual(docinfo.public_id, None) +3666 self.assertEqual(docinfo.system_url, None) +3667 self.assertEqual(docinfo.root_name, 'root') +3668 self.assertEqual(docinfo.doctype, '<!DOCTYPE root>') +
3669 +
3671 etree = self.etree +3672 xml = _bytes('<!DOCTYPE root>\n<root/>') +3673 tree = etree.parse(BytesIO(xml)) +3674 self.assertEqual(xml, etree.tostring(tree)) +
3675 +
3677 etree = self.etree +3678 pub_id = "-//W3C//DTD XHTML 1.0 Transitional//EN" +3679 sys_id = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +3680 doctype_string = _bytes('<!DOCTYPE html PUBLIC "%s" "%s">' % (pub_id, sys_id)) +3681 +3682 xml = _bytes('<!DOCTYPE root>\n<root/>') +3683 tree = etree.parse(BytesIO(xml)) +3684 self.assertEqual(xml.replace(_bytes('<!DOCTYPE root>'), doctype_string), +3685 etree.tostring(tree, doctype=doctype_string)) +
3686 +
3687 - def test_xml_base(self): +
3688 etree = self.etree +3689 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +3690 self.assertEqual(root.base, "http://no/such/url") +3691 self.assertEqual( +3692 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +3693 root.base = "https://secret/url" +3694 self.assertEqual(root.base, "https://secret/url") +3695 self.assertEqual( +3696 root.get('{http://www.w3.org/XML/1998/namespace}base'), +3697 "https://secret/url") +
3698 +
3699 - def test_xml_base_attribute(self): +
3700 etree = self.etree +3701 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +3702 self.assertEqual(root.base, "http://no/such/url") +3703 self.assertEqual( +3704 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +3705 root.set('{http://www.w3.org/XML/1998/namespace}base', +3706 "https://secret/url") +3707 self.assertEqual(root.base, "https://secret/url") +3708 self.assertEqual( +3709 root.get('{http://www.w3.org/XML/1998/namespace}base'), +3710 "https://secret/url") +
3711 +
3712 - def test_html_base(self): +
3713 etree = self.etree +3714 root = etree.HTML(_bytes("<html><body></body></html>"), +3715 base_url="http://no/such/url") +3716 self.assertEqual(root.base, "http://no/such/url") +
3717 +
3718 - def test_html_base_tag(self): +
3719 etree = self.etree +3720 root = etree.HTML(_bytes('<html><head><base href="http://no/such/url"></head></html>')) +3721 self.assertEqual(root.base, "http://no/such/url") +
3722 +
3724 # parse from a file object that returns unicode strings +3725 f = LargeFileLikeUnicode() +3726 tree = self.etree.parse(f) +3727 root = tree.getroot() +3728 self.assertTrue(root.tag.endswith('root')) +
3729 +
3730 - def test_dtd_io(self): +
3731 # check that DTDs that go in also go back out +3732 xml = _bytes('''\ +3733 <!DOCTYPE test SYSTEM "test.dtd" [ +3734 <!ENTITY entity "tasty"> +3735 <!ELEMENT test (a)> +3736 <!ELEMENT a (#PCDATA)> +3737 ]> +3738 <test><a>test-test</a></test>\ +3739 ''') +3740 tree = self.etree.parse(BytesIO(xml)) +3741 self.assertEqual(self.etree.tostring(tree).replace(_bytes(" "), _bytes("")), +3742 xml.replace(_bytes(" "), _bytes(""))) +
3743 +
3744 - def test_byte_zero(self): +
3745 Element = self.etree.Element +3746 +3747 a = Element('a') +3748 self.assertRaises(ValueError, setattr, a, "text", 'ha\0ho') +3749 self.assertRaises(ValueError, setattr, a, "tail", 'ha\0ho') +3750 +3751 self.assertRaises(ValueError, Element, 'ha\0ho') +
3752 +
3753 - def test_unicode_byte_zero(self): +
3754 Element = self.etree.Element +3755 +3756 a = Element('a') +3757 self.assertRaises(ValueError, setattr, a, "text", +3758 _str('ha\0ho')) +3759 self.assertRaises(ValueError, setattr, a, "tail", +3760 _str('ha\0ho')) +3761 +3762 self.assertRaises(ValueError, Element, +3763 _str('ha\0ho')) +
3764 +
3765 - def test_byte_invalid(self): +
3766 Element = self.etree.Element +3767 +3768 a = Element('a') +3769 self.assertRaises(ValueError, setattr, a, "text", 'ha\x07ho') +3770 self.assertRaises(ValueError, setattr, a, "text", 'ha\x02ho') +3771 +3772 self.assertRaises(ValueError, setattr, a, "tail", 'ha\x07ho') +3773 self.assertRaises(ValueError, setattr, a, "tail", 'ha\x02ho') +3774 +3775 self.assertRaises(ValueError, Element, 'ha\x07ho') +3776 self.assertRaises(ValueError, Element, 'ha\x02ho') +
3777 +
3778 - def test_unicode_byte_invalid(self): +
3779 Element = self.etree.Element +3780 +3781 a = Element('a') +3782 self.assertRaises(ValueError, setattr, a, "text", +3783 _str('ha\x07ho')) +3784 self.assertRaises(ValueError, setattr, a, "text", +3785 _str('ha\x02ho')) +3786 +3787 self.assertRaises(ValueError, setattr, a, "tail", +3788 _str('ha\x07ho')) +3789 self.assertRaises(ValueError, setattr, a, "tail", +3790 _str('ha\x02ho')) +3791 +3792 self.assertRaises(ValueError, Element, +3793 _str('ha\x07ho')) +3794 self.assertRaises(ValueError, Element, +3795 _str('ha\x02ho')) +
3796 +
3798 Element = self.etree.Element +3799 +3800 a = Element('a') +3801 self.assertRaises(ValueError, setattr, a, "text", +3802 _str('ha\u1234\x07ho')) +3803 self.assertRaises(ValueError, setattr, a, "text", +3804 _str('ha\u1234\x02ho')) +3805 +3806 self.assertRaises(ValueError, setattr, a, "tail", +3807 _str('ha\u1234\x07ho')) +3808 self.assertRaises(ValueError, setattr, a, "tail", +3809 _str('ha\u1234\x02ho')) +3810 +3811 self.assertRaises(ValueError, Element, +3812 _str('ha\u1234\x07ho')) +3813 self.assertRaises(ValueError, Element, +3814 _str('ha\u1234\x02ho')) +
3815 +
3817 # ElementTree fails to serialize this +3818 tostring = self.etree.tostring +3819 Element = self.etree.Element +3820 SubElement = self.etree.SubElement +3821 +3822 a = Element('a') +3823 b = SubElement(a, 'b') +3824 c = SubElement(a, 'c') +3825 +3826 result = tostring(a, encoding='UTF-16') +3827 self.assertEqual(_bytes('<a><b></b><c></c></a>'), +3828 canonicalize(result)) +
3829 +
3830 - def test_tostring_none(self): +
3831 # ElementTree raises an AssertionError here +3832 tostring = self.etree.tostring +3833 self.assertRaises(TypeError, self.etree.tostring, None) +
3834 +
3835 - def test_tostring_pretty(self): +
3836 tostring = self.etree.tostring +3837 Element = self.etree.Element +3838 SubElement = self.etree.SubElement +3839 +3840 a = Element('a') +3841 b = SubElement(a, 'b') +3842 c = SubElement(a, 'c') +3843 +3844 result = tostring(a) +3845 self.assertEqual(result, _bytes("<a><b/><c/></a>")) +3846 +3847 result = tostring(a, pretty_print=False) +3848 self.assertEqual(result, _bytes("<a><b/><c/></a>")) +3849 +3850 result = tostring(a, pretty_print=True) +3851 self.assertEqual(result, _bytes("<a>\n <b/>\n <c/>\n</a>\n")) +
3852 +
3853 - def test_tostring_with_tail(self): +
3854 tostring = self.etree.tostring +3855 Element = self.etree.Element +3856 SubElement = self.etree.SubElement +3857 +3858 a = Element('a') +3859 a.tail = "aTAIL" +3860 b = SubElement(a, 'b') +3861 b.tail = "bTAIL" +3862 c = SubElement(a, 'c') +3863 +3864 result = tostring(a) +3865 self.assertEqual(result, _bytes("<a><b/>bTAIL<c/></a>aTAIL")) +3866 +3867 result = tostring(a, with_tail=False) +3868 self.assertEqual(result, _bytes("<a><b/>bTAIL<c/></a>")) +3869 +3870 result = tostring(a, with_tail=True) +3871 self.assertEqual(result, _bytes("<a><b/>bTAIL<c/></a>aTAIL")) +
3872 +
3874 tostring = self.etree.tostring +3875 html = self.etree.fromstring( +3876 '<html><body>' +3877 '<div><p>Some text<i>\r\n</i></p></div>\r\n' +3878 '</body></html>', +3879 parser=self.etree.HTMLParser()) +3880 self.assertEqual(html.tag, 'html') +3881 div = html.find('.//div') +3882 self.assertEqual(div.tail, '\r\n') +3883 result = tostring(div, method='html') +3884 self.assertEqual( +3885 result, +3886 _bytes("<div><p>Some text<i>\r\n</i></p></div>\r\n")) +3887 result = tostring(div, method='html', with_tail=True) +3888 self.assertEqual( +3889 result, +3890 _bytes("<div><p>Some text<i>\r\n</i></p></div>\r\n")) +3891 result = tostring(div, method='html', with_tail=False) +3892 self.assertEqual( +3893 result, +3894 _bytes("<div><p>Some text<i>\r\n</i></p></div>")) +
3895 +
3896 - def test_standalone(self): +
3897 tostring = self.etree.tostring +3898 XML = self.etree.XML +3899 ElementTree = self.etree.ElementTree +3900 Element = self.etree.Element +3901 +3902 tree = Element("root").getroottree() +3903 self.assertEqual(None, tree.docinfo.standalone) +3904 +3905 tree = XML(_bytes("<root/>")).getroottree() +3906 self.assertEqual(None, tree.docinfo.standalone) +3907 +3908 tree = XML(_bytes( +3909 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>" +3910 )).getroottree() +3911 self.assertEqual(True, tree.docinfo.standalone) +3912 +3913 tree = XML(_bytes( +3914 "<?xml version='1.0' encoding='ASCII' standalone='no'?>\n<root/>" +3915 )).getroottree() +3916 self.assertEqual(False, tree.docinfo.standalone) +
3917 +
3918 - def test_tostring_standalone(self): +
3919 tostring = self.etree.tostring +3920 XML = self.etree.XML +3921 ElementTree = self.etree.ElementTree +3922 +3923 root = XML(_bytes("<root/>")) +3924 +3925 tree = ElementTree(root) +3926 self.assertEqual(None, tree.docinfo.standalone) +3927 +3928 result = tostring(root, xml_declaration=True, encoding="ASCII") +3929 self.assertEqual(result, _bytes( +3930 "<?xml version='1.0' encoding='ASCII'?>\n<root/>")) +3931 +3932 result = tostring(root, xml_declaration=True, encoding="ASCII", +3933 standalone=True) +3934 self.assertEqual(result, _bytes( +3935 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>")) +3936 +3937 tree = ElementTree(XML(result)) +3938 self.assertEqual(True, tree.docinfo.standalone) +3939 +3940 result = tostring(root, xml_declaration=True, encoding="ASCII", +3941 standalone=False) +3942 self.assertEqual(result, _bytes( +3943 "<?xml version='1.0' encoding='ASCII' standalone='no'?>\n<root/>")) +3944 +3945 tree = ElementTree(XML(result)) +3946 self.assertEqual(False, tree.docinfo.standalone) +
3947 +
3949 tostring = self.etree.tostring +3950 XML = self.etree.XML +3951 ElementTree = self.etree.ElementTree +3952 +3953 root = XML(_bytes( +3954 "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n<root/>")) +3955 +3956 tree = ElementTree(root) +3957 self.assertEqual(True, tree.docinfo.standalone) +3958 +3959 result = tostring(root, xml_declaration=True, encoding="ASCII") +3960 self.assertEqual(result, _bytes( +3961 "<?xml version='1.0' encoding='ASCII'?>\n<root/>")) +3962 +3963 result = tostring(root, xml_declaration=True, encoding="ASCII", +3964 standalone=True) +3965 self.assertEqual(result, _bytes( +3966 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>")) +
3967 +
3969 tostring = self.etree.tostring +3970 Element = self.etree.Element +3971 SubElement = self.etree.SubElement +3972 +3973 a = Element('a') +3974 a.text = "A" +3975 a.tail = "tail" +3976 b = SubElement(a, 'b') +3977 b.text = "B" +3978 b.tail = _str("Søk på nettet") +3979 c = SubElement(a, 'c') +3980 c.text = "C" +3981 +3982 result = tostring(a, method="text", encoding="UTF-16") +3983 +3984 self.assertEqual(_str('ABSøk på nettetCtail').encode("UTF-16"), +3985 result) +
3986 +
3988 tostring = self.etree.tostring +3989 Element = self.etree.Element +3990 SubElement = self.etree.SubElement +3991 +3992 a = Element('a') +3993 a.text = _str('Søk på nettetA') +3994 a.tail = "tail" +3995 b = SubElement(a, 'b') +3996 b.text = "B" +3997 b.tail = _str('Søk på nettetB') +3998 c = SubElement(a, 'c') +3999 c.text = "C" +4000 +4001 self.assertRaises(UnicodeEncodeError, +4002 tostring, a, method="text") +4003 +4004 self.assertEqual( +4005 _str('Søk på nettetABSøk på nettetBCtail').encode('utf-8'), +4006 tostring(a, encoding="UTF-8", method="text")) +
4007 +
4008 - def test_tounicode(self): +
4009 tounicode = self.etree.tounicode +4010 Element = self.etree.Element +4011 SubElement = self.etree.SubElement +4012 +4013 a = Element('a') +4014 b = SubElement(a, 'b') +4015 c = SubElement(a, 'c') +4016 +4017 self.assertTrue(isinstance(tounicode(a), _unicode)) +4018 self.assertEqual(_bytes('<a><b></b><c></c></a>'), +4019 canonicalize(tounicode(a))) +
4020 +
4021 - def test_tounicode_element(self): +
4022 tounicode = self.etree.tounicode +4023 Element = self.etree.Element +4024 SubElement = self.etree.SubElement +4025 +4026 a = Element('a') +4027 b = SubElement(a, 'b') +4028 c = SubElement(a, 'c') +4029 d = SubElement(c, 'd') +4030 self.assertTrue(isinstance(tounicode(b), _unicode)) +4031 self.assertTrue(isinstance(tounicode(c), _unicode)) +4032 self.assertEqual(_bytes('<b></b>'), +4033 canonicalize(tounicode(b))) +4034 self.assertEqual(_bytes('<c><d></d></c>'), +4035 canonicalize(tounicode(c))) +
4036 +
4037 - def test_tounicode_none(self): +
4038 tounicode = self.etree.tounicode +4039 self.assertRaises(TypeError, self.etree.tounicode, None) +
4040 +
4041 - def test_tounicode_element_tail(self): +
4042 tounicode = self.etree.tounicode +4043 Element = self.etree.Element +4044 SubElement = self.etree.SubElement +4045 +4046 a = Element('a') +4047 b = SubElement(a, 'b') +4048 c = SubElement(a, 'c') +4049 d = SubElement(c, 'd') +4050 b.tail = 'Foo' +4051 +4052 self.assertTrue(isinstance(tounicode(b), _unicode)) +4053 self.assertTrue(tounicode(b) == '<b/>Foo' or +4054 tounicode(b) == '<b />Foo') +
4055 +
4056 - def test_tounicode_pretty(self): +
4057 tounicode = self.etree.tounicode +4058 Element = self.etree.Element +4059 SubElement = self.etree.SubElement +4060 +4061 a = Element('a') +4062 b = SubElement(a, 'b') +4063 c = SubElement(a, 'c') +4064 +4065 result = tounicode(a) +4066 self.assertEqual(result, "<a><b/><c/></a>") +4067 +4068 result = tounicode(a, pretty_print=False) +4069 self.assertEqual(result, "<a><b/><c/></a>") +4070 +4071 result = tounicode(a, pretty_print=True) +4072 self.assertEqual(result, "<a>\n <b/>\n <c/>\n</a>\n") +
4073 +
4074 - def test_tostring_unicode(self): +
4075 tostring = self.etree.tostring +4076 Element = self.etree.Element +4077 SubElement = self.etree.SubElement +4078 +4079 a = Element('a') +4080 b = SubElement(a, 'b') +4081 c = SubElement(a, 'c') +4082 +4083 self.assertTrue(isinstance(tostring(a, encoding=_unicode), _unicode)) +4084 self.assertEqual(_bytes('<a><b></b><c></c></a>'), +4085 canonicalize(tostring(a, encoding=_unicode))) +
4086 +
4088 tostring = self.etree.tostring +4089 Element = self.etree.Element +4090 SubElement = self.etree.SubElement +4091 +4092 a = Element('a') +4093 b = SubElement(a, 'b') +4094 c = SubElement(a, 'c') +4095 d = SubElement(c, 'd') +4096 self.assertTrue(isinstance(tostring(b, encoding=_unicode), _unicode)) +4097 self.assertTrue(isinstance(tostring(c, encoding=_unicode), _unicode)) +4098 self.assertEqual(_bytes('<b></b>'), +4099 canonicalize(tostring(b, encoding=_unicode))) +4100 self.assertEqual(_bytes('<c><d></d></c>'), +4101 canonicalize(tostring(c, encoding=_unicode))) +
4102 +
4103 - def test_tostring_unicode_none(self): +
4104 tostring = self.etree.tostring +4105 self.assertRaises(TypeError, self.etree.tostring, +4106 None, encoding=_unicode) +
4107 +
4109 tostring = self.etree.tostring +4110 Element = self.etree.Element +4111 SubElement = self.etree.SubElement +4112 +4113 a = Element('a') +4114 b = SubElement(a, 'b') +4115 c = SubElement(a, 'c') +4116 d = SubElement(c, 'd') +4117 b.tail = 'Foo' +4118 +4119 self.assertTrue(isinstance(tostring(b, encoding=_unicode), _unicode)) +4120 self.assertTrue(tostring(b, encoding=_unicode) == '<b/>Foo' or +4121 tostring(b, encoding=_unicode) == '<b />Foo') +
4122 +
4124 tostring = self.etree.tostring +4125 Element = self.etree.Element +4126 SubElement = self.etree.SubElement +4127 +4128 a = Element('a') +4129 b = SubElement(a, 'b') +4130 c = SubElement(a, 'c') +4131 +4132 result = tostring(a, encoding=_unicode) +4133 self.assertEqual(result, "<a><b/><c/></a>") +4134 +4135 result = tostring(a, encoding=_unicode, pretty_print=False) +4136 self.assertEqual(result, "<a><b/><c/></a>") +4137 +4138 result = tostring(a, encoding=_unicode, pretty_print=True) +4139 self.assertEqual(result, "<a>\n <b/>\n <c/>\n</a>\n") +
4140 +
4141 - def test_pypy_proxy_collect(self): +
4142 root = etree.Element('parent') +4143 etree.SubElement(root, 'child') +4144 +4145 self.assertEqual(len(root), 1) +4146 self.assertEqual(root[0].tag, 'child') +4147 +4148 # in PyPy, GC used to kill the Python proxy instance without cleanup +4149 gc.collect() +4150 self.assertEqual(len(root), 1) +4151 self.assertEqual(root[0].tag, 'child') +
4152 +
4153 - def test_element_refcycle(self): +
4154 class SubEl(etree.ElementBase): +4155 pass +
4156 +4157 el1 = SubEl() +4158 el2 = SubEl() +4159 self.assertEqual('SubEl', el1.tag) +4160 self.assertEqual('SubEl', el2.tag) +4161 el1.other = el2 +4162 el2.other = el1 +4163 +4164 del el1, el2 +4165 gc.collect() +4166 # not really testing anything here, but it shouldn't crash +4167 +
4168 - def test_proxy_collect_siblings(self): +
4169 root = etree.Element('parent') +4170 c1 = etree.SubElement(root, 'child1') +4171 c2 = etree.SubElement(root, 'child2') +4172 +4173 root.remove(c1) +4174 root.remove(c2) +4175 c1.addnext(c2) +4176 del c1 +4177 # trigger deallocation attempt of c1 +4178 c2.getprevious() +4179 # make sure it wasn't deallocated +4180 self.assertEqual('child1', c2.getprevious().tag) +
4181 +
4183 root = etree.Element('parent') +4184 c1 = etree.SubElement(root, 'child1') +4185 c2 = etree.SubElement(root, 'child2') +4186 +4187 root.remove(c1) +4188 root.remove(c2) +4189 c1.addnext(c2) +4190 c1.tail = 'abc' +4191 c2.tail = 'xyz' +4192 del c1 +4193 # trigger deallocation attempt of c1 +4194 c2.getprevious() +4195 # make sure it wasn't deallocated +4196 self.assertEqual('child1', c2.getprevious().tag) +4197 self.assertEqual('abc', c2.getprevious().tail) +
4198 +4199 # helper methods +4200 +
4201 - def _writeElement(self, element, encoding='us-ascii', compression=0): +
4202 """Write out element for comparison. +4203 """ +4204 ElementTree = self.etree.ElementTree +4205 f = BytesIO() +4206 tree = ElementTree(element=element) +4207 tree.write(f, encoding=encoding, compression=compression) +4208 data = f.getvalue() +4209 if compression: +4210 data = zlib.decompress(data) +4211 return canonicalize(data) +
4212 +4213 +
4214 -class _XIncludeTestCase(HelperTestCase): +
4215 - def test_xinclude_text(self): +
4216 filename = fileInTestDir('test_broken.xml') +4217 root = etree.XML(_bytes('''\ +4218 <doc xmlns:xi="http://www.w3.org/2001/XInclude"> +4219 <xi:include href="%s" parse="text"/> +4220 </doc> +4221 ''' % path2url(filename))) +4222 old_text = root.text +4223 content = read_file(filename) +4224 old_tail = root[0].tail +4225 +4226 self.include( etree.ElementTree(root) ) +4227 self.assertEqual(old_text + content + old_tail, +4228 root.text) +
4229 +
4230 - def test_xinclude(self): +
4231 tree = etree.parse(fileInTestDir('include/test_xinclude.xml')) +4232 self.assertNotEqual( +4233 'a', +4234 tree.getroot()[1].tag) +4235 # process xincludes +4236 self.include( tree ) +4237 # check whether we find it replaced with included data +4238 self.assertEqual( +4239 'a', +4240 tree.getroot()[1].tag) +
4241 +
4242 - def test_xinclude_resolver(self): +
4243 class res(etree.Resolver): +4244 include_text = read_file(fileInTestDir('test.xml')) +4245 called = {} +4246 def resolve(self, url, id, context): +4247 if url.endswith(".dtd"): +4248 self.called["dtd"] = True +4249 return self.resolve_filename( +4250 fileInTestDir('test.dtd'), context) +4251 elif url.endswith("test_xinclude.xml"): +4252 self.called["input"] = True +4253 return None # delegate to default resolver +4254 else: +4255 self.called["include"] = True +4256 return self.resolve_string(self.include_text, context) +
4257 +4258 res_instance = res() +4259 parser = etree.XMLParser(load_dtd = True) +4260 parser.resolvers.add(res_instance) +4261 +4262 tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), +4263 parser = parser) +4264 +4265 self.include(tree) +4266 +4267 called = list(res_instance.called.items()) +4268 called.sort() +4269 self.assertEqual( +4270 [("dtd", True), ("include", True), ("input", True)], +4271 called) +4272 +
4274 data = textwrap.dedent(''' +4275 <doc xmlns:xi="http://www.w3.org/2001/XInclude"> +4276 <foo/> +4277 <xi:include href="./test.xml" /> +4278 </doc> +4279 ''') +4280 +4281 class Resolver(etree.Resolver): +4282 called = {} +4283 +4284 def resolve(self, url, id, context): +4285 if url.endswith("test_xinclude.xml"): +4286 assert not self.called.get("input") +4287 self.called["input"] = True +4288 return None # delegate to default resolver +4289 elif url.endswith('/test5.xml'): +4290 assert not self.called.get("DONE") +4291 self.called["DONE"] = True +4292 return self.resolve_string('<DONE/>', context) +4293 else: +4294 _, filename = url.rsplit('/', 1) +4295 assert not self.called.get(filename) +4296 self.called[filename] = True +4297 next_data = data.replace( +4298 'test.xml', 'test%d.xml' % len(self.called)) +4299 return self.resolve_string(next_data, context) +
4300 +4301 res_instance = Resolver() +4302 parser = etree.XMLParser(load_dtd=True) +4303 parser.resolvers.add(res_instance) +4304 +4305 tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), +4306 parser=parser) +4307 +4308 self.include(tree) +4309 +4310 called = list(res_instance.called.items()) +4311 called.sort() +4312 self.assertEqual( +4313 [("DONE", True), ("input", True), ("test.xml", True), +4314 ("test2.xml", True), ("test3.xml", True), ("test4.xml", True)], +4315 called) +4316 +4317 +
4318 -class ETreeXIncludeTestCase(_XIncludeTestCase): +
4319 - def include(self, tree): +
4320 tree.xinclude() +
4321 +4322 +
4323 -class ElementIncludeTestCase(_XIncludeTestCase): +
4324 from lxml import ElementInclude +4325 +
4326 - def include(self, tree, loader=None, max_depth=None): +
4327 self.ElementInclude.include(tree.getroot(), loader=loader, max_depth=max_depth) +
4328 +4329 XINCLUDE = {} +4330 +4331 XINCLUDE["Recursive1.xml"] = """\ +4332 <?xml version='1.0'?> +4333 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4334 <p>The following is the source code of Recursive2.xml:</p> +4335 <xi:include href="Recursive2.xml"/> +4336 </document> +4337 """ +4338 +4339 XINCLUDE["Recursive2.xml"] = """\ +4340 <?xml version='1.0'?> +4341 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4342 <p>The following is the source code of Recursive3.xml:</p> +4343 <xi:include href="Recursive3.xml"/> +4344 </document> +4345 """ +4346 +4347 XINCLUDE["Recursive3.xml"] = """\ +4348 <?xml version='1.0'?> +4349 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4350 <p>The following is the source code of Recursive1.xml:</p> +4351 <xi:include href="Recursive1.xml"/> +4352 </document> +4353 """ +4354 +4355 XINCLUDE["NonRecursive1.xml"] = """\ +4356 <?xml version='1.0'?> +4357 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4358 <p>The following is multiple times the source code of NonRecursive3.xml:</p> +4359 <xi:include href="NonRecursive3.xml"/> +4360 <xi:include href="NonRecursive3.xml"/> +4361 <p>The following is multiple times the source code of Leaf.xml:</p> +4362 <xi:include href="Leaf.xml"/> +4363 <xi:include href="Leaf.xml"/> +4364 <xi:include href="Leaf.xml"/> +4365 <p>One more time the source code of NonRecursive3.xml:</p> +4366 <xi:include href="NonRecursive3.xml"/> +4367 </document> +4368 """ +4369 +4370 XINCLUDE["NonRecursive2.xml"] = """\ +4371 <?xml version='1.0'?> +4372 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4373 <p>The following is multiple times the source code of NonRecursive3.xml:</p> +4374 <xi:include href="NonRecursive3.xml"/> +4375 <xi:include href="NonRecursive3.xml"/> +4376 </document> +4377 """ +4378 +4379 XINCLUDE["NonRecursive3.xml"] = """\ +4380 <?xml version='1.0'?> +4381 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4382 <p>The following is multiple times the source code of Leaf.xml:</p> +4383 <xi:include href="Leaf.xml"/> +4384 <xi:include href="Leaf.xml"/> +4385 </document> +4386 """ +4387 +4388 XINCLUDE["Leaf.xml"] = """\ +4389 <?xml version='1.0'?> +4390 <document xmlns:xi="http://www.w3.org/2001/XInclude"> +4391 <p>No further includes</p> +4392 </document> +4393 """ +4394 +
4395 - def xinclude_loader(self, href, parse="xml", encoding=None): +
4396 try: +4397 data = textwrap.dedent(self.XINCLUDE[href]) +4398 except KeyError: +4399 raise OSError("resource not found") +4400 if parse == "xml": +4401 data = etree.fromstring(data) +4402 return data +
4403 +
4404 - def test_xinclude_failures(self): +
4405 # Test infinitely recursive includes. +4406 document = self.xinclude_loader("Recursive1.xml").getroottree() +4407 with self.assertRaises(self.ElementInclude.FatalIncludeError) as cm: +4408 self.include(document, self.xinclude_loader) +4409 self.assertEqual(str(cm.exception), +4410 "recursive include of 'Recursive2.xml' detected") +4411 +4412 # Test 'max_depth' limitation. +4413 document = self.xinclude_loader("Recursive1.xml").getroottree() +4414 with self.assertRaises(self.ElementInclude.FatalIncludeError) as cm: +4415 self.include(document, self.xinclude_loader, max_depth=None) +4416 self.assertEqual(str(cm.exception), +4417 "recursive include of 'Recursive2.xml' detected") +4418 +4419 document = self.xinclude_loader("Recursive1.xml").getroottree() +4420 with self.assertRaises(self.ElementInclude.LimitedRecursiveIncludeError) as cm: +4421 self.include(document, self.xinclude_loader, max_depth=0) +4422 self.assertEqual(str(cm.exception), +4423 "maximum xinclude depth reached when including file Recursive2.xml") +4424 +4425 document = self.xinclude_loader("Recursive1.xml").getroottree() +4426 with self.assertRaises(self.ElementInclude.LimitedRecursiveIncludeError) as cm: +4427 self.include(document, self.xinclude_loader, max_depth=1) +4428 self.assertEqual(str(cm.exception), +4429 "maximum xinclude depth reached when including file Recursive3.xml") +4430 +4431 document = self.xinclude_loader("Recursive1.xml").getroottree() +4432 with self.assertRaises(self.ElementInclude.LimitedRecursiveIncludeError) as cm: +4433 self.include(document, self.xinclude_loader, max_depth=2) +4434 self.assertEqual(str(cm.exception), +4435 "maximum xinclude depth reached when including file Recursive1.xml") +4436 +4437 document = self.xinclude_loader("Recursive1.xml").getroottree() +4438 with self.assertRaises(self.ElementInclude.FatalIncludeError) as cm: +4439 self.include(document, self.xinclude_loader, max_depth=3) +4440 self.assertEqual(str(cm.exception), +4441 "recursive include of 'Recursive2.xml' detected") +
4442 +
4444 # Test that including the same file multiple times, but on the same level +4445 # is not detected as recursive include +4446 document = self.xinclude_loader("NonRecursive3.xml").getroottree() +4447 self.include(document, self.xinclude_loader) +4448 +4449 # same but for more than one level +4450 document = self.xinclude_loader("NonRecursive1.xml").getroottree() +4451 self.include(document, self.xinclude_loader) +4452 +4453 # same but no Leaf.xml in top-level file +4454 document = self.xinclude_loader("NonRecursive2.xml").getroottree() +4455 self.include(document, self.xinclude_loader) +
4456 +4457 +
4458 -class ETreeC14NTestCase(HelperTestCase): +
4459 - def test_c14n(self): +
4460 tree = self.parse(_bytes('<a><b/></a>')) +4461 f = BytesIO() +4462 tree.write_c14n(f) +4463 s = f.getvalue() +4464 self.assertEqual(_bytes('<a><b></b></a>'), +4465 s) +
4466 +
4467 - def test_c14n_gzip(self): +
4468 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4469 f = BytesIO() +4470 tree.write_c14n(f, compression=9) +4471 with gzip.GzipFile(fileobj=BytesIO(f.getvalue())) as gzfile: +4472 s = gzfile.read() +4473 self.assertEqual(_bytes('<a>'+'<b></b>'*200+'</a>'), +4474 s) +
4475 +
4476 - def test_c14n_file(self): +
4477 tree = self.parse(_bytes('<a><b/></a>')) +4478 with tmpfile() as filename: +4479 tree.write_c14n(filename) +4480 data = read_file(filename, 'rb') +4481 self.assertEqual(_bytes('<a><b></b></a>'), +4482 data) +
4483 +
4484 - def test_c14n_file_gzip(self): +
4485 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4486 with tmpfile() as filename: +4487 tree.write_c14n(filename, compression=9) +4488 with gzip.open(filename, 'rb') as f: +4489 data = f.read() +4490 self.assertEqual(_bytes('<a>'+'<b></b>'*200+'</a>'), +4491 data) +
4492 +
4493 - def test_c14n2_file_gzip(self): +
4494 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4495 with tmpfile() as filename: +4496 tree.write(filename, method='c14n2', compression=9) +4497 with gzip.open(filename, 'rb') as f: +4498 data = f.read() +4499 self.assertEqual(_bytes('<a>'+'<b></b>'*200+'</a>'), +4500 data) +
4501 +
4502 - def test_c14n2_with_text(self): +
4503 tree = self.parse( +4504 b'<?xml version="1.0"?> <a> abc \n <b> btext </b> btail <c/> ctail </a> ') +4505 f = BytesIO() +4506 tree.write(f, method='c14n2') +4507 s = f.getvalue() +4508 self.assertEqual(b'<a> abc \n <b> btext </b> btail <c></c> ctail </a>', +4509 s) +4510 +4511 f = BytesIO() +4512 tree.write(f, method='c14n2', strip_text=True) +4513 s = f.getvalue() +4514 self.assertEqual(b'<a>abc<b>btext</b>btail<c></c>ctail</a>', +4515 s) +
4516 +
4517 - def test_c14n_with_comments(self): +
4518 tree = self.parse(_bytes('<!--hi--><a><!--ho--><b/></a><!--hu-->')) +4519 f = BytesIO() +4520 tree.write_c14n(f) +4521 s = f.getvalue() +4522 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4523 s) +4524 f = BytesIO() +4525 tree.write_c14n(f, with_comments=True) +4526 s = f.getvalue() +4527 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4528 s) +4529 f = BytesIO() +4530 tree.write_c14n(f, with_comments=False) +4531 s = f.getvalue() +4532 self.assertEqual(_bytes('<a><b></b></a>'), +4533 s) +
4534 +
4535 - def test_c14n2_with_comments(self): +
4536 tree = self.parse(_bytes('<!--hi--><a><!--ho--><b/></a><!--hu-->')) +4537 f = BytesIO() +4538 tree.write(f, method='c14n2') +4539 s = f.getvalue() +4540 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4541 s) +4542 f = BytesIO() +4543 tree.write(f, method='c14n2', with_comments=True) +4544 s = f.getvalue() +4545 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4546 s) +4547 f = BytesIO() +4548 tree.write(f, method='c14n2', with_comments=False) +4549 s = f.getvalue() +4550 self.assertEqual(_bytes('<a><b></b></a>'), +4551 s) +
4552 +
4554 tree = self.parse(_bytes('<!--hi--><a><!--ho--><b/></a><!--hu-->')) +4555 s = etree.tostring(tree, method='c14n') +4556 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4557 s) +4558 s = etree.tostring(tree, method='c14n', with_comments=True) +4559 self.assertEqual(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +4560 s) +4561 s = etree.tostring(tree, method='c14n', with_comments=False) +4562 self.assertEqual(_bytes('<a><b></b></a>'), +4563 s) +
4564 +
4566 tree = self.parse(b'<!--hi--><a><!--ho--><b/></a><!--hu-->') +4567 s = etree.tostring(tree, method='c14n2') +4568 self.assertEqual(b'<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->', +4569 s) +4570 s = etree.tostring(tree, method='c14n2', with_comments=True) +4571 self.assertEqual(b'<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->', +4572 s) +4573 s = etree.tostring(tree, method='c14n2', with_comments=False) +4574 self.assertEqual(b'<a><b></b></a>', +4575 s) +
4576 +
4578 tree = self.parse(_bytes('<!--hi--><a><!--ho--><b/></a><!--hu-->')) +4579 s = etree.tostring(tree.getroot(), method='c14n') +4580 self.assertEqual(_bytes('<a><!--ho--><b></b></a>'), +4581 s) +4582 s = etree.tostring(tree.getroot(), method='c14n', with_comments=True) +4583 self.assertEqual(_bytes('<a><!--ho--><b></b></a>'), +4584 s) +4585 s = etree.tostring(tree.getroot(), method='c14n', with_comments=False) +4586 self.assertEqual(_bytes('<a><b></b></a>'), +4587 s) +
4588 +
4589 - def test_c14n_exclusive(self): +
4590 tree = self.parse(_bytes( +4591 '<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>')) +4592 f = BytesIO() +4593 tree.write_c14n(f) +4594 s = f.getvalue() +4595 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4596 s) +4597 f = BytesIO() +4598 tree.write_c14n(f, exclusive=False) +4599 s = f.getvalue() +4600 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4601 s) +4602 f = BytesIO() +4603 tree.write_c14n(f, exclusive=True) +4604 s = f.getvalue() +4605 self.assertEqual(_bytes('<a xmlns="http://abc"><z:b xmlns:z="http://cde"></z:b></a>'), +4606 s) +4607 +4608 f = BytesIO() +4609 tree.write_c14n(f, exclusive=True, inclusive_ns_prefixes=['z']) +4610 s = f.getvalue() +4611 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:z="http://cde"><z:b></z:b></a>'), +4612 s) +
4613 +
4615 tree = self.parse(_bytes( +4616 '<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>')) +4617 s = etree.tostring(tree, method='c14n') +4618 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4619 s) +4620 s = etree.tostring(tree, method='c14n', exclusive=False) +4621 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4622 s) +4623 s = etree.tostring(tree, method='c14n', exclusive=True) +4624 self.assertEqual(_bytes('<a xmlns="http://abc"><z:b xmlns:z="http://cde"></z:b></a>'), +4625 s) +4626 +4627 s = etree.tostring(tree, method='c14n', exclusive=True, inclusive_ns_prefixes=['y']) +4628 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd"><z:b xmlns:z="http://cde"></z:b></a>'), +4629 s) +
4630 +
4632 tree = self.parse(_bytes( +4633 '<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>')) +4634 s = etree.tostring(tree.getroot(), method='c14n') +4635 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4636 s) +4637 s = etree.tostring(tree.getroot(), method='c14n', exclusive=False) +4638 self.assertEqual(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4639 s) +4640 s = etree.tostring(tree.getroot(), method='c14n', exclusive=True) +4641 self.assertEqual(_bytes('<a xmlns="http://abc"><z:b xmlns:z="http://cde"></z:b></a>'), +4642 s) +4643 +4644 s = etree.tostring(tree.getroot()[0], method='c14n', exclusive=False) +4645 self.assertEqual(_bytes('<z:b xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"></z:b>'), +4646 s) +4647 s = etree.tostring(tree.getroot()[0], method='c14n', exclusive=True) +4648 self.assertEqual(_bytes('<z:b xmlns:z="http://cde"></z:b>'), +4649 s) +4650 +4651 s = etree.tostring(tree.getroot()[0], method='c14n', exclusive=True, inclusive_ns_prefixes=['y']) +4652 self.assertEqual(_bytes('<z:b xmlns:y="http://bcd" xmlns:z="http://cde"></z:b>'), +4653 s) +
4654 +
4656 """ Regression test to fix memory allocation issues (use 3+ inclusive NS spaces)""" +4657 tree = self.parse(_bytes( +4658 '<a xmlns:x="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>')) +4659 +4660 s = etree.tostring(tree, method='c14n', exclusive=True, inclusive_ns_prefixes=['x', 'y', 'z']) +4661 self.assertEqual(_bytes('<a xmlns:x="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +4662 s) +
4663 +4664 +
4665 -class ETreeWriteTestCase(HelperTestCase): +
4666 - def test_write(self): +
4667 tree = self.parse(_bytes('<a><b/></a>')) +4668 f = BytesIO() +4669 tree.write(f) +4670 s = f.getvalue() +4671 self.assertEqual(_bytes('<a><b/></a>'), +4672 s) +
4673 +
4674 - def test_write_doctype(self): +
4675 tree = self.parse(_bytes('<a><b/></a>')) +4676 f = BytesIO() +4677 tree.write(f, doctype='HUHU') +4678 s = f.getvalue() +4679 self.assertEqual(_bytes('HUHU\n<a><b/></a>'), +4680 s) +
4681 +
4682 - def test_write_gzip(self): +
4683 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4684 f = BytesIO() +4685 tree.write(f, compression=9) +4686 with gzip.GzipFile(fileobj=BytesIO(f.getvalue())) as gzfile: +4687 s = gzfile.read() +4688 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4689 s) +
4690 +
4691 - def test_write_gzip_doctype(self): +
4692 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4693 f = BytesIO() +4694 tree.write(f, compression=9, doctype='<!DOCTYPE a>') +4695 with gzip.GzipFile(fileobj=BytesIO(f.getvalue())) as gzfile: +4696 s = gzfile.read() +4697 self.assertEqual(_bytes('<!DOCTYPE a>\n<a>'+'<b/>'*200+'</a>'), +4698 s) +
4699 +
4700 - def test_write_gzip_level(self): +
4701 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4702 f = BytesIO() +4703 tree.write(f, compression=0) +4704 s0 = f.getvalue() +4705 +4706 f = BytesIO() +4707 tree.write(f) +4708 self.assertEqual(f.getvalue(), s0) +4709 +4710 f = BytesIO() +4711 tree.write(f, compression=1) +4712 s = f.getvalue() +4713 self.assertTrue(len(s) <= len(s0)) +4714 with gzip.GzipFile(fileobj=BytesIO(s)) as gzfile: +4715 s1 = gzfile.read() +4716 +4717 f = BytesIO() +4718 tree.write(f, compression=9) +4719 s = f.getvalue() +4720 self.assertTrue(len(s) <= len(s0)) +4721 with gzip.GzipFile(fileobj=BytesIO(s)) as gzfile: +4722 s9 = gzfile.read() +4723 +4724 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4725 s0) +4726 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4727 s1) +4728 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4729 s9) +
4730 +
4731 - def test_write_file(self): +
4732 tree = self.parse(_bytes('<a><b/></a>')) +4733 with tmpfile() as filename: +4734 tree.write(filename) +4735 data = read_file(filename, 'rb') +4736 self.assertEqual(_bytes('<a><b/></a>'), +4737 data) +
4738 +
4739 - def test_write_file_gzip(self): +
4740 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4741 with tmpfile() as filename: +4742 tree.write(filename, compression=9) +4743 with gzip.open(filename, 'rb') as f: +4744 data = f.read() +4745 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4746 data) +
4747 +
4748 - def test_write_file_gzip_parse(self): +
4749 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4750 with tmpfile() as filename: +4751 tree.write(filename, compression=9) +4752 data = etree.tostring(etree.parse(filename)) +4753 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4754 data) +
4755 +
4757 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +4758 with tmpfile() as filename: +4759 tree.write(filename, compression=9) +4760 with gzip.GzipFile(filename) as f: +4761 data = etree.tostring(etree.parse(f)) +4762 self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'), +4763 data) +
4764 +
4765 - def test_write_file_url(self): +
4766 xml = _bytes('<a>'+'<b/>'*200+'</a>') +4767 tree = self.parse(xml) +4768 with tmpfile(prefix="p+%20", suffix=".xml") as filename: +4769 url = 'file://' + (filename if sys.platform != 'win32' +4770 else '/' + filename.replace('\\', '/')) +4771 tree.write(url) +4772 data = read_file(filename, 'rb').replace(_bytes('\n'), _bytes('')) +4773 self.assertEqual(data, xml) +
4774 +4775 +
4776 -class ETreeErrorLogTest(HelperTestCase): +
4777 etree = etree +4778 +
4779 - def test_parse_error_logging(self): +
4780 parse = self.etree.parse +4781 f = BytesIO('<a><b></c></b></a>') +4782 self.etree.clear_error_log() +4783 try: +4784 parse(f) +4785 logs = None +4786 except SyntaxError: +4787 e = sys.exc_info()[1] +4788 logs = e.error_log +4789 f.close() +4790 self.assertTrue([ log for log in logs +4791 if 'mismatch' in log.message ]) +4792 self.assertTrue([ log for log in logs +4793 if 'PARSER' in log.domain_name]) +4794 self.assertTrue([ log for log in logs +4795 if 'ERR_TAG_NAME_MISMATCH' in log.type_name ]) +4796 self.assertTrue([ log for log in logs +4797 if 1 == log.line ]) +4798 self.assertTrue([ log for log in logs +4799 if 15 == log.column ]) +
4800 +
4801 - def _test_python_error_logging(self): +
4802 """This can't really be tested as long as there isn't a way to +4803 reset the logging setup ... +4804 """ +4805 parse = self.etree.parse +4806 +4807 messages = [] +4808 class Logger(self.etree.PyErrorLog): +4809 def log(self, entry, message, *args): +4810 messages.append(message) +
4811 +4812 self.etree.use_global_python_log(Logger()) +4813 f = BytesIO('<a><b></c></b></a>') +4814 try: +4815 parse(f) +4816 except SyntaxError: +4817 pass +4818 f.close() +4819 +4820 self.assertTrue([ message for message in messages +4821 if 'mismatch' in message ]) +4822 self.assertTrue([ message for message in messages +4823 if ':PARSER:' in message]) +4824 self.assertTrue([ message for message in messages +4825 if ':ERR_TAG_NAME_MISMATCH:' in message ]) +4826 self.assertTrue([ message for message in messages +4827 if ':1:15:' in message ]) +4828 +4829 +
4830 -class XMLPullParserTest(unittest.TestCase): +
4831 etree = etree +4832 +
4833 - def assert_event_tags(self, events, expected): +
4834 self.assertEqual([(action, elem.tag) for action, elem in events], +4835 expected) +
4836 +
4838 class Target(object): +4839 def start(self, tag, attrib): +4840 return 'start(%s)' % tag +
4841 def end(self, tag): +4842 return 'end(%s)' % tag +
4843 def close(self): +4844 return 'close()' +4845 +4846 parser = self.etree.XMLPullParser(target=Target()) +4847 events = parser.read_events() +4848 +4849 parser.feed('<root><element>') +4850 self.assertFalse(list(events)) +4851 self.assertFalse(list(events)) +4852 parser.feed('</element><child>') +4853 self.assertEqual([('end', 'end(element)')], list(events)) +4854 parser.feed('</child>') +4855 self.assertEqual([('end', 'end(child)')], list(events)) +4856 parser.feed('</root>') +4857 self.assertEqual([('end', 'end(root)')], list(events)) +4858 self.assertFalse(list(events)) +4859 self.assertEqual('close()', parser.close()) +4860 +
4862 class Target(object): +4863 def start(self, tag, attrib): +4864 return 'start(%s)' % tag +
4865 def end(self, tag): +4866 return 'end(%s)' % tag +4867 def close(self): +4868 return 'close()' +4869 +4870 parser = self.etree.XMLPullParser( +4871 ['start', 'end'], target=Target()) +4872 events = parser.read_events() +4873 +4874 parser.feed('<root><element>') +4875 self.assertEqual( +4876 [('start', 'start(root)'), ('start', 'start(element)')], +4877 list(events)) +4878 self.assertFalse(list(events)) +4879 parser.feed('</element><child>') +4880 self.assertEqual( +4881 [('end', 'end(element)'), ('start', 'start(child)')], +4882 list(events)) +4883 parser.feed('</child>') +4884 self.assertEqual( +4885 [('end', 'end(child)')], +4886 list(events)) +4887 parser.feed('</root>') +4888 self.assertEqual( +4889 [('end', 'end(root)')], +4890 list(events)) +4891 self.assertFalse(list(events)) +4892 self.assertEqual('close()', parser.close()) +4893 +
4894 - def test_pull_from_tree_builder(self): +
4895 parser = self.etree.XMLPullParser( +4896 ['start', 'end'], target=etree.TreeBuilder()) +4897 events = parser.read_events() +4898 +4899 parser.feed('<root><element>') +4900 self.assert_event_tags( +4901 events, [('start', 'root'), ('start', 'element')]) +4902 self.assertFalse(list(events)) +4903 parser.feed('</element><child>') +4904 self.assert_event_tags( +4905 events, [('end', 'element'), ('start', 'child')]) +4906 parser.feed('</child>') +4907 self.assert_event_tags( +4908 events, [('end', 'child')]) +4909 parser.feed('</root>') +4910 self.assert_event_tags( +4911 events, [('end', 'root')]) +4912 self.assertFalse(list(events)) +4913 root = parser.close() +4914 self.assertEqual('root', root.tag) +
4915 +
4917 class Target(etree.TreeBuilder): +4918 def end(self, tag): +4919 el = super(Target, self).end(tag) +4920 el.tag += '-huhu' +4921 return el +
4922 +4923 parser = self.etree.XMLPullParser( +4924 ['start', 'end'], target=Target()) +4925 events = parser.read_events() +4926 +4927 parser.feed('<root><element>') +4928 self.assert_event_tags( +4929 events, [('start', 'root'), ('start', 'element')]) +4930 self.assertFalse(list(events)) +4931 parser.feed('</element><child>') +4932 self.assert_event_tags( +4933 events, [('end', 'element-huhu'), ('start', 'child')]) +4934 parser.feed('</child>') +4935 self.assert_event_tags( +4936 events, [('end', 'child-huhu')]) +4937 parser.feed('</root>') +4938 self.assert_event_tags( +4939 events, [('end', 'root-huhu')]) +4940 self.assertFalse(list(events)) +4941 root = parser.close() +4942 self.assertEqual('root-huhu', root.tag) +4943 +4944 +
4945 -def test_suite(): +
4946 suite = unittest.TestSuite() +4947 suite.addTests([unittest.makeSuite(ETreeOnlyTestCase)]) +4948 suite.addTests([unittest.makeSuite(ETreeXIncludeTestCase)]) +4949 suite.addTests([unittest.makeSuite(ElementIncludeTestCase)]) +4950 suite.addTests([unittest.makeSuite(ETreeC14NTestCase)]) +4951 suite.addTests([unittest.makeSuite(ETreeWriteTestCase)]) +4952 suite.addTests([unittest.makeSuite(ETreeErrorLogTest)]) +4953 suite.addTests([unittest.makeSuite(XMLPullParserTest)]) +4954 +4955 # add original doctests from ElementTree selftest modules +4956 from . import selftest, selftest2 +4957 suite.addTests(doctest.DocTestSuite(selftest)) +4958 suite.addTests(doctest.DocTestSuite(selftest2)) +4959 +4960 # add doctests +4961 suite.addTests(doctest.DocTestSuite(etree)) +4962 suite.addTests( +4963 [make_doctest('../../../doc/tutorial.txt')]) +4964 suite.addTests( +4965 [make_doctest('../../../doc/api.txt')]) +4966 suite.addTests( +4967 [make_doctest('../../../doc/FAQ.txt')]) +4968 suite.addTests( +4969 [make_doctest('../../../doc/parsing.txt')]) +4970 suite.addTests( +4971 [make_doctest('../../../doc/resolvers.txt')]) +4972 return suite +
4973 +4974 +4975 if __name__ == '__main__': +4976 print('to test use test.py %s' % __file__) +4977 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..80a1be27 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeC14NTestCase-class.html @@ -0,0 +1,586 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeC14NTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_c14n2_file_gzip(self) + source code + +
+ +
+   + + + + + + +
test_c14n2_with_text(self) + source code + +
+ +
+   + + + + + + +
test_c14n_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n2_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n_tostring_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n2_tostring_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n_element_tostring_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n_exclusive(self) + source code + +
+ +
+   + + + + + + +
test_c14n_tostring_exclusive(self) + source code + +
+ +
+   + + + + + + +
test_c14n_element_tostring_exclusive(self) + source code + +
+ +
+   + + + + + + +
test_c14n_tostring_inclusive_ns_prefixes(self)
+ Regression test to fix memory allocation issues (use 3+ inclusive NS spaces)
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..b2e732c4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeErrorLogTest-class.html @@ -0,0 +1,421 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeErrorLogTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..0de3c30f --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeOnlyTestCase-class.html @@ -0,0 +1,4779 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeOnlyTestCase
+
+ +
+Tests only for etree, not ElementTree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_version(self) + source code + +
+ +
+   + + + + + + +
test_c_api(self) + source code + +
+ +
+   + + + + + + +
test_include_paths(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_none(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_clear_keep_tail(self) + source code + +
+ +
+   + + + + + + +
test_attribute_has_key(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set_nonstring(self) + source code + +
+ +
+   + + + + + + +
test_attrib_and_keywords(self) + source code + +
+ +
+   + + + + + + +
test_attrib_order(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_pi_comment(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags_pi_comment_all(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags_doc_style(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags_ns(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags_and_remove(self) + source code + +
+ +
+   + + + + + + +
test_pi(self) + source code + +
+ +
+   + + + + + + +
test_pi_parse(self) + source code + +
+ +
+   + + + + + + +
test_pi_pseudo_attributes_get(self) + source code + +
+ +
+   + + + + + + +
test_pi_pseudo_attributes_attrib(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_pi(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_elementtree_pi(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_elementtree_dtd(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_pi_dtd(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_broken_recover(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_broken_multi_recover(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_strip(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_all(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_ns(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_ns_empty(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_ns_all(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_ns_empty_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_feed_parser_recover_no_id_dict(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_parser_target_type_error(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_feed_exception(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_fromstring_exception(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_feed_no_id_dict(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_comments_root_element(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_comments_tree(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_pis_root_element(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_pis_tree(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_pis_comments_tree(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_pis_comments_tree_no_events(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_end(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_tags(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_end_tags(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_end_tags_with_root(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_clear(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_attrib_ns(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_end_skip(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_end_skip(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_ns_skip(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_getiterator(self) + source code + +
+ +
+   + + + + + + +
test_itertext_comment_pi(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_append_parsed(self) + source code + +
+ +
+   + + + + + + +
test_entity_values(self) + source code + +
+ +
+   + + + + + + +
test_entity_error(self) + source code + +
+ +
+   + + + + + + +
test_cdata(self) + source code + +
+ +
+   + + + + + + +
test_cdata_tail(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_error(self) + source code + +
+ +
+   + + + + + + +
test_append_recursive_error(self) + source code + +
+ +
+   + + + + + + +
test_addnext(self) + source code + +
+ +
+   + + + + + + +
test_addprevious(self) + source code + +
+ +
+   + + + + + + +
test_addnext_cycle(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_cycle(self) + source code + +
+ +
+   + + + + + + +
test_addnext_cycle_long(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_cycle_long(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_noops(self) + source code + +
+ +
+   + + + + + + +
test_addnext_noops(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_comment_immutable_attrib(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_posarg(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag_reversed(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag_multiple(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag_multiple_posarg(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag_multiple_reversed(self) + source code + +
+ +
+   + + + + + + +
test_iterancestors(self) + source code + +
+ +
+   + + + + + + +
test_iterancestors_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterancestors_tag_multiple(self) + source code + +
+ +
+   + + + + + + +
test_iterdescendants(self) + source code + +
+ +
+   + + + + + + +
test_iterdescendants_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterdescendants_tag_multiple(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_itersiblings_tag_multiple(self) + source code + +
+ +
+   + + + + + + +
test_parseid(self) + source code + +
+ +
+   + + + + + + +
test_XMLDTDID(self) + source code + +
+ +
+   + + + + + + +
test_XMLDTDID_empty(self) + source code + +
+ +
+   + + + + + + +
test_XMLDTDID_no_id_dict(self) + source code + +
+ +
+   + + + + + + +
_checkIDDict(self, + dic, + expected) + source code + +
+ +
+   + + + + + + +
test_register_namespace_xml(self) + source code + +
+ +
+   + + + + + + +
test_namespaces(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default_and_other(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default_and_attr(self) + source code + +
+ +
+   + + + + + + +
test_attribute_keeps_namespace_prefix_on_merge(self) + source code + +
+ +
+   + + + + + + +
test_attribute_keeps_namespace_prefix_on_merge_with_nons(self) + source code + +
+ +
+   + + + + + + +
test_attribute_gets_namespace_prefix_on_merge_with_nons(self) + source code + +
+ +
+   + + + + + + +
test_attribute_gets_namespace_prefix_on_merge(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_namespace_cleanup_attributes(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup_many(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup_deep(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup_deep_to_top(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup_keep_prefixes(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup_keep_prefixes_top(self) + source code + +
+ +
+   + + + + + + +
test_element_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_subelement_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_html_prefix_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_multiple(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_multiple_tuple(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_namespace(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_local_name(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_getelementpath(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_getelementpath_ns(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_findall_different_nsmaps(self) + source code + +
+ +
+   + + + + + + +
test_findall_empty_prefix(self) + source code + +
+ +
+   + + + + + + +
test_findall_syntax_error(self) + source code + +
+ +
+   + + + + + + +
test_index(self) + source code + +
+ +
+   + + + + + + +
test_replace(self) + source code + +
+ +
+   + + + + + + +
test_replace_new(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_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_large_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_doctype_output_override(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_unicode_byte_invalid_sequence(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_tostring_method_html_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 + +
+ +
+   + + + + + + +
test_pypy_proxy_collect(self) + source code + +
+ +
+   + + + + + + +
test_element_refcycle(self) + source code + +
+ +
+   + + + + + + +
test_proxy_collect_siblings(self) + source code + +
+ +
+   + + + + + + +
test_proxy_collect_siblings_text(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..9c78a201 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeWriteTestCase-class.html @@ -0,0 +1,505 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeWriteTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_write(self) + source code + +
+ +
+   + + + + + + +
test_write_doctype(self) + source code + +
+ +
+   + + + + + + +
test_write_gzip(self) + source code + +
+ +
+   + + + + + + +
test_write_gzip_doctype(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 + +
+ +
+   + + + + + + +
test_write_file_url(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..3599b459 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeXIncludeTestCase-class.html @@ -0,0 +1,370 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                _XIncludeTestCase --+
+                                    |
+                                   ETreeXIncludeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
include(self, + tree) + source code + +
+ +
+

Inherited from _XIncludeTestCase: + test_xinclude, + test_xinclude_resolver, + test_xinclude_resolver_recursive, + test_xinclude_text +

+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..caf02fac --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ElementIncludeTestCase-class.html @@ -0,0 +1,483 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                _XIncludeTestCase --+
+                                    |
+                                   ElementIncludeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
include(self, + tree, + loader=None, + max_depth=None) + source code + +
+ +
+   + + + + + + +
xinclude_loader(self, + href, + parse='xml', + encoding=None) + source code + +
+ +
+   + + + + + + +
test_xinclude_failures(self) + source code + +
+ +
+   + + + + + + +
test_multiple_include_of_same_file(self) + source code + +
+ +
+

Inherited from _XIncludeTestCase: + test_xinclude, + test_xinclude_resolver, + test_xinclude_resolver_recursive, + test_xinclude_text +

+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + XINCLUDE = {'Leaf.xml': ' <?xml version=\'1.0\'?>\n <doc... +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

XINCLUDE

+ +
+
+
+
Value:
+
+{'Leaf.xml': '''    <?xml version=\'1.0\'?>
+    <document xmlns:xi="http://www.w3.org/2001/XInclude">
+      <p>No further includes</p>
+    </document>
+    ''',
+ 'NonRecursive1.xml': '''    <?xml version=\'1.0\'?>
+    <document xmlns:xi="http://www.w3.org/2001/XInclude">
+      <p>The following is multiple times the source code of NonRecursi\
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.XMLPullParserTest-class.html b/doc/html/api/lxml.tests.test_etree.XMLPullParserTest-class.html new file mode 100644 index 00000000..5ceb68a8 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.XMLPullParserTest-class.html @@ -0,0 +1,461 @@ + + + + + lxml.tests.test_etree.XMLPullParserTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class XMLPullParserTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLPullParserTest

source code

+
+            object --+    
+                     |    
+unittest.case.TestCase --+
+                         |
+                        XMLPullParserTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
assert_event_tags(self, + events, + expected) + source code + +
+ +
+   + + + + + + +
test_pull_from_simple_target(self) + source code + +
+ +
+   + + + + + + +
test_pull_from_simple_target_start_end(self) + source code + +
+ +
+   + + + + + + +
test_pull_from_tree_builder(self) + source code + +
+ +
+   + + + + + + +
test_pull_from_tree_builder_subclass(self) + source code + +
+ +
+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest, + tearDown +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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._XIncludeTestCase-class.html b/doc/html/api/lxml.tests.test_etree._XIncludeTestCase-class.html new file mode 100644 index 00000000..f9ecc46d --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree._XIncludeTestCase-class.html @@ -0,0 +1,415 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               _XIncludeTestCase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xinclude_text(self) + source code + +
+ +
+   + + + + + + +
test_xinclude(self) + source code + +
+ +
+   + + + + + + +
test_xinclude_resolver(self) + source code + +
+ +
+   + + + + + + +
test_xinclude_resolver_recursive(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_external_document-module.html b/doc/html/api/lxml.tests.test_external_document-module.html new file mode 100644 index 00000000..478a4727 --- /dev/null +++ b/doc/html/api/lxml.tests.test_external_document-module.html @@ -0,0 +1,216 @@ + + + + + lxml.tests.test_external_document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_external_document + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_external_document

source code

+Test cases related to direct loading of external libxml2 documents + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ExternalDocumentTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + DOC_NAME = 'libxml2:xmlDoc' +
+   + + DESTRUCTOR_NAME = 'destructor:xmlFreeDoc' +
+   + + __package__ = 'lxml.tests' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_external_document-pysrc.html b/doc/html/api/lxml.tests.test_external_document-pysrc.html new file mode 100644 index 00000000..56790407 --- /dev/null +++ b/doc/html/api/lxml.tests.test_external_document-pysrc.html @@ -0,0 +1,313 @@ + + + + + lxml.tests.test_external_document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_external_document + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_external_document

+
+  1  # -*- coding: utf-8 -*- 
+  2  """ 
+  3  Test cases related to direct loading of external libxml2 documents 
+  4  """ 
+  5   
+  6  from __future__ import absolute_import 
+  7   
+  8  import sys 
+  9  import unittest 
+ 10   
+ 11  from .common_imports import HelperTestCase, etree 
+ 12   
+ 13  DOC_NAME = b'libxml2:xmlDoc' 
+ 14  DESTRUCTOR_NAME = b'destructor:xmlFreeDoc' 
+ 15   
+ 16   
+
17 -class ExternalDocumentTestCase(HelperTestCase): +
18 - def setUp(self): +
19 try: + 20 import ctypes + 21 from ctypes import pythonapi + 22 from ctypes.util import find_library + 23 except ImportError: + 24 raise unittest.SkipTest("ctypes support missing") + 25 + 26 def wrap(func, restype, *argtypes): + 27 func.restype = restype + 28 func.argtypes = list(argtypes) + 29 return func +
30 + 31 self.get_capsule_name = wrap(pythonapi.PyCapsule_GetName, + 32 ctypes.c_char_p, ctypes.py_object) + 33 self.capsule_is_valid = wrap(pythonapi.PyCapsule_IsValid, ctypes.c_int, + 34 ctypes.py_object, ctypes.c_char_p) + 35 self.new_capsule = wrap(pythonapi.PyCapsule_New, ctypes.py_object, + 36 ctypes.c_void_p, ctypes.c_char_p, + 37 ctypes.c_void_p) + 38 self.set_capsule_name = wrap(pythonapi.PyCapsule_SetName, ctypes.c_int, + 39 ctypes.py_object, ctypes.c_char_p) + 40 self.set_capsule_context = wrap(pythonapi.PyCapsule_SetContext, + 41 ctypes.c_int, ctypes.py_object, + 42 ctypes.c_char_p) + 43 self.get_capsule_context = wrap(pythonapi.PyCapsule_GetContext, + 44 ctypes.c_char_p, ctypes.py_object) + 45 self.get_capsule_pointer = wrap(pythonapi.PyCapsule_GetPointer, + 46 ctypes.c_void_p, ctypes.py_object, + 47 ctypes.c_char_p) + 48 self.set_capsule_pointer = wrap(pythonapi.PyCapsule_SetPointer, + 49 ctypes.c_int, ctypes.py_object, + 50 ctypes.c_void_p) + 51 self.set_capsule_destructor = wrap(pythonapi.PyCapsule_SetDestructor, + 52 ctypes.c_int, ctypes.py_object, + 53 ctypes.c_void_p) + 54 self.PyCapsule_Destructor = ctypes.CFUNCTYPE(None, ctypes.py_object) + 55 libxml2 = ctypes.CDLL(find_library('xml2')) + 56 self.create_doc = wrap(libxml2.xmlReadMemory, ctypes.c_void_p, + 57 ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, + 58 ctypes.c_char_p, ctypes.c_int) + 59 self.free_doc = wrap(libxml2.xmlFreeDoc, None, ctypes.c_void_p) +
60 +
61 - def as_capsule(self, text, capsule_name=DOC_NAME): +
62 if not isinstance(text, bytes): + 63 text = text.encode('utf-8') + 64 doc = self.create_doc(text, len(text), b'base.xml', b'utf-8', 0) + 65 ans = self.new_capsule(doc, capsule_name, None) + 66 self.set_capsule_context(ans, DESTRUCTOR_NAME) + 67 return ans +
68 +
70 xml = '<r a="1">t</r>' + 71 self.assertRaises(TypeError, etree.adopt_external_document, None) + 72 capsule = self.as_capsule(xml) + 73 self.assertTrue(self.capsule_is_valid(capsule, DOC_NAME)) + 74 self.assertEqual(DOC_NAME, self.get_capsule_name(capsule)) + 75 # Create an lxml tree from the capsule (this is a move not a copy) + 76 root = etree.adopt_external_document(capsule).getroot() + 77 self.assertIsNone(self.get_capsule_name(capsule)) + 78 self.assertEqual(root.text, 't') + 79 root.text = 'new text' + 80 # Now reset the capsule so we can copy it + 81 self.assertEqual(0, self.set_capsule_name(capsule, DOC_NAME)) + 82 self.assertEqual(0, self.set_capsule_context(capsule, b'invalid')) + 83 # Create an lxml tree from the capsule (this is a copy not a move) + 84 root2 = etree.adopt_external_document(capsule).getroot() + 85 self.assertEqual(self.get_capsule_context(capsule), b'invalid') + 86 # Check that the modification to the tree using the transferred + 87 # document was successful + 88 self.assertEqual(root.text, root2.text) + 89 # Check that further modifications do not show up in the copy (they are + 90 # disjoint) + 91 root.text = 'other text' + 92 self.assertNotEqual(root.text, root2.text) + 93 # delete root and ensure root2 survives + 94 del root + 95 self.assertEqual(root2.text, 'new text') +
96 + 97 +
98 -def test_suite(): +
99 suite = unittest.TestSuite() +100 if sys.platform != 'win32': +101 suite.addTests([unittest.makeSuite(ExternalDocumentTestCase)]) +102 return suite +
103 +104 +105 if __name__ == '__main__': +106 print('to test use test.py %s' % __file__) +107 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_external_document.ExternalDocumentTestCase-class.html b/doc/html/api/lxml.tests.test_external_document.ExternalDocumentTestCase-class.html new file mode 100644 index 00000000..e3fd01ce --- /dev/null +++ b/doc/html/api/lxml.tests.test_external_document.ExternalDocumentTestCase-class.html @@ -0,0 +1,437 @@ + + + + + lxml.tests.test_external_document.ExternalDocumentTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_external_document :: + Class ExternalDocumentTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ExternalDocumentTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ExternalDocumentTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
as_capsule(self, + text, + capsule_name='libxml2:xmlDoc') + source code + +
+ +
+   + + + + + + +
test_external_document_adoption(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0cfc0fc1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser-module.html @@ -0,0 +1,255 @@ + + + + + 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]
+
+   + + unicode
+ str(object='') -> string +
+   + + HtmlParserTestCase
+ HTML parser test cases +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..73279a0c --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser-pysrc.html @@ -0,0 +1,2286 @@ + + + + + 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, html, StringIO, BytesIO, fileInTestDir, _bytes, _str 
+ 15  from common_imports import SillyFileLike, HelperTestCase, write_to_file, next 
+ 16   
+ 17  try: 
+ 18      unicode 
+ 19  except NameError: 
+ 20      unicode = str 
+ 21   
+ 22   
+
23 -class HtmlParserTestCase(HelperTestCase): +
24 """HTML parser test cases + 25 """ + 26 etree = etree + 27 + 28 html_str = _bytes("<html><head><title>test</title></head><body><h1>page title</h1></body></html>") + 29 html_str_pretty = _bytes("""\ + 30 <html> + 31 <head><title>test</title></head> + 32 <body><h1>page title</h1></body> + 33 </html> + 34 """) + 35 broken_html_str = _bytes("<html><head><title>test" + 36 "<body><h1>page title</h3></p></html>") + 37 uhtml_str = _bytes( + 38 "<html><head><title>test á</title></head>" + 39 "<body><h1>page á title</h1></body></html>").decode('utf8') + 40 +
41 - def tearDown(self): +
42 super(HtmlParserTestCase, self).tearDown() + 43 self.etree.set_default_parser() +
44 +
45 - def test_module_HTML(self): +
46 element = self.etree.HTML(self.html_str) + 47 self.assertEqual(self.etree.tostring(element, method="html"), + 48 self.html_str) +
49 +
50 - def test_module_HTML_unicode(self): +
51 element = self.etree.HTML(self.uhtml_str) + 52 self.assertEqual( + 53 self.etree.tostring(element, method="html", encoding='unicode'), + 54 self.uhtml_str) + 55 self.assertEqual(element.findtext('.//h1'), + 56 _bytes("page á title").decode('utf8')) +
57 +
58 - def test_wide_unicode_xml(self): +
59 if sys.maxunicode < 1114111: + 60 return # skip test + 61 element = self.etree.HTML(_bytes( + 62 '<html><body><p>\\U00026007</p></body></html>' + 63 ).decode('unicode_escape')) + 64 p_text = element.findtext('.//p') + 65 self.assertEqual(1, len(p_text)) + 66 self.assertEqual(_bytes('\\U00026007').decode('unicode_escape'), + 67 p_text) +
68 +
69 - def test_html_ids(self): +
70 parser = self.etree.HTMLParser(recover=False) + 71 fromstring = self.etree.fromstring + 72 html = fromstring(''' + 73 <html><body id="bodyID"><p id="pID"></p></body></html> + 74 ''', parser=parser) + 75 self.assertEqual(len(html.xpath('//p[@id="pID"]')), 1) +
76 +
78 parser = self.etree.HTMLParser(recover=False, collect_ids=False) + 79 fromstring = self.etree.fromstring + 80 html = fromstring(''' + 81 <html><body id="bodyID"><p id="pID"></p></body></html> + 82 ''', parser=parser) + 83 self.assertEqual(len(html.xpath('//p[@id="pID"]')), 1) +
84 +
86 element = self.etree.HTML(self.html_str) + 87 self.assertEqual(self.etree.tostring(element, method="html", pretty_print=True), + 88 self.html_str_pretty) +
89 +
91 parser = self.etree.HTMLParser(recover=False) + 92 parse = self.etree.parse + 93 f = BytesIO("<html></body>") + 94 self.assertRaises(self.etree.XMLSyntaxError, + 95 parse, f, parser) +
96 +
98 parser = self.etree.HTMLParser() + 99 Element = parser.makeelement +100 +101 el = Element('name') +102 self.assertRaises(ValueError, Element, '{}') +103 self.assertRaises(ValueError, setattr, el, 'tag', '{}') +104 +105 self.assertRaises(ValueError, Element, '{test}') +106 self.assertRaises(ValueError, setattr, el, 'tag', '{test}') +
107 +
109 parser = self.etree.HTMLParser() +110 Element = parser.makeelement +111 +112 pname = Element('p:name') +113 self.assertEqual(pname.tag, 'p:name') +114 +115 pname = Element('{test}p:name') +116 self.assertEqual(pname.tag, '{test}p:name') +117 +118 pname = Element('name') +119 pname.tag = 'p:name' +120 self.assertEqual(pname.tag, 'p:name') +
121 +
123 parser = self.etree.HTMLParser() +124 Element = parser.makeelement +125 +126 self.assertRaises(ValueError, Element, 'p"name') +127 self.assertRaises(ValueError, Element, "na'me") +128 self.assertRaises(ValueError, Element, '{test}"name') +129 self.assertRaises(ValueError, Element, "{test}name'") +130 +131 el = Element('name') +132 self.assertRaises(ValueError, setattr, el, 'tag', "pname'") +133 self.assertRaises(ValueError, setattr, el, 'tag', '"pname') +134 self.assertEqual(el.tag, "name") +
135 +
137 parser = self.etree.HTMLParser() +138 Element = parser.makeelement +139 +140 self.assertRaises(ValueError, Element, ' name ') +141 self.assertRaises(ValueError, Element, 'na me') +142 self.assertRaises(ValueError, Element, '{test} name') +143 +144 el = Element('name') +145 self.assertRaises(ValueError, setattr, el, 'tag', ' name ') +146 self.assertEqual(el.tag, "name") +
147 +
149 parser = self.etree.HTMLParser() +150 Element = parser.makeelement +151 +152 SubElement = self.etree.SubElement +153 +154 el = Element('name') +155 self.assertRaises(ValueError, SubElement, el, '{}') +156 self.assertRaises(ValueError, SubElement, el, '{test}') +
157 +
159 parser = self.etree.HTMLParser() +160 Element = parser.makeelement +161 SubElement = self.etree.SubElement +162 +163 el = Element('name') +164 pname = SubElement(el, 'p:name') +165 self.assertEqual(pname.tag, 'p:name') +166 +167 pname = SubElement(el, '{test}p:name') +168 self.assertEqual(pname.tag, '{test}p:name') +
169 +
171 parser = self.etree.HTMLParser() +172 Element = parser.makeelement +173 SubElement = self.etree.SubElement +174 +175 el = Element('name') +176 self.assertRaises(ValueError, SubElement, el, "name'") +177 self.assertRaises(ValueError, SubElement, el, 'na"me') +178 self.assertRaises(ValueError, SubElement, el, "{test}na'me") +179 self.assertRaises(ValueError, SubElement, el, '{test}"name') +
180 +
182 parser = self.etree.HTMLParser() +183 Element = parser.makeelement +184 SubElement = self.etree.SubElement +185 +186 el = Element('name') +187 self.assertRaises(ValueError, SubElement, el, ' name ') +188 self.assertRaises(ValueError, SubElement, el, 'na me') +189 self.assertRaises(ValueError, SubElement, el, '{test} name') +
190 +
192 parser = self.etree.HTMLParser(recover=False) +193 parse = self.etree.parse +194 f = BytesIO(self.broken_html_str) +195 self.assertRaises(self.etree.XMLSyntaxError, +196 parse, f, parser) +
197 +
199 parser = self.etree.HTMLParser(default_doctype=False) +200 d = html.fromstring('<!DOCTYPE html><h1>S</h1></html>', parser=parser) +201 self.assertEqual(d.getroottree().docinfo.doctype, '<!DOCTYPE html>') +202 +203 d = html.fromstring('<html><h1>S</h1></html>', parser=parser) +204 self.assertEqual(d.getroottree().docinfo.doctype, '') +
205 +
207 text = _str('Søk på nettet') +208 html_latin1 = (_str('<p>%s</p>') % text).encode('iso-8859-1') +209 +210 tree = self.etree.parse( +211 BytesIO(html_latin1), +212 self.etree.HTMLParser(encoding="iso-8859-1")) +213 p = tree.find("//p") +214 self.assertEqual(p.text, text) +
215 +
217 text = _str('Søk på nettet') +218 wrong_head = _str(''' +219 <head> +220 <meta http-equiv="Content-Type" +221 content="text/html; charset=UTF-8" /> +222 </head>''') +223 html_latin1 = (_str('<html>%s<body><p>%s</p></body></html>') % (wrong_head, +224 text) +225 ).encode('iso-8859-1') +226 +227 self.assertRaises(self.etree.ParseError, +228 self.etree.parse, +229 BytesIO(html_latin1)) +230 +231 tree = self.etree.parse( +232 BytesIO(html_latin1), +233 self.etree.HTMLParser(encoding="iso-8859-1")) +234 p = tree.find("//p") +235 self.assertEqual(p.text, text) +
236 +
237 - def test_module_HTML_broken(self): +
238 element = self.etree.HTML(self.broken_html_str) +239 self.assertEqual(self.etree.tostring(element, method="html"), +240 self.html_str) +
241 +
242 - def test_module_HTML_cdata(self): +
243 # by default, libxml2 generates CDATA nodes for <script> content +244 html = _bytes('<html><head><style>foo</style></head></html>') +245 element = self.etree.HTML(html) +246 self.assertEqual(element[0][0].text, "foo") +
247 +
248 - def test_module_HTML_access(self): +
249 element = self.etree.HTML(self.html_str) +250 self.assertEqual(element[0][0].tag, 'title') +
251 +
252 - def test_module_parse_html(self): +
253 parser = self.etree.HTMLParser() +254 filename = tempfile.mktemp(suffix=".html") +255 write_to_file(filename, self.html_str, 'wb') +256 try: +257 f = open(filename, 'rb') +258 tree = self.etree.parse(f, parser) +259 f.close() +260 self.assertEqual(self.etree.tostring(tree.getroot(), method="html"), +261 self.html_str) +262 finally: +263 os.remove(filename) +
264 +
266 parser = self.etree.HTMLParser() +267 f = SillyFileLike(self.html_str) +268 tree = self.etree.parse(f, parser) +269 html = self.etree.tostring(tree.getroot(), +270 method="html", encoding='UTF-8') +271 self.assertEqual(html, self.html_str) +
272 +273 ## def test_module_parse_html_filelike_unicode(self): +274 ## parser = self.etree.HTMLParser() +275 ## f = SillyFileLike(self.uhtml_str) +276 ## tree = self.etree.parse(f, parser) +277 ## html = self.etree.tostring(tree.getroot(), encoding='UTF-8') +278 ## self.assertEqual(unicode(html, 'UTF-8'), self.uhtml_str) +279 +
280 - def test_html_file_error(self): +
281 parser = self.etree.HTMLParser() +282 parse = self.etree.parse +283 self.assertRaises(IOError, +284 parse, "__some_hopefully_nonexisting_file__.html", +285 parser) +
286 +
288 self.assertRaises(self.etree.XMLSyntaxError, +289 self.etree.parse, BytesIO(self.broken_html_str)) +290 +291 self.etree.set_default_parser( self.etree.HTMLParser() ) +292 +293 tree = self.etree.parse(BytesIO(self.broken_html_str)) +294 self.assertEqual(self.etree.tostring(tree.getroot(), method="html"), +295 self.html_str) +296 +297 self.etree.set_default_parser() +298 +299 self.assertRaises(self.etree.XMLSyntaxError, +300 self.etree.parse, BytesIO(self.broken_html_str)) +
301 +
302 - def test_html_iterparse(self): +
303 iterparse = self.etree.iterparse +304 f = BytesIO( +305 '<html><head><title>TITLE</title><body><p>P</p></body></html>') +306 +307 iterator = iterparse(f, html=True) +308 self.assertEqual(None, iterator.root) +309 +310 events = list(iterator) +311 root = iterator.root +312 self.assertTrue(root is not None) +313 self.assertEqual( +314 [('end', root[0][0]), ('end', root[0]), ('end', root[1][0]), +315 ('end', root[1]), ('end', root)], +316 events) +
317 +
319 iterparse = self.etree.iterparse +320 f = BytesIO( +321 '<html><head><title>TITLE</title><body><p>P</p></body></html>') +322 +323 iterator = iterparse(f, html=True) +324 self.assertEqual(None, iterator.root) +325 +326 event, element = next(iterator) +327 self.assertEqual('end', event) +328 self.assertEqual('title', element.tag) +329 self.assertEqual(None, iterator.root) +330 del element +331 +332 event, element = next(iterator) +333 self.assertEqual('end', event) +334 self.assertEqual('head', element.tag) +335 self.assertEqual(None, iterator.root) +336 del element +337 del iterator +
338 +
339 - def test_html_iterparse_broken(self): +
340 iterparse = self.etree.iterparse +341 f = BytesIO('<head><title>TEST></head><p>P<br></div>') +342 +343 iterator = iterparse(f, html=True) +344 self.assertEqual(None, iterator.root) +345 +346 events = list(iterator) +347 root = iterator.root +348 self.assertTrue(root is not None) +349 self.assertEqual('html', root.tag) +350 self.assertEqual('head', root[0].tag) +351 self.assertEqual('body', root[1].tag) +352 self.assertEqual('p', root[1][0].tag) +353 self.assertEqual('br', root[1][0][0].tag) +354 self.assertEqual( +355 [('end', root[0][0]), ('end', root[0]), ('end', root[1][0][0]), +356 ('end', root[1][0]), ('end', root[1]), ('end', root)], +357 events) +
358 +
360 iterparse = self.etree.iterparse +361 f = BytesIO('<p>P<br></div>') +362 iterator = iterparse(f, html=True, recover=False) +363 self.assertRaises(self.etree.XMLSyntaxError, list, iterator) +
364 +
365 - def test_html_iterparse_file(self): +
366 iterparse = self.etree.iterparse +367 iterator = iterparse(fileInTestDir("shakespeare.html"), +368 html=True) +369 +370 self.assertEqual(None, iterator.root) +371 events = list(iterator) +372 root = iterator.root +373 self.assertTrue(root is not None) +374 self.assertEqual(249, len(events)) +375 self.assertFalse( +376 [event for (event, element) in events if event != 'end']) +
377 +
378 - def test_html_iterparse_start(self): +
379 iterparse = self.etree.iterparse +380 f = BytesIO( +381 '<html><head><title>TITLE</title><body><p>P</p></body></html>') +382 +383 iterator = iterparse(f, html=True, events=('start',)) +384 self.assertEqual(None, iterator.root) +385 +386 events = list(iterator) +387 root = iterator.root +388 self.assertNotEqual(None, root) +389 self.assertEqual( +390 [('start', root), ('start', root[0]), ('start', root[0][0]), +391 ('start', root[1]), ('start', root[1][0])], +392 events) +
393 +
394 - def test_html_feed_parser(self): +
395 parser = self.etree.HTMLParser() +396 parser.feed("<html><body></") +397 parser.feed("body></html>") +398 root = parser.close() +399 +400 self.assertEqual('html', root.tag) +401 # test that we find all names in the parser dict +402 self.assertEqual([root], list(root.iter('html'))) +403 self.assertEqual([root[0]], list(root.iter('body'))) +
404 +
406 parser = self.etree.HTMLParser() +407 parser.feed("<htm") +408 parser.feed("l><body") +409 parser.feed("><") +410 parser.feed("p><") +411 parser.feed("strong") +412 parser.feed(">some ") +413 parser.feed("text</strong></p><") +414 parser.feed("/body></html>") +415 root = parser.close() +416 +417 self.assertEqual('html', root.tag) +418 # test that we find all names in the parser dict +419 self.assertEqual([root], list(root.iter('html'))) +420 self.assertEqual([root[0]], list(root.iter('body'))) +421 self.assertEqual([root[0][0]], list(root.iter('p'))) +422 self.assertEqual([root[0][0][0]], list(root.iter('strong'))) +
423 +
425 parser = self.etree.HTMLParser() +426 parser.feed('<html><head>') +427 parser.feed('<title>TITLE</title><body><p>P</p></body><') +428 parser.feed("/html>") +429 root = parser.close() +430 +431 self.assertEqual('html', root.tag) +432 # test that we find all names in the parser dict +433 self.assertEqual([root], list(root.iter('html'))) +434 self.assertEqual([root[0]], list(root.iter('head'))) +435 self.assertEqual([root[0][0]], list(root.iter('title'))) +436 self.assertEqual([root[1]], list(root.iter('body'))) +437 self.assertEqual([root[1][0]], list(root.iter('p'))) +
438 +
440 assertFalse = self.assertFalse +441 events = [] +442 class Target(object): +443 def start(self, tag, attrib): +444 events.append(("start", tag)) +445 assertFalse(attrib) +
446 def end(self, tag): +447 events.append(("end", tag)) +
448 def close(self): +449 return "DONE" +450 +451 parser = self.etree.HTMLParser(target=Target()) +452 +453 parser.feed("<html><body></body></html>") +454 done = parser.close() +455 +456 self.assertEqual("DONE", done) +457 self.assertEqual([ +458 ("start", "html"), ("start", "body"), +459 ("end", "body"), ("end", "html")], events) +460 +
462 assertFalse = self.assertFalse +463 events = [] +464 class Target(object): +465 def start(self, tag, attrib): +466 events.append(("start", tag)) +467 assertFalse(attrib) +
468 def end(self, tag): +469 events.append(("end", tag)) +470 def doctype(self, *args): +471 events.append(("doctype", args)) +472 def close(self): +473 return "DONE" +474 +475 parser = self.etree.HTMLParser(target=Target()) +476 parser.feed("<!DOCTYPE><html><body></body></html>") +477 done = parser.close() +478 +479 self.assertEqual("DONE", done) +480 self.assertEqual([ +481 ("doctype", (None, None, None)), +482 ("start", "html"), ("start", "body"), +483 ("end", "body"), ("end", "html")], events) +484 +
486 assertFalse = self.assertFalse +487 events = [] +488 class Target(object): +489 def start(self, tag, attrib): +490 events.append(("start", tag)) +491 assertFalse(attrib) +
492 def end(self, tag): +493 events.append(("end", tag)) +494 def doctype(self, *args): +495 events.append(("doctype", args)) +496 def close(self): +497 return "DONE" +498 +499 parser = self.etree.HTMLParser(target=Target()) +500 parser.feed("<!DOCTYPE html><html><body></body></html>") +501 done = parser.close() +502 +503 self.assertEqual("DONE", done) +504 self.assertEqual([ +505 ("doctype", ("html", None, None)), +506 ("start", "html"), ("start", "body"), +507 ("end", "body"), ("end", "html")], events) +508 +
510 assertFalse = self.assertFalse +511 events = [] +512 class Target(object): +513 def start(self, tag, attrib): +514 events.append(("start", tag)) +515 assertFalse(attrib) +
516 def end(self, tag): +517 events.append(("end", tag)) +518 def doctype(self, *args): +519 events.append(("doctype", args)) +520 def close(self): +521 return "DONE" +522 +523 parser = self.etree.HTMLParser(target=Target()) +524 parser.feed('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "sys.dtd">' +525 '<html><body></body></html>') +526 done = parser.close() +527 +528 self.assertEqual("DONE", done) +529 self.assertEqual([ +530 ("doctype", ("html", "-//W3C//DTD HTML 4.01//EN", "sys.dtd")), +531 ("start", "html"), ("start", "body"), +532 ("end", "body"), ("end", "html")], events) +533 +
535 events = [] +536 class Target(object): +537 def start(self, tag, attrib): +538 events.append(("start", tag)) +539 raise ValueError("START") +
540 def end(self, tag): +541 events.append(("end", tag)) +542 raise TypeError("END") +543 def close(self): +544 return "DONE" +545 +546 parser = self.etree.HTMLParser(target=Target()) +547 try: +548 parser.feed('<html><body>') +549 parser.feed('</body></html>') +550 except ValueError as exc: +551 assert "START" in str(exc) +552 except TypeError as exc: +553 assert "END" in str(exc) +554 self.assertTrue(False, "wrong exception raised") +555 else: +556 self.assertTrue(False, "no exception raised") +557 +558 self.assertTrue(("start", "html") in events, events) +559 self.assertTrue(("end", "html") not in events, events) +560 +
562 events = [] +563 class Target(object): +564 def start(self, tag, attrib): +565 events.append(("start", tag)) +566 raise ValueError("START") +
567 def end(self, tag): +568 events.append(("end", tag)) +569 raise TypeError("END") +570 def close(self): +571 return "DONE" +572 +573 parser = self.etree.HTMLParser(target=Target()) +574 try: +575 self.etree.fromstring('<html><body></body></html>', parser) +576 except ValueError as exc: +577 assert "START" in str(exc), str(exc) +578 except TypeError as exc: +579 assert "END" in str(exc), str(exc) +580 self.assertTrue(False, "wrong exception raised") +581 else: +582 self.assertTrue(False, "no exception raised") +583 +584 self.assertTrue(("start", "html") in events, events) +585 self.assertTrue(("end", "html") not in events, events) +586 +
587 - def test_set_decl_html(self): +
588 doc = html.Element('html').getroottree() +589 doc.docinfo.public_id = "-//W3C//DTD XHTML 1.0 Strict//EN" +590 doc.docinfo.system_url = \ +591 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" +592 self.assertEqual(doc.docinfo.doctype, +593 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">') +594 self.assertEqual(self.etree.tostring(doc), +595 _bytes('''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +596 <html xmlns="http://www.w3.org/1999/xhtml"></html>''')) +
597 +
598 - def test_html5_doctype(self): +
599 # document type declaration with neither public if nor system url +600 doc = html.Element('html').getroottree() +601 doc.docinfo.public_id = None +602 doc.docinfo.system_url = None +603 self.assertEqual(doc.docinfo.doctype, +604 '<!DOCTYPE html>') +605 self.assertTrue(doc.docinfo.public_id is None) +606 self.assertEqual(self.etree.tostring(doc), +607 _bytes('<!DOCTYPE html>\n<html/>')) +
608 +
609 - def test_ietf_decl(self): +
610 # legacy declaration with public id, no system url +611 doc = html.Element('html').getroottree() +612 doc.docinfo.public_id = '-//IETF//DTD HTML//EN' +613 doc.docinfo.system_url = None +614 self.assertEqual(doc.docinfo.doctype, +615 '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">') +616 self.assertEqual(self.etree.tostring(doc), +617 _bytes('<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">\n<html/>')) +
618 +
619 - def test_boolean_attribute(self): +
620 # ability to serialize boolean attribute by setting value to None +621 form = html.Element('form') +622 form.set('novalidate', None) +623 self.assertEqual(html.tostring(form), +624 _bytes('<form novalidate></form>')) +625 form.set('custom') +626 self.assertEqual(html.tostring(form), +627 _bytes('<form novalidate custom></form>')) +
628 +
630 # ability to pass boolean attributes unmodified +631 fragment = '<tag attribute></tag>' +632 self.assertEqual(html.tostring(html.fragment_fromstring(fragment)), +633 _bytes(fragment)) +
634 +
636 # html serialized as xml converts boolean attributes to empty strings +637 fragment = '<tag attribute></tag>' +638 self.assertEqual(self.etree.tostring(html.fragment_fromstring(fragment)), +639 _bytes('<tag attribute=""/>')) +
640 +641 +
642 -def test_suite(): +
643 suite = unittest.TestSuite() +644 suite.addTests([unittest.makeSuite(HtmlParserTestCase)]) +645 return suite +
646 +647 +648 if __name__ == '__main__': +649 print('to test use test.py %s' % __file__) +650 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..ea1bd50f --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser.HtmlParserTestCase-class.html @@ -0,0 +1,1311 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               HtmlParserTestCase
+
+ +
+HTML parser test cases + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_wide_unicode_xml(self) + source code + +
+ +
+   + + + + + + +
test_html_ids(self) + source code + +
+ +
+   + + + + + + +
test_html_ids_no_collect_ids(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_module_parse_html_default_doctype(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_stop_short(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse_broken(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse_broken_no_recover(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse_file(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse_start(self) + source code + +
+ +
+   + + + + + + +
test_html_feed_parser(self) + source code + +
+ +
+   + + + + + + +
test_html_feed_parser_chunky(self) + source code + +
+ +
+   + + + + + + +
test_html_feed_parser_more_tags(self) + source code + +
+ +
+   + + + + + + +
test_html_parser_target_tag(self) + source code + +
+ +
+   + + + + + + +
test_html_parser_target_doctype_empty(self) + source code + +
+ +
+   + + + + + + +
test_html_parser_target_doctype_html(self) + source code + +
+ +
+   + + + + + + +
test_html_parser_target_doctype_html_full(self) + source code + +
+ +
+   + + + + + + +
test_html_parser_target_exceptions(self) + source code + +
+ +
+   + + + + + + +
test_html_fromstring_target_exceptions(self) + source code + +
+ +
+   + + + + + + +
test_set_decl_html(self) + source code + +
+ +
+   + + + + + + +
test_html5_doctype(self) + source code + +
+ +
+   + + + + + + +
test_ietf_decl(self) + source code + +
+ +
+   + + + + + + +
test_boolean_attribute(self) + source code + +
+ +
+   + + + + + + +
test_boolean_attribute_round_trip(self) + source code + +
+ +
+   + + + + + + +
test_boolean_attribute_xml_adds_empty_string(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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 á</title></head><body>... +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.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 á</title></head><body><h1>page á title</\
+h1></body></html>'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_http_io-module.html b/doc/html/api/lxml.tests.test_http_io-module.html new file mode 100644 index 00000000..a85ed19e --- /dev/null +++ b/doc/html/api/lxml.tests.test_http_io-module.html @@ -0,0 +1,246 @@ + + + + + lxml.tests.test_http_io + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_http_io + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_http_io

source code

+Web IO test cases (wsgiref) + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + HttpIOTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_http_io-pysrc.html b/doc/html/api/lxml.tests.test_http_io-pysrc.html new file mode 100644 index 00000000..01db6b2d --- /dev/null +++ b/doc/html/api/lxml.tests.test_http_io-pysrc.html @@ -0,0 +1,536 @@ + + + + + lxml.tests.test_http_io + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_http_io + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_http_io

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Web IO test cases (wsgiref) 
+  5  """ 
+  6   
+  7  from __future__ import with_statement 
+  8   
+  9  import unittest 
+ 10  import textwrap 
+ 11  import os 
+ 12  import sys 
+ 13  import gzip 
+ 14   
+ 15  this_dir = os.path.dirname(__file__) 
+ 16  if this_dir not in sys.path: 
+ 17      sys.path.insert(0, this_dir)  # needed for Py3 
+ 18   
+ 19  from .common_imports import ( 
+ 20      etree, HelperTestCase, BytesIO, _bytes) 
+ 21  from .dummy_http_server import webserver, HTTPRequestCollector 
+ 22   
+ 23   
+
24 -class HttpIOTestCase(HelperTestCase): +
25 etree = etree + 26 +
27 - def _parse_from_http(self, data, code=200, headers=None, parser=None): +
28 handler = HTTPRequestCollector(data, code, headers) + 29 with webserver(handler) as host_url: + 30 tree = self.etree.parse(host_url + 'TEST', parser=parser) + 31 self.assertEqual([('/TEST', [])], handler.requests) + 32 return tree +
33 +
34 - def test_http_client(self): +
35 tree = self._parse_from_http(_bytes('<root><a/></root>')) + 36 self.assertEqual('root', tree.getroot().tag) + 37 self.assertEqual('a', tree.getroot()[0].tag) +
38 +
39 - def test_http_client_404(self): +
40 try: + 41 self._parse_from_http(_bytes('<root/>'), code=404) + 42 except IOError: + 43 self.assertTrue(True) + 44 else: + 45 self.assertTrue(False, "expected IOError") +
46 +
47 - def test_http_client_gzip(self): +
48 f = BytesIO() + 49 gz = gzip.GzipFile(fileobj=f, mode='w', filename='test.xml') + 50 gz.write(_bytes('<root><a/></root>')) + 51 gz.close() + 52 data = f.getvalue() + 53 del f, gz + 54 + 55 headers = [('Content-Encoding', 'gzip')] + 56 tree = self._parse_from_http(data, headers=headers) + 57 self.assertEqual('root', tree.getroot().tag) + 58 self.assertEqual('a', tree.getroot()[0].tag) +
59 +
60 - def test_parser_input_mix(self): +
61 data = _bytes('<root><a/></root>') + 62 handler = HTTPRequestCollector(data) + 63 + 64 with webserver(handler) as host_url: + 65 tree = self.etree.parse(host_url) + 66 root = tree.getroot() + 67 self.assertEqual('a', root[0].tag) + 68 + 69 root = self.etree.fromstring(data) + 70 self.assertEqual('a', root[0].tag) + 71 + 72 tree = self.etree.parse(host_url) + 73 root = tree.getroot() + 74 self.assertEqual('a', root[0].tag) + 75 + 76 root = self.etree.fromstring(data) + 77 self.assertEqual('a', root[0].tag) + 78 + 79 root = self.etree.fromstring(data) + 80 self.assertEqual('a', root[0].tag) +
81 +
82 - def test_network_dtd(self): +
83 data = [_bytes(textwrap.dedent(s)) for s in [ + 84 # XML file + 85 '''\ + 86 <?xml version="1.0"?> + 87 <!DOCTYPE root SYSTEM "./file.dtd"> + 88 <root>&myentity;</root> + 89 ''', + 90 # DTD + 91 '<!ENTITY myentity "DEFINED">', + 92 ]] + 93 + 94 responses = [] + 95 def handler(environ, start_response): + 96 start_response('200 OK', []) + 97 return [responses.pop()] +
98 + 99 with webserver(handler) as host_url: +100 # DTD network loading enabled +101 responses = data[::-1] +102 tree = self.etree.parse( +103 host_url + 'dir/test.xml', +104 parser=self.etree.XMLParser( +105 load_dtd=True, no_network=False)) +106 self.assertFalse(responses) # all read +107 root = tree.getroot() +108 self.assertEqual('DEFINED', root.text) +109 +110 # DTD network loading disabled +111 responses = data[::-1] +112 try: +113 self.etree.parse( +114 host_url + 'dir/test.xml', +115 parser=self.etree.XMLParser( +116 load_dtd=True, no_network=True)) +117 except self.etree.XMLSyntaxError: +118 self.assertTrue("myentity" in str(sys.exc_info()[1])) +119 else: +120 self.assertTrue(False) +121 self.assertEqual(1, len(responses)) # DTD not read +
122 +123 +
124 -def test_suite(): +
125 suite = unittest.TestSuite() +126 suite.addTests([unittest.makeSuite(HttpIOTestCase)]) +127 return suite +
128 +129 +130 if __name__ == '__main__': +131 print('to test use test.py %s' % __file__) +132 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_http_io.HttpIOTestCase-class.html b/doc/html/api/lxml.tests.test_http_io.HttpIOTestCase-class.html new file mode 100644 index 00000000..6a283012 --- /dev/null +++ b/doc/html/api/lxml.tests.test_http_io.HttpIOTestCase-class.html @@ -0,0 +1,487 @@ + + + + + lxml.tests.test_http_io.HttpIOTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_http_io :: + Class HttpIOTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HttpIOTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               HttpIOTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_parse_from_http(self, + data, + code=200, + headers=None, + parser=None) + source code + +
+ +
+   + + + + + + +
test_http_client(self) + source code + +
+ +
+   + + + + + + +
test_http_client_404(self) + source code + +
+ +
+   + + + + + + +
test_http_client_gzip(self) + source code + +
+ +
+   + + + + + + +
test_parser_input_mix(self) + source code + +
+ +
+   + + + + + + +
test_network_dtd(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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_incremental_xmlfile-module.html b/doc/html/api/lxml.tests.test_incremental_xmlfile-module.html new file mode 100644 index 00000000..583070ce --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile-module.html @@ -0,0 +1,288 @@ + + + + + lxml.tests.test_incremental_xmlfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_incremental_xmlfile

source code

+Tests for the incremental XML serialisation API. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + _XmlFileTestCaseBase +
+   + + BytesIOXmlFileTestCase +
+   + + TempXmlFileTestCase +
+   + + TempPathXmlFileTestCase +
+   + + SimpleFileLikeXmlFileTestCase +
+   + + HtmlFileTestCase +
+   + + AsyncXmlFileTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile-pysrc.html b/doc/html/api/lxml.tests.test_incremental_xmlfile-pysrc.html new file mode 100644 index 00000000..e8b3da2c --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile-pysrc.html @@ -0,0 +1,1591 @@ + + + + + lxml.tests.test_incremental_xmlfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_incremental_xmlfile

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Tests for the incremental XML serialisation API. 
+  5  """ 
+  6   
+  7  from __future__ import absolute_import 
+  8   
+  9  import io 
+ 10  import os 
+ 11  import sys 
+ 12  import unittest 
+ 13  import textwrap 
+ 14  import tempfile 
+ 15   
+ 16  from lxml.etree import LxmlSyntaxError 
+ 17   
+ 18  this_dir = os.path.dirname(__file__) 
+ 19  if this_dir not in sys.path: 
+ 20      sys.path.insert(0, this_dir) # needed for Py3 
+ 21   
+ 22  from .common_imports import etree, BytesIO, HelperTestCase, skipIf, _str 
+
23 + 24 + 25 -class _XmlFileTestCaseBase(HelperTestCase): +
26 _file = None # to be set by specific subtypes below + 27 +
28 - def test_element(self): +
29 with etree.xmlfile(self._file) as xf: + 30 with xf.element('test'): + 31 pass + 32 self.assertXml('<test></test>') +
33 +
34 - def test_element_write_text(self): +
35 with etree.xmlfile(self._file) as xf: + 36 with xf.element('test'): + 37 xf.write('toast') + 38 self.assertXml('<test>toast</test>') +
39 +
40 - def test_element_write_empty(self): +
41 with etree.xmlfile(self._file) as xf: + 42 with xf.element('test'): + 43 xf.write(None) + 44 xf.write('') + 45 xf.write('') + 46 xf.write(None) + 47 self.assertXml('<test></test>') +
48 +
49 - def test_element_nested(self): +
50 with etree.xmlfile(self._file) as xf: + 51 with xf.element('test'): + 52 with xf.element('toast'): + 53 with xf.element('taste'): + 54 xf.write('conTent') + 55 self.assertXml('<test><toast><taste>conTent</taste></toast></test>') +
56 +
58 with etree.xmlfile(self._file) as xf: + 59 with xf.element('test'): + 60 xf.write('con') + 61 with xf.element('toast'): + 62 xf.write('tent') + 63 with xf.element('taste'): + 64 xf.write('inside') + 65 xf.write('tnet') + 66 xf.write('noc') + 67 self.assertXml('<test>con<toast>tent<taste>inside</taste>' + 68 'tnet</toast>noc</test>') +
69 +
70 - def test_write_Element(self): +
71 with etree.xmlfile(self._file) as xf: + 72 xf.write(etree.Element('test')) + 73 self.assertXml('<test/>') +
74 +
76 element = etree.Element('test') + 77 with etree.xmlfile(self._file) as xf: + 78 with xf.element('test'): + 79 for i in range(100): + 80 xf.write(element) + 81 + 82 tree = self._parse_file() + 83 self.assertTrue(tree is not None) + 84 self.assertEqual(100, len(tree.getroot())) + 85 self.assertEqual({'test'}, {el.tag for el in tree.getroot()}) +
86 +
87 - def test_namespace_nsmap(self): +
88 with etree.xmlfile(self._file) as xf: + 89 with xf.element('{nsURI}test', nsmap={'x': 'nsURI'}): + 90 pass + 91 self.assertXml('<x:test xmlns:x="nsURI"></x:test>') +
92 +
94 with etree.xmlfile(self._file) as xf: + 95 with xf.element('test', nsmap={'x': 'nsURI'}): + 96 with xf.element('{nsURI}toast'): + 97 pass + 98 self.assertXml('<test xmlns:x="nsURI"><x:toast></x:toast></test>') +
99 +
100 - def test_anonymous_namespace(self): +
101 with etree.xmlfile(self._file) as xf: +102 with xf.element('{nsURI}test'): +103 pass +104 self.assertXml('<ns0:test xmlns:ns0="nsURI"></ns0:test>') +
105 +
107 with etree.xmlfile(self._file) as xf: +108 with xf.element('test'): +109 with xf.element('{nsURI}toast'): +110 pass +111 self.assertXml('<test><ns0:toast xmlns:ns0="nsURI"></ns0:toast></test>') +
112 +
113 - def test_default_namespace(self): +
114 with etree.xmlfile(self._file) as xf: +115 with xf.element('{nsURI}test', nsmap={None: 'nsURI'}): +116 pass +117 self.assertXml('<test xmlns="nsURI"></test>') +
118 +
120 with etree.xmlfile(self._file) as xf: +121 with xf.element('{nsURI}test', nsmap={None: 'nsURI'}): +122 with xf.element('{nsURI}toast'): +123 pass +124 self.assertXml('<test xmlns="nsURI"><toast></toast></test>') +
125 +
127 with etree.xmlfile(self._file) as xf: +128 with xf.element('{nsURI}test', nsmap={None: 'nsURI', 'p': 'ns2'}): +129 with xf.element('{nsURI}toast'): +130 pass +131 with xf.element('{ns2}toast'): +132 pass +133 self.assertXml( +134 '<test xmlns="nsURI" xmlns:p="ns2"><toast></toast><p:toast></p:toast></test>') +
135 +
136 - def test_pi(self): +
137 with etree.xmlfile(self._file) as xf: +138 xf.write(etree.ProcessingInstruction('pypi')) +139 with xf.element('test'): +140 pass +141 self.assertXml('<?pypi ?><test></test>') +
142 +
143 - def test_comment(self): +
144 with etree.xmlfile(self._file) as xf: +145 xf.write(etree.Comment('a comment')) +146 with xf.element('test'): +147 pass +148 self.assertXml('<!--a comment--><test></test>') +
149 +
150 - def test_attribute(self): +
151 with etree.xmlfile(self._file) as xf: +152 with xf.element('test', attrib={'k': 'v'}): +153 pass +154 self.assertXml('<test k="v"></test>') +
155 +
156 - def test_attribute_extra(self): +
157 with etree.xmlfile(self._file) as xf: +158 with xf.element('test', attrib={'k': 'v'}, n='N'): +159 pass +160 self.assertXml('<test k="v" n="N"></test>') +
161 +
163 with etree.xmlfile(self._file) as xf: +164 with xf.element('test', attrib={'k': 'v'}, k='V'): +165 pass +166 self.assertXml('<test k="V"></test>') +
167 +
168 - def test_escaping(self): +
169 with etree.xmlfile(self._file) as xf: +170 with xf.element('test'): +171 xf.write('Comments: <!-- text -->\n') +172 xf.write('Entities: &amp;') +173 self.assertXml( +174 '<test>Comments: &lt;!-- text --&gt;\nEntities: &amp;amp;</test>') +
175 +
176 - def test_encoding(self): +
177 with etree.xmlfile(self._file, encoding='utf16') as xf: +178 with xf.element('test'): +179 xf.write('toast') +180 self.assertXml('<test>toast</test>', encoding='utf16') +
181 +
182 - def test_buffering(self): +
183 with etree.xmlfile(self._file, buffered=False) as xf: +184 with xf.element('test'): +185 self.assertXml("<test>") +186 xf.write('toast') +187 self.assertXml("<test>toast") +188 with xf.element('taste'): +189 self.assertXml("<test>toast<taste>") +190 xf.write('some', etree.Element("more"), "toast") +191 self.assertXml("<test>toast<taste>some<more/>toast") +192 self.assertXml("<test>toast<taste>some<more/>toast</taste>") +193 xf.write('end') +194 self.assertXml("<test>toast<taste>some<more/>toast</taste>end") +195 self.assertXml("<test>toast<taste>some<more/>toast</taste>end</test>") +196 self.assertXml("<test>toast<taste>some<more/>toast</taste>end</test>") +
197 +
198 - def test_flush(self): +
199 with etree.xmlfile(self._file, buffered=True) as xf: +200 with xf.element('test'): +201 self.assertXml("") +202 xf.write('toast') +203 self.assertXml("") +204 with xf.element('taste'): +205 self.assertXml("") +206 xf.flush() +207 self.assertXml("<test>toast<taste>") +208 self.assertXml("<test>toast<taste>") +209 self.assertXml("<test>toast<taste>") +210 self.assertXml("<test>toast<taste></taste></test>") +
211 +
213 try: +214 with etree.xmlfile(self._file) as xf: +215 with xf.element('root'): +216 with xf.element('test'): +217 xf.write("BEFORE") +218 raise TypeError("FAIL!") +219 xf.write("AFTER") +220 except TypeError as exc: +221 self.assertTrue("FAIL" in str(exc), exc) +222 else: +223 self.assertTrue(False, "exception not propagated") +224 self.assertXml("<root><test>BEFORE</test></root>") +
225 +
227 def gen(): +228 with etree.xmlfile(self._file) as xf: +229 with xf.element('root'): +230 while True: +231 content = (yield) +232 with xf.element('entry'): +233 xf.write(content) +
234 +235 g = gen() +236 next(g) +237 g.send('A') +238 g.send('B') +239 g.send('C') +240 g.close() +241 self.assertXml("<root><entry>A</entry><entry>B</entry><entry>C</entry></root>") +
242 +
244 try: +245 with etree.xmlfile(self._file) as xf: +246 xf.write('toast') +247 except etree.LxmlSyntaxError: +248 self.assertTrue(True) +249 else: +250 self.assertTrue(False) +
251 +
252 - def test_failure_trailing_text(self): +
253 with etree.xmlfile(self._file) as xf: +254 with xf.element('test'): +255 pass +256 try: +257 xf.write('toast') +258 except etree.LxmlSyntaxError: +259 self.assertTrue(True) +260 else: +261 self.assertTrue(False) +
262 +
264 with etree.xmlfile(self._file) as xf: +265 with xf.element('test'): +266 pass +267 try: +268 xf.write(etree.Element('test')) +269 except etree.LxmlSyntaxError: +270 self.assertTrue(True) +271 else: +272 self.assertTrue(False) +
273 +
275 cm_exit = None +276 try: +277 with etree.xmlfile(self._file) as xf: +278 x = xf.element('test') +279 cm_exit = x.__exit__ +280 x.__enter__() +281 raise ValueError('123') +282 except ValueError: +283 self.assertTrue(cm_exit) +284 try: +285 cm_exit(ValueError, ValueError("huhu"), None) +286 except etree.LxmlSyntaxError: +287 self.assertTrue(True) +288 else: +289 self.assertTrue(False) +290 else: +291 self.assertTrue(False) +
292 +
293 - def _read_file(self): +
294 pos = self._file.tell() +295 self._file.seek(0) +296 try: +297 return self._file.read() +298 finally: +299 self._file.seek(pos) +
300 +
301 - def _parse_file(self): +
302 pos = self._file.tell() +303 self._file.seek(0) +304 try: +305 return etree.parse(self._file) +306 finally: +307 self._file.seek(pos) +
308 +
309 - def tearDown(self): +
310 if self._file is not None: +311 self._file.close() +
312 +
313 - def assertXml(self, expected, encoding='utf8'): +
314 self.assertEqual(self._read_file().decode(encoding), expected) +
315 +
316 +317 -class BytesIOXmlFileTestCase(_XmlFileTestCaseBase): +
318 - def setUp(self): +
319 self._file = BytesIO() +
320 +
321 - def test_filelike_close(self): +
322 with etree.xmlfile(self._file, close=True) as xf: +323 with xf.element('test'): +324 pass +325 self.assertRaises(ValueError, self._file.getvalue) +
326 +
327 +328 -class TempXmlFileTestCase(_XmlFileTestCaseBase): +
329 - def setUp(self): +
330 self._file = tempfile.TemporaryFile() +
331 +
332 +333 @skipIf(sys.platform.startswith("win"), "Can't reopen temporary files on Windows") +334 -class TempPathXmlFileTestCase(_XmlFileTestCaseBase): +
335 - def setUp(self): +
336 self._tmpfile = tempfile.NamedTemporaryFile() +337 self._file = self._tmpfile.name +
338 +
339 - def tearDown(self): +
340 try: +341 self._tmpfile.close() +342 finally: +343 if os.path.exists(self._tmpfile.name): +344 os.unlink(self._tmpfile.name) +
345 +
346 - def _read_file(self): +
347 self._tmpfile.seek(0) +348 return self._tmpfile.read() +
349 +
350 - def _parse_file(self): +
351 self._tmpfile.seek(0) +352 return etree.parse(self._tmpfile) +
353 +354 @skipIf(True, "temp file behaviour is too platform specific here") +
355 - def test_buffering(self): +
356 pass +
357 +358 @skipIf(True, "temp file behaviour is too platform specific here") +
359 - def test_flush(self): +
360 pass +
361 +
362 +363 -class SimpleFileLikeXmlFileTestCase(_XmlFileTestCaseBase): +
364 - class SimpleFileLike(object): +
365 - def __init__(self, target): +
366 self._target = target +367 self.write = target.write +368 self.tell = target.tell +369 self.seek = target.seek +370 self.closed = False +
371 +
372 - def close(self): +
373 assert not self.closed +374 self.closed = True +375 self._target.close() +
376 +
377 - def setUp(self): +
378 self._target = BytesIO() +379 self._file = self.SimpleFileLike(self._target) +
380 +
381 - def _read_file(self): +
382 return self._target.getvalue() +
383 +
384 - def _parse_file(self): +
385 pos = self._file.tell() +386 self._target.seek(0) +387 try: +388 return etree.parse(self._target) +389 finally: +390 self._target.seek(pos) +
391 +
392 - def test_filelike_not_closing(self): +
393 with etree.xmlfile(self._file) as xf: +394 with xf.element('test'): +395 pass +396 self.assertFalse(self._file.closed) +
397 +
398 - def test_filelike_close(self): +
399 with etree.xmlfile(self._file, close=True) as xf: +400 with xf.element('test'): +401 pass +402 self.assertTrue(self._file.closed) +403 self._file = None # prevent closing in tearDown() +
404 +
405 - def test_write_fails(self): +
406 class WriteError(Exception): +407 pass +
408 +409 class Writer(object): +410 def __init__(self, trigger): +411 self._trigger = trigger +412 self._failed = False +
413 +414 def write(self, data): +415 assert not self._failed, "write() called again after failure" +416 if self._trigger in data: +417 self._failed = True +418 raise WriteError("FAILED: " + self._trigger.decode('utf8')) +419 +420 for trigger in ['text', 'root', 'tag', 'noflush']: +421 try: +422 with etree.xmlfile(Writer(trigger.encode('utf8')), encoding='utf8') as xf: +423 with xf.element('root'): +424 xf.flush() +425 with xf.element('tag'): +426 xf.write('text') +427 xf.flush() +428 xf.write('noflush') +429 xf.flush() +430 xf.flush() +431 except WriteError as exc: +432 self.assertTrue('FAILED: ' + trigger in str(exc)) +433 else: +434 self.assertTrue(False, "exception not raised for '%s'" % trigger) +435 +
436 +437 -class HtmlFileTestCase(_XmlFileTestCaseBase): +
438 - def setUp(self): +
439 self._file = BytesIO() +
440 +
441 - def test_void_elements(self): +
442 # http://www.w3.org/TR/html5/syntax.html#elements-0 +443 void_elements = { +444 "area", "base", "br", "col", "embed", "hr", "img", "input", +445 "keygen", "link", "meta", "param", "source", "track", "wbr"} +446 +447 # FIXME: These don't get serialized as void elements. +448 void_elements.difference_update([ +449 'area', 'embed', 'keygen', 'source', 'track', 'wbr' +450 ]) +451 +452 for tag in sorted(void_elements): +453 with etree.htmlfile(self._file) as xf: +454 xf.write(etree.Element(tag)) +455 self.assertXml('<%s>' % tag) +456 self._file = BytesIO() +
457 +
459 with etree.htmlfile(self._file) as xf: +460 with xf.element('foo'): +461 cm = xf.method('xml') +462 cm.__enter__() +463 +464 self.assertRaises(LxmlSyntaxError, cm.__enter__) +465 +466 cm2 = xf.method('xml') +467 cm2.__enter__() +468 cm2.__exit__(None, None, None) +469 +470 self.assertRaises(LxmlSyntaxError, cm2.__exit__, None, None, None) +471 +472 cm3 = xf.method('xml') +473 cm3.__enter__() +474 with xf.method('html'): +475 self.assertRaises(LxmlSyntaxError, cm3.__exit__, None, None, None) +
476 +
478 tag = 'foo' +479 attrib = {'selected': 'bar'} +480 elt = etree.Element(tag, attrib=attrib) +481 +482 with etree.htmlfile(self._file) as xf: +483 with xf.element("root"): +484 xf.write(elt) # 1 +485 +486 assert elt.text is None +487 xf.write(elt, method='xml') # 2 +488 +489 elt.text = "" +490 xf.write(elt, method='xml') # 3 +491 +492 with xf.element(tag, attrib=attrib, method='xml'): +493 pass # 4 +494 +495 xf.write(elt) # 5 +496 +497 with xf.method('xml'): +498 xf.write(elt) # 6 +499 +500 self.assertXml( +501 '<root>' +502 '<foo selected></foo>' # 1 +503 '<foo selected="bar"/>' # 2 +504 '<foo selected="bar"></foo>' # 3 +505 '<foo selected="bar"></foo>' # 4 +506 '<foo selected></foo>' # 5 +507 '<foo selected="bar"></foo>' # 6 +508 '</root>') +509 self._file = BytesIO() +
510 +
512 # The htmlfile already outputs in xml mode for .element calls. This +513 # test actually illustrates a bug +514 +515 with etree.htmlfile(self._file) as xf: +516 with xf.element("root"): +517 with xf.element('foo', attrib={'selected': 'bar'}): +518 pass +519 +520 self.assertXml( +521 '<root>' +522 # '<foo selected></foo>' # FIXME: this is the correct output +523 # in html mode +524 '<foo selected="bar"></foo>' +525 '</root>') +526 self._file = BytesIO() +
527 +
528 - def test_attribute_quoting(self): +
529 with etree.htmlfile(self._file) as xf: +530 with xf.element("tagname", attrib={"attr": '"misquoted"'}): +531 xf.write("foo") +532 +533 self.assertXml('<tagname attr="&quot;misquoted&quot;">foo</tagname>') +
534 +
536 with etree.htmlfile(self._file) as xf: +537 with xf.element("tagname", attrib={"attr": _str('"misquöted\\u3344\\U00013344"')}): +538 xf.write("foo") +539 +540 self.assertXml('<tagname attr="&quot;misqu&#xF6;ted&#x3344;&#x13344;&quot;">foo</tagname>') +
541 +
542 - def test_unescaped_script(self): +
543 with etree.htmlfile(self._file) as xf: +544 elt = etree.Element('script') +545 elt.text = "if (a < b);" +546 xf.write(elt) +547 self.assertXml('<script>if (a < b);</script>') +
548 +
550 with etree.htmlfile(self._file) as xf: +551 with xf.element('script'): +552 xf.write("if (a < b);") +553 +554 self.assertXml('<script>if (a < b);</script>') +
555 +
556 - def test_write_declaration(self): +
557 with etree.htmlfile(self._file) as xf: +558 try: +559 xf.write_declaration() +560 except etree.LxmlSyntaxError: +561 self.assertTrue(True) +562 else: +563 self.assertTrue(False) +564 xf.write(etree.Element('html')) +
565 +
567 with etree.htmlfile(self._file) as xf: +568 xf.write(etree.Element('{some_ns}some_tag')) +569 self.assertXml('<ns0:some_tag xmlns:ns0="some_ns"></ns0:some_tag>') +
570 +
572 with etree.htmlfile(self._file) as xf: +573 with xf.element("{some_ns}some_tag"): +574 pass +575 self.assertXml('<ns0:some_tag xmlns:ns0="some_ns"></ns0:some_tag>') +
576 +
577 +578 -class AsyncXmlFileTestCase(HelperTestCase): +
579 - def test_async_api(self): +
580 out = io.BytesIO() +581 xf = etree.xmlfile(out) +582 scm = xf.__enter__() +583 acm = xf.__aenter__() +584 list(acm.__await__()) # fake await to avoid destructor warning +585 +586 def api_of(obj): +587 return sorted(name for name in dir(scm) if not name.startswith('__')) +
588 +589 a_api = api_of(acm) +590 +591 self.assertEqual(api_of(scm), api_of(acm)) +592 self.assertTrue('write' in a_api) +593 self.assertTrue('element' in a_api) +594 self.assertTrue('method' in a_api) +595 self.assertTrue(len(a_api) > 5) +
596 +
597 - def _run_async(self, coro): +
598 while True: +599 try: +600 coro.send(None) +601 except StopIteration as ex: +602 return ex.value +
603 +604 @skipIf(sys.version_info < (3, 5), "requires support for async-def (Py3.5+)") +
605 - def test_async(self): +
606 code = textwrap.dedent("""\ +607 async def test_async_xmlfile(close=True, buffered=True): +608 class Writer(object): +609 def __init__(self): +610 self._data = [] +611 self._all_data = None +612 self._calls = 0 +613 +614 async def write(self, data): +615 self._calls += 1 +616 self._data.append(data) +617 +618 async def close(self): +619 assert self._all_data is None +620 assert self._data is not None +621 self._all_data = b''.join(self._data) +622 self._data = None # make writing fail afterwards +623 +624 async def generate(out, close=True, buffered=True): +625 async with etree.xmlfile(out, close=close, buffered=buffered) as xf: +626 async with xf.element('root'): +627 await xf.write('root-text') +628 async with xf.method('html'): +629 await xf.write(etree.Element('img', src='http://huhu.org/')) +630 await xf.flush() +631 for i in range(3): +632 async with xf.element('el'): +633 await xf.write('text-%d' % i) +634 +635 out = Writer() +636 await generate(out, close=close, buffered=buffered) +637 if not close: +638 await out.close() +639 assert out._data is None, out._data +640 return out._all_data, out._calls +641 """) +642 lns = {} +643 exec(code, globals(), lns) +644 test_async_xmlfile = lns['test_async_xmlfile'] +645 +646 expected = ( +647 b'<root>root-text<img src="http://huhu.org/">' +648 b'<el>text-0</el><el>text-1</el><el>text-2</el></root>' +649 ) +650 +651 data, calls = self._run_async(test_async_xmlfile(close=True)) +652 self.assertEqual(expected, data) +653 self.assertEqual(2, calls) # only flush() and close() +654 +655 data, calls = self._run_async(test_async_xmlfile(close=False)) +656 self.assertEqual(expected, data) +657 self.assertEqual(2, calls) # only flush() and close() +658 +659 data, unbuffered_calls = self._run_async(test_async_xmlfile(buffered=False)) +660 self.assertEqual(expected, data) +661 self.assertTrue(unbuffered_calls > calls, unbuffered_calls) +
662 +
663 +664 -def test_suite(): +
665 suite = unittest.TestSuite() +666 suite.addTests([ +667 unittest.makeSuite(BytesIOXmlFileTestCase), +668 unittest.makeSuite(TempXmlFileTestCase), +669 unittest.makeSuite(TempPathXmlFileTestCase), +670 unittest.makeSuite(SimpleFileLikeXmlFileTestCase), +671 unittest.makeSuite(HtmlFileTestCase), +672 unittest.makeSuite(AsyncXmlFileTestCase), +673 ]) +674 return suite +
675 +676 +677 if __name__ == '__main__': +678 print('to test use test.py %s' % __file__) +679 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html new file mode 100644 index 00000000..27ae5580 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html @@ -0,0 +1,438 @@ + + + + + lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class AsyncXmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class AsyncXmlFileTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               AsyncXmlFileTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_async_api(self) + source code + +
+ +
+   + + + + + + +
_run_async(self, + coro) + source code + +
+ +
+   + + + + + + +
test_async(*args, + **kwargs) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

test_async(*args, + **kwargs) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @skipIf(sys.version_info <(3, 5), "requires support for async-def (Py3.5+)")
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html new file mode 100644 index 00000000..47d33a5a --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html @@ -0,0 +1,460 @@ + + + + + lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class BytesIOXmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class BytesIOXmlFileTestCase

source code

+
+               object --+            
+                        |            
+   unittest.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+             _XmlFileTestCaseBase --+
+                                    |
+                                   BytesIOXmlFileTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
test_filelike_close(self) + source code + +
+ +
+

Inherited from _XmlFileTestCaseBase: + assertXml, + tearDown, + test_anonymous_namespace, + test_attribute, + test_attribute_extra, + test_attribute_extra_duplicate, + test_buffering, + test_closing_out_of_order_in_error_case, + test_comment, + test_default_namespace, + test_element, + test_element_nested, + test_element_nested_with_text, + test_element_write_empty, + test_element_write_text, + test_encoding, + test_escaping, + test_failure_preceding_text, + test_failure_trailing_Element, + test_failure_trailing_text, + test_flush, + test_generator_close_continues_closing, + test_namespace_nested_anonymous, + test_namespace_nested_nsmap, + test_namespace_nsmap, + test_nested_default_namespace, + test_nested_default_namespace_and_other, + test_non_io_exception_continues_closing, + test_pi, + test_write_Element, + test_write_Element_repeatedly +

+

Inherited from _XmlFileTestCaseBase (private): + _parse_file, + _read_file +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from _XmlFileTestCaseBase (private): + _file +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html new file mode 100644 index 00000000..128660f7 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html @@ -0,0 +1,620 @@ + + + + + lxml.tests.test_incremental_xmlfile.HtmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class HtmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlFileTestCase

source code

+
+               object --+            
+                        |            
+   unittest.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+             _XmlFileTestCaseBase --+
+                                    |
+                                   HtmlFileTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
test_void_elements(self) + source code + +
+ +
+   + + + + + + +
test_method_context_manager_misuse(self) + source code + +
+ +
+   + + + + + + +
test_xml_mode_write_inside_html(self) + source code + +
+ +
+   + + + + + + +
test_xml_mode_element_inside_html(self) + source code + +
+ +
+   + + + + + + +
test_attribute_quoting(self) + source code + +
+ +
+   + + + + + + +
test_attribute_quoting_unicode(self) + source code + +
+ +
+   + + + + + + +
test_unescaped_script(self) + source code + +
+ +
+   + + + + + + +
test_unescaped_script_incremental(self) + source code + +
+ +
+   + + + + + + +
test_write_declaration(self) + source code + +
+ +
+   + + + + + + +
test_write_namespaced_element(self) + source code + +
+ +
+   + + + + + + +
test_open_namespaced_element(self) + source code + +
+ +
+

Inherited from _XmlFileTestCaseBase: + assertXml, + tearDown, + test_anonymous_namespace, + test_attribute, + test_attribute_extra, + test_attribute_extra_duplicate, + test_buffering, + test_closing_out_of_order_in_error_case, + test_comment, + test_default_namespace, + test_element, + test_element_nested, + test_element_nested_with_text, + test_element_write_empty, + test_element_write_text, + test_encoding, + test_escaping, + test_failure_preceding_text, + test_failure_trailing_Element, + test_failure_trailing_text, + test_flush, + test_generator_close_continues_closing, + test_namespace_nested_anonymous, + test_namespace_nested_nsmap, + test_namespace_nsmap, + test_nested_default_namespace, + test_nested_default_namespace_and_other, + test_non_io_exception_continues_closing, + test_pi, + test_write_Element, + test_write_Element_repeatedly +

+

Inherited from _XmlFileTestCaseBase (private): + _parse_file, + _read_file +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from _XmlFileTestCaseBase (private): + _file +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html new file mode 100644 index 00000000..a3970183 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html @@ -0,0 +1,571 @@ + + + + + lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class SimpleFileLikeXmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SimpleFileLikeXmlFileTestCase

source code

+
+               object --+            
+                        |            
+   unittest.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+             _XmlFileTestCaseBase --+
+                                    |
+                                   SimpleFileLikeXmlFileTestCase
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + SimpleFileLike +
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
_read_file(self) + source code + +
+ +
+   + + + + + + +
_parse_file(self) + source code + +
+ +
+   + + + + + + +
test_filelike_not_closing(self) + source code + +
+ +
+   + + + + + + +
test_filelike_close(self) + source code + +
+ +
+   + + + + + + +
test_write_fails(self) + source code + +
+ +
+

Inherited from _XmlFileTestCaseBase: + assertXml, + tearDown, + test_anonymous_namespace, + test_attribute, + test_attribute_extra, + test_attribute_extra_duplicate, + test_buffering, + test_closing_out_of_order_in_error_case, + test_comment, + test_default_namespace, + test_element, + test_element_nested, + test_element_nested_with_text, + test_element_write_empty, + test_element_write_text, + test_encoding, + test_escaping, + test_failure_preceding_text, + test_failure_trailing_Element, + test_failure_trailing_text, + test_flush, + test_generator_close_continues_closing, + test_namespace_nested_anonymous, + test_namespace_nested_nsmap, + test_namespace_nsmap, + test_nested_default_namespace, + test_nested_default_namespace_and_other, + test_non_io_exception_continues_closing, + test_pi, + test_write_Element, + test_write_Element_repeatedly +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from _XmlFileTestCaseBase (private): + _file +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

_read_file(self) +

+
source code  +
+ + +
+
Overrides: + _XmlFileTestCaseBase._read_file +
+
+
+
+ +
+ +
+ + +
+

_parse_file(self) +

+
source code  +
+ + +
+
Overrides: + _XmlFileTestCaseBase._parse_file +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html new file mode 100644 index 00000000..097d0462 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html @@ -0,0 +1,264 @@ + + + + + lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class SimpleFileLikeXmlFileTestCase :: + Class SimpleFileLike + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SimpleFileLike

source code

+
+object --+
+         |
+        SimpleFileLikeXmlFileTestCase.SimpleFileLike
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + target)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
close(self) + source code + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + target) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html new file mode 100644 index 00000000..9429daa6 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html @@ -0,0 +1,641 @@ + + + + + lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class TempPathXmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TempPathXmlFileTestCase

source code

+
+               object --+            
+                        |            
+   unittest.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+             _XmlFileTestCaseBase --+
+                                    |
+                                   TempPathXmlFileTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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 + +
+ +
+   + + + + + + +
_read_file(self) + source code + +
+ +
+   + + + + + + +
_parse_file(self) + source code + +
+ +
+   + + + + + + +
test_buffering(*args, + **kwargs) + source code + +
+ +
+   + + + + + + +
test_flush(*args, + **kwargs) + source code + +
+ +
+

Inherited from _XmlFileTestCaseBase: + assertXml, + test_anonymous_namespace, + test_attribute, + test_attribute_extra, + test_attribute_extra_duplicate, + test_closing_out_of_order_in_error_case, + test_comment, + test_default_namespace, + test_element, + test_element_nested, + test_element_nested_with_text, + test_element_write_empty, + test_element_write_text, + test_encoding, + test_escaping, + test_failure_preceding_text, + test_failure_trailing_Element, + test_failure_trailing_text, + test_generator_close_continues_closing, + test_namespace_nested_anonymous, + test_namespace_nested_nsmap, + test_namespace_nsmap, + test_nested_default_namespace, + test_nested_default_namespace_and_other, + test_non_io_exception_continues_closing, + test_pi, + test_write_Element, + test_write_Element_repeatedly +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from _XmlFileTestCaseBase (private): + _file +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.case.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

_read_file(self) +

+
source code  +
+ + +
+
Overrides: + _XmlFileTestCaseBase._read_file +
+
+
+
+ +
+ +
+ + +
+

_parse_file(self) +

+
source code  +
+ + +
+
Overrides: + _XmlFileTestCaseBase._parse_file +
+
+
+
+ +
+ +
+ + +
+

test_buffering(*args, + **kwargs) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @skipIf(True, "temp file behaviour is too platform specific here")
  • +
+
Overrides: + _XmlFileTestCaseBase.test_buffering +
+
+
+
+ +
+ +
+ + +
+

test_flush(*args, + **kwargs) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @skipIf(True, "temp file behaviour is too platform specific here")
  • +
+
Overrides: + _XmlFileTestCaseBase.test_flush +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html new file mode 100644 index 00000000..8ddb8b96 --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html @@ -0,0 +1,444 @@ + + + + + lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class TempXmlFileTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TempXmlFileTestCase

source code

+
+               object --+            
+                        |            
+   unittest.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+             _XmlFileTestCaseBase --+
+                                    |
+                                   TempXmlFileTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+

Inherited from _XmlFileTestCaseBase: + assertXml, + tearDown, + test_anonymous_namespace, + test_attribute, + test_attribute_extra, + test_attribute_extra_duplicate, + test_buffering, + test_closing_out_of_order_in_error_case, + test_comment, + test_default_namespace, + test_element, + test_element_nested, + test_element_nested_with_text, + test_element_write_empty, + test_element_write_text, + test_encoding, + test_escaping, + test_failure_preceding_text, + test_failure_trailing_Element, + test_failure_trailing_text, + test_flush, + test_generator_close_continues_closing, + test_namespace_nested_anonymous, + test_namespace_nested_nsmap, + test_namespace_nsmap, + test_nested_default_namespace, + test_nested_default_namespace_and_other, + test_non_io_exception_continues_closing, + test_pi, + test_write_Element, + test_write_Element_repeatedly +

+

Inherited from _XmlFileTestCaseBase (private): + _parse_file, + _read_file +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from _XmlFileTestCaseBase (private): + _file +

+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html b/doc/html/api/lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html new file mode 100644 index 00000000..2636671e --- /dev/null +++ b/doc/html/api/lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html @@ -0,0 +1,931 @@ + + + + + lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_incremental_xmlfile :: + Class _XmlFileTestCaseBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XmlFileTestCaseBase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               _XmlFileTestCaseBase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_element(self) + source code + +
+ +
+   + + + + + + +
test_element_write_text(self) + source code + +
+ +
+   + + + + + + +
test_element_write_empty(self) + source code + +
+ +
+   + + + + + + +
test_element_nested(self) + source code + +
+ +
+   + + + + + + +
test_element_nested_with_text(self) + source code + +
+ +
+   + + + + + + +
test_write_Element(self) + source code + +
+ +
+   + + + + + + +
test_write_Element_repeatedly(self) + source code + +
+ +
+   + + + + + + +
test_namespace_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_namespace_nested_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_anonymous_namespace(self) + source code + +
+ +
+   + + + + + + +
test_namespace_nested_anonymous(self) + source code + +
+ +
+   + + + + + + +
test_default_namespace(self) + source code + +
+ +
+   + + + + + + +
test_nested_default_namespace(self) + source code + +
+ +
+   + + + + + + +
test_nested_default_namespace_and_other(self) + source code + +
+ +
+   + + + + + + +
test_pi(self) + source code + +
+ +
+   + + + + + + +
test_comment(self) + source code + +
+ +
+   + + + + + + +
test_attribute(self) + source code + +
+ +
+   + + + + + + +
test_attribute_extra(self) + source code + +
+ +
+   + + + + + + +
test_attribute_extra_duplicate(self) + source code + +
+ +
+   + + + + + + +
test_escaping(self) + source code + +
+ +
+   + + + + + + +
test_encoding(self) + source code + +
+ +
+   + + + + + + +
test_buffering(self) + source code + +
+ +
+   + + + + + + +
test_flush(self) + source code + +
+ +
+   + + + + + + +
test_non_io_exception_continues_closing(self) + source code + +
+ +
+   + + + + + + +
test_generator_close_continues_closing(self) + source code + +
+ +
+   + + + + + + +
test_failure_preceding_text(self) + source code + +
+ +
+   + + + + + + +
test_failure_trailing_text(self) + source code + +
+ +
+   + + + + + + +
test_failure_trailing_Element(self) + source code + +
+ +
+   + + + + + + +
test_closing_out_of_order_in_error_case(self) + source code + +
+ +
+   + + + + + + +
_read_file(self) + source code + +
+ +
+   + + + + + + +
_parse_file(self) + source code + +
+ +
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
assertXml(self, + expected, + encoding='utf8') + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _file = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..140862cb --- /dev/null +++ b/doc/html/api/lxml.tests.test_io-module.html @@ -0,0 +1,217 @@ + + + + + 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]
+
+   + + __package__ = '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 00000000..413b80f1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io-pysrc.html @@ -0,0 +1,1120 @@ + + + + + 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, gc, shutil 
+  9   
+ 10  from lxml.tests.common_imports import ( 
+ 11      etree, ElementTree, _str, _bytes, 
+ 12      SillyFileLike, LargeFileLike, HelperTestCase, 
+ 13      read_file, write_to_file, BytesIO, tmpfile 
+ 14  ) 
+ 15   
+ 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 with open(self.getTestFilePath('testdump.xml'), 'wb') as f: + 56 tree.write(f, encoding='UTF-8') + 57 with open(self.getTestFilePath('testdump.xml'), 'rb') as f: + 58 tree = ElementTree(file=f) + 59 with open(self.getTestFilePath('testdump2.xml'), 'wb') as f: + 60 tree.write(f, encoding='UTF-8') + 61 with open(self.getTestFilePath('testdump.xml'), 'rb') as f: + 62 data1 = f.read() + 63 with open(self.getTestFilePath('testdump2.xml'), 'rb') as f: + 64 data2 = f.read() + 65 self.assertEqual(data1, data2) +
66 +
67 - def test_tree_io_latin1(self): +
68 Element = self.etree.Element + 69 ElementTree = self.etree.ElementTree + 70 + 71 element = Element('top') + 72 element.text = _str("qwrtioüöäßá") + 73 tree = ElementTree(element) + 74 self.buildNodes(element, 10, 3) + 75 with open(self.getTestFilePath('testdump.xml'), 'wb') as f: + 76 tree.write(f, encoding='iso-8859-1') + 77 with open(self.getTestFilePath('testdump.xml'), 'rb') as f: + 78 tree = ElementTree(file=f) + 79 with open(self.getTestFilePath('testdump2.xml'), 'wb') as f: + 80 tree.write(f, encoding='iso-8859-1') + 81 with open(self.getTestFilePath('testdump.xml'), 'rb') as f: + 82 data1 = f.read() + 83 with open(self.getTestFilePath('testdump2.xml'), 'rb') as f: + 84 data2 = f.read() + 85 self.assertEqual(data1, data2) +
86 +
87 - def test_write_filename(self): +
88 # (c)ElementTree supports filename strings as write argument + 89 with tmpfile(prefix="p", suffix=".xml") as filename: + 90 self.tree.write(filename) + 91 self.assertEqual(read_file(filename, 'rb').replace(b'\n', b''), + 92 self.root_str) +
93 +
95 # '%20' is a URL escaped space character. + 96 before_test = os.listdir(tempfile.gettempdir()) + 97 + 98 def difference(filenames): + 99 return sorted( +100 fn for fn in set(filenames).difference(before_test) +101 if fn.startswith('lxmltmp-') +102 ) +
103 +104 with tmpfile(prefix="lxmltmp-p%20p", suffix=".xml") as filename: +105 try: +106 before_write = os.listdir(tempfile.gettempdir()) +107 self.tree.write(filename) +108 after_write = os.listdir(tempfile.gettempdir()) +109 self.assertEqual(read_file(filename, 'rb').replace(b'\n', b''), +110 self.root_str) +111 except (AssertionError, IOError, OSError): +112 print("Before write: %s, after write: %s" % ( +113 difference(before_write), difference(after_write)) +114 ) +115 raise +
116 +
118 # '+' is used as an escaped space character in URLs. +119 with tmpfile(prefix="p+", suffix=".xml") as filename: +120 self.tree.write(filename) +121 self.assertEqual(read_file(filename, 'rb').replace(b'\n', b''), +122 self.root_str) +
123 +
125 filename = os.path.join( +126 os.path.join('hopefullynonexistingpathname'), +127 'invalid_file.xml') +128 try: +129 self.tree.write(filename) +130 except IOError: +131 pass +132 else: +133 self.assertTrue( +134 False, "writing to an invalid file path should fail") +
135 +
137 # (c)ElementTree supports gzip instance as parse argument +138 with tmpfile(suffix=".xml.gz") as filename: +139 with gzip.open(filename, 'wb') as f: +140 f.write(self.root_str) +141 with gzip.open(filename, 'rb') as f_gz: +142 tree = self.etree.parse(f_gz) +143 self.assertEqual(self.etree.tostring(tree.getroot()), self.root_str) +
144 +
145 - def test_class_parse_filename(self): +
146 # (c)ElementTree class ElementTree has a 'parse' method that returns +147 # the root of the tree +148 +149 # parse from filename +150 with tmpfile(suffix=".xml") as filename: +151 write_to_file(filename, self.root_str, 'wb') +152 tree = self.etree.ElementTree() +153 root = tree.parse(filename) +154 self.assertEqual(self.etree.tostring(root), self.root_str) +
155 +
157 with tmpfile(suffix=".xml") as filename: +158 write_to_file(filename, self.root_str, 'wb') +159 tree = self.etree.ElementTree() +160 root = tree.parse(filename) +161 # and now do it again; previous content should still be there +162 root2 = tree.parse(filename) +163 self.assertEqual('a', root.tag) +164 self.assertEqual('a', root2.tag) +165 # now remove all references to root2, and parse again +166 del root2 +167 root3 = tree.parse(filename) +168 self.assertEqual('a', root.tag) +169 self.assertEqual('a', root3.tag) +
170 # root2's memory should've been freed here +171 # XXX how to check? +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 handle, filename = tempfile.mkstemp(suffix=".xml") +179 try: +180 os.write(handle, self.root_str) +181 with open(filename, 'rb') as f: +182 tree = self.etree.ElementTree() +183 root = tree.parse(f) +184 self.assertEqual(self.etree.tostring(root), self.root_str) +185 finally: +186 os.close(handle) +187 os.remove(filename) +
188 +
190 # (c)ElementTree class ElementTree has a 'parse' method that returns +191 # the root of the tree +192 +193 # parse from unamed file object +194 f = SillyFileLike() +195 root = self.etree.ElementTree().parse(f) +196 self.assertTrue(root.tag.endswith('foo')) +
197 +
199 # parse from unamed file object +200 f = LargeFileLike() +201 tree = self.etree.parse(f) +202 root = tree.getroot() +203 self.assertTrue(root.tag.endswith('root')) +
204 +
206 class LocalError(Exception): +207 pass +
208 class TestFile: +209 def read(*args): +210 raise LocalError +211 f = TestFile() +212 self.assertRaises(LocalError, self.etree.parse, f) +213 +
215 class LocalError(Exception): +216 pass +
217 class TestFile: +218 data = '<root>test</' +219 try: +220 next_char = iter(data).next +221 except AttributeError: +222 # Python 3 +223 next_char = iter(data).__next__ +224 counter = 0 +225 def read(self, amount=None): +226 if amount is None: +227 while True: +228 self.read(1) +229 else: +230 try: +231 self.counter += 1 +232 return _bytes(self.next_char()) +233 except StopIteration: +234 raise LocalError +235 f = TestFile() +236 self.assertRaises(LocalError, self.etree.parse, f) +237 self.assertEqual(f.counter, len(f.data)+1) +238 +
240 class TestFile: +241 def read(*args): +242 return 1 +
243 f = TestFile() +244 +245 try: +246 expect_exc = (TypeError, self.etree.ParseError) +247 except AttributeError: +248 expect_exc = TypeError +249 self.assertRaises(expect_exc, self.etree.parse, f) +250 +
251 - def test_etree_parse_io_error(self): +
252 # this is a directory name that contains characters beyond latin-1 +253 dirnameEN = _str('Directory') +254 dirnameRU = _str('Каталог') +255 filename = _str('nosuchfile.xml') +256 dn = tempfile.mkdtemp(prefix=dirnameEN) +257 try: +258 self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename)) +259 finally: +260 os.rmdir(dn) +261 dn = tempfile.mkdtemp(prefix=dirnameRU) +262 try: +263 self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename)) +264 finally: +265 os.rmdir(dn) +
266 +
267 - def test_parse_utf8_bom(self): +
268 utext = _str('Søk på nettet') +269 uxml = '<?xml version="1.0" encoding="UTF-8"?><p>%s</p>' % utext +270 bom = _bytes('\\xEF\\xBB\\xBF').decode( +271 "unicode_escape").encode("latin1") +272 self.assertEqual(3, len(bom)) +273 f = tempfile.NamedTemporaryFile(delete=False) +274 try: +275 try: +276 f.write(bom) +277 f.write(uxml.encode("utf-8")) +278 finally: +279 f.close() +280 tree = self.etree.parse(f.name) +281 finally: +282 os.unlink(f.name) +283 self.assertEqual(utext, tree.getroot().text) +
284 +
285 - def test_iterparse_utf8_bom(self): +
286 utext = _str('Søk på nettet') +287 uxml = '<?xml version="1.0" encoding="UTF-8"?><p>%s</p>' % utext +288 bom = _bytes('\\xEF\\xBB\\xBF').decode( +289 "unicode_escape").encode("latin1") +290 self.assertEqual(3, len(bom)) +291 f = tempfile.NamedTemporaryFile(delete=False) +292 try: +293 try: +294 f.write(bom) +295 f.write(uxml.encode("utf-8")) +296 finally: +297 f.close() +298 elements = [el for _, el in self.etree.iterparse(f.name)] +299 self.assertEqual(1, len(elements)) +300 root = elements[0] +301 finally: +302 os.unlink(f.name) +303 self.assertEqual(utext, root.text) +
304 +
305 - def test_iterparse_utf16_bom(self): +
306 utext = _str('Søk på nettet') +307 uxml = '<?xml version="1.0" encoding="UTF-16"?><p>%s</p>' % utext +308 boms = _bytes('\\xFE\\xFF \\xFF\\xFE').decode( +309 "unicode_escape").encode("latin1") +310 self.assertEqual(5, len(boms)) +311 xml = uxml.encode("utf-16") +312 self.assertTrue(xml[:2] in boms, repr(xml[:2])) +313 +314 f = tempfile.NamedTemporaryFile(delete=False) +315 try: +316 try: +317 f.write(xml) +318 finally: +319 f.close() +320 elements = [el for _, el in self.etree.iterparse(f.name)] +321 self.assertEqual(1, len(elements)) +322 root = elements[0] +323 finally: +324 os.unlink(f.name) +325 self.assertEqual(utext, root.text) +
326 +327 +
328 -class ETreeIOTestCase(_IOTestCaseBase): +
329 etree = etree +330 +
331 - def test_write_compressed_text(self): +
332 Element = self.etree.Element +333 SubElement = self.etree.SubElement +334 ElementTree = self.etree.ElementTree +335 text = _str("qwrtioüöä") +336 +337 root = Element('root') +338 root.text = text +339 child = SubElement(root, 'sub') +340 child.text = 'TEXT' +341 child.tail = 'TAIL' +342 SubElement(root, 'sub').text = text +343 +344 tree = ElementTree(root) +345 out = BytesIO() +346 tree.write(out, method='text', encoding='utf8', compression=9) +347 out.seek(0) +348 +349 f = gzip.GzipFile(fileobj=out) +350 try: +351 result = f.read().decode('utf8') +352 finally: +353 f.close() +354 self.assertEqual(text+'TEXTTAIL'+text, result) +
355 +356 +357 if ElementTree: +
358 - class ElementTreeIOTestCase(_IOTestCaseBase): +
360 +361 +
362 -def test_suite(): +
363 suite = unittest.TestSuite() +364 suite.addTests([unittest.makeSuite(ETreeIOTestCase)]) +365 if ElementTree: +366 suite.addTests([unittest.makeSuite(ElementTreeIOTestCase)]) +367 return suite +
368 +369 +370 if __name__ == '__main__': +371 print('to test use test.py %s' % __file__) +372 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f4bf01d5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io.ETreeIOTestCase-class.html @@ -0,0 +1,428 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                  _IOTestCaseBase --+
+                                    |
+                                   ETreeIOTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_write_compressed_text(self) + source code + +
+ +
+

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_etree_parse_io_error, + test_iterparse_utf16_bom, + test_iterparse_utf8_bom, + 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_parse_utf8_bom, + test_tree_io, + test_tree_io_latin1, + test_write_filename, + test_write_filename_special_percent, + test_write_filename_special_plus, + test_write_invalid_filename +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..98ac9021 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io.ElementTreeIOTestCase-class.html @@ -0,0 +1,412 @@ + + + + + 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.case.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                  _IOTestCaseBase --+
+                                    |
+                                   ElementTreeIOTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_etree_parse_io_error, + test_iterparse_utf16_bom, + test_iterparse_utf8_bom, + 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_parse_utf8_bom, + test_tree_io, + test_tree_io_latin1, + test_write_filename, + test_write_filename_special_percent, + test_write_filename_special_plus, + test_write_invalid_filename +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ hash(x) +
+
+
+
Value:
+
xml.etree.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 00000000..24c5c821 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io._IOTestCaseBase-class.html @@ -0,0 +1,797 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               _IOTestCaseBase
+
+ +
Known Subclasses:
+
+ +
+ +
+(c)ElementTree compatibility for IO functions/methods + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_filename_special_percent(self) + source code + +
+ +
+   + + + + + + +
test_write_filename_special_plus(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 + +
+ +
+   + + + + + + +
test_etree_parse_io_error(self) + source code + +
+ +
+   + + + + + + +
test_parse_utf8_bom(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_utf8_bom(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_utf16_bom(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None
+ hash(x) +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

setUp(self) +

+
source code  +
+ + Setting up a minimal tree +
+
Overrides: + unittest.case.TestCase.setUp +
+
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.case.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_isoschematron-module.html b/doc/html/api/lxml.tests.test_isoschematron-module.html new file mode 100644 index 00000000..97c627b8 --- /dev/null +++ b/doc/html/api/lxml.tests.test_isoschematron-module.html @@ -0,0 +1,246 @@ + + + + + lxml.tests.test_isoschematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_isoschematron + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_isoschematron

source code

+Test cases related to ISO-Schematron parsing and validation + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeISOSchematronTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_isoschematron-pysrc.html b/doc/html/api/lxml.tests.test_isoschematron-pysrc.html new file mode 100644 index 00000000..ae8796d4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_isoschematron-pysrc.html @@ -0,0 +1,1712 @@ + + + + + lxml.tests.test_isoschematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_isoschematron + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_isoschematron

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to ISO-Schematron parsing and validation 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8  from lxml import isoschematron 
+  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 doctest, make_doctest 
+ 16   
+ 17   
+
18 -class ETreeISOSchematronTestCase(HelperTestCase): +
19 - def test_schematron(self): +
20 tree_valid = self.parse('<AAA><BBB/><CCC/></AAA>') + 21 tree_invalid = self.parse('<AAA><BBB/><CCC/><DDD/></AAA>') + 22 schema = self.parse('''\ + 23 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > + 24 <pattern id="OpenModel"> + 25 <title>Open Model</title> + 26 <rule context="AAA"> + 27 <assert test="BBB"> BBB element is not present</assert> + 28 <assert test="CCC"> CCC element is not present</assert> + 29 </rule> + 30 </pattern> + 31 <pattern id="ClosedModel"> + 32 <title>Closed model"</title> + 33 <rule context="AAA"> + 34 <assert test="BBB"> BBB element is not present</assert> + 35 <assert test="CCC"> CCC element is not present</assert> + 36 <assert test="count(BBB|CCC) = count (*)">There is an extra element</assert> + 37 </rule> + 38 </pattern> + 39 </schema> + 40 ''') + 41 + 42 schema = isoschematron.Schematron(schema) + 43 self.assertTrue(schema.validate(tree_valid)) + 44 self.assertTrue(not schema.validate(tree_invalid)) +
45 +
47 self.assertRaises(ValueError, isoschematron.Schematron, etree.ElementTree()) +
48 + 49 # an empty pattern is valid in iso schematron +
51 schema = self.parse('''\ + 52 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > + 53 <pattern id="OpenModel"> + 54 <title>Open model</title> + 55 </pattern> + 56 </schema> + 57 ''') + 58 schema = isoschematron.Schematron(schema) + 59 self.assertTrue(schema) +
60 +
62 schema = self.parse('''\ + 63 <schema xmlns="http://purl.oclc.org/dsdl/schematron" /> + 64 ''') + 65 self.assertRaises(etree.SchematronParseError, + 66 isoschematron.Schematron, schema) +
67 +
69 schema = self.parse('''\ + 70 <schema xmlns="mynamespace" /> + 71 ''') + 72 self.assertRaises(etree.SchematronParseError, + 73 isoschematron.Schematron, schema) +
74 +
75 - def test_schematron_from_tree(self): +
76 schema = self.parse('''\ + 77 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> + 78 <sch:pattern id="number_of_entries"> + 79 <sch:title>mandatory number_of_entries tests</sch:title> + 80 <sch:rule context="number_of_entries"> + 81 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> + 82 </sch:rule> + 83 </sch:pattern> + 84 </sch:schema> + 85 ''') + 86 schematron = isoschematron.Schematron(schema) + 87 self.assertTrue(isinstance(schematron, isoschematron.Schematron)) +
88 +
90 schema = self.parse('''\ + 91 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> + 92 <sch:pattern id="number_of_entries"> + 93 <sch:title>mandatory number_of_entries tests</sch:title> + 94 <sch:rule context="number_of_entries"> + 95 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> + 96 </sch:rule> + 97 </sch:pattern> + 98 </sch:schema> + 99 ''') +100 schematron = isoschematron.Schematron(schema.getroot()) +101 self.assertTrue(isinstance(schematron, isoschematron.Schematron)) +
102 +
103 - def test_schematron_from_file(self): +
104 schematron = isoschematron.Schematron(file=fileInTestDir('test.sch')) +105 self.assertTrue(isinstance(schematron, isoschematron.Schematron)) +
106 +
107 - def test_schematron_call(self): +
108 schema = self.parse('''\ +109 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +110 <sch:pattern id="number_of_entries"> +111 <sch:title>mandatory number_of_entries tests</sch:title> +112 <sch:rule context="number_of_entries"> +113 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +114 </sch:rule> +115 </sch:pattern> +116 </sch:schema> +117 ''') +118 tree_valid = self.parse('''\ +119 <message> +120 <number_of_entries>0</number_of_entries> +121 <entries> +122 </entries> +123 </message> +124 ''') +125 tree_invalid = self.parse('''\ +126 <message> +127 <number_of_entries>3</number_of_entries> +128 <entries> +129 <entry>Entry 1</entry> +130 <entry>Entry 2</entry> +131 </entries> +132 </message> +133 ''') +134 schematron = isoschematron.Schematron(schema) +135 self.assertTrue(schematron(tree_valid), schematron.error_log) +136 valid = schematron(tree_invalid) +137 self.assertTrue(not valid) +
138 +
139 - def test_schematron_validate(self): +
140 schema = self.parse('''\ +141 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +142 <sch:pattern id="number_of_entries"> +143 <sch:title>mandatory number_of_entries tests</sch:title> +144 <sch:rule context="number_of_entries"> +145 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +146 </sch:rule> +147 </sch:pattern> +148 </sch:schema> +149 ''') +150 tree_valid = self.parse('''\ +151 <message> +152 <number_of_entries>0</number_of_entries> +153 <entries> +154 </entries> +155 </message> +156 ''') +157 tree_invalid = self.parse('''\ +158 <message> +159 <number_of_entries>3</number_of_entries> +160 <entries> +161 <entry>Entry 1</entry> +162 <entry>Entry 2</entry> +163 </entries> +164 </message> +165 ''') +166 schematron = isoschematron.Schematron(schema) +167 self.assertTrue(schematron.validate(tree_valid), schematron.error_log) +168 valid = schematron.validate(tree_invalid) +169 self.assertTrue(not valid) +
170 +
172 schema = self.parse('''\ +173 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +174 <sch:pattern id="number_of_entries"> +175 <sch:title>mandatory number_of_entries tests</sch:title> +176 <sch:rule context="number_of_entries"> +177 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +178 </sch:rule> +179 </sch:pattern> +180 </sch:schema> +181 ''') +182 tree_valid = self.parse('''\ +183 <message> +184 <number_of_entries>0</number_of_entries> +185 <entries> +186 </entries> +187 </message> +188 ''') +189 tree_invalid = self.parse('''\ +190 <message> +191 <number_of_entries>3</number_of_entries> +192 <entries> +193 <entry>Entry 1</entry> +194 <entry>Entry 2</entry> +195 </entries> +196 </message> +197 ''') +198 schematron = isoschematron.Schematron(schema) +199 self.assertTrue(schematron(tree_valid), schematron.error_log) +200 self.assertRaises(etree.DocumentInvalid, schematron.assertValid, +201 tree_invalid) +
202 +
203 - def test_schematron_error_log(self): +
204 schema = self.parse('''\ +205 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +206 <sch:pattern id="number_of_entries"> +207 <sch:title>mandatory number_of_entries tests</sch:title> +208 <sch:rule context="number_of_entries"> +209 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +210 </sch:rule> +211 </sch:pattern> +212 </sch:schema> +213 ''') +214 tree_valid = self.parse('''\ +215 <message> +216 <number_of_entries>0</number_of_entries> +217 <entries> +218 </entries> +219 </message> +220 ''') +221 tree_invalid = self.parse('''\ +222 <message> +223 <number_of_entries>3</number_of_entries> +224 <entries> +225 <entry>Entry 1</entry> +226 <entry>Entry 2</entry> +227 </entries> +228 </message> +229 ''') +230 schematron = isoschematron.Schematron(schema) +231 self.assertTrue(schematron(tree_valid), schematron.error_log) +232 valid = schematron(tree_invalid) +233 self.assertTrue(not valid) +234 self.assertEqual(len(schematron.error_log), 1, +235 'expected single error: %s (%s errors)' % +236 (schematron.error_log, len(schematron.error_log))) +
237 +
239 schema = self.parse('''\ +240 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +241 <sch:pattern id="number_of_entries"> +242 <sch:title>mandatory number_of_entries tests</sch:title> +243 <sch:rule context="number_of_entries"> +244 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +245 </sch:rule> +246 </sch:pattern> +247 </sch:schema> +248 ''') +249 tree_valid = self.parse('''\ +250 <message> +251 <number_of_entries>0</number_of_entries> +252 <entries> +253 </entries> +254 </message> +255 ''') +256 tree_invalid = self.parse('''\ +257 <message> +258 <number_of_entries>3</number_of_entries> +259 <entries> +260 <entry>Entry 1</entry> +261 <entry>Entry 2</entry> +262 </entries> +263 </message> +264 ''') +265 schematron = isoschematron.Schematron(schema, store_report=True) +266 self.assertTrue(schematron(tree_valid), schematron.error_log) +267 valid = schematron(tree_invalid) +268 self.assertTrue(not valid) +269 self.assertTrue( +270 isinstance(schematron.validation_report, etree._ElementTree), +271 'expected a validation report result tree, got: %s' % schematron.validation_report) +272 +273 schematron = isoschematron.Schematron(schema, store_report=False) +274 self.assertTrue(schematron(tree_valid), schematron.error_log) +275 valid = schematron(tree_invalid) +276 self.assertTrue(not valid) +277 self.assertTrue(schematron.validation_report is None, +278 'validation reporting switched off, still: %s' % schematron.validation_report) +
279 +
281 schema = self.parse('''\ +282 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +283 <sch:pattern id="number_of_entries"> +284 <sch:title>mandatory number_of_entries tests</sch:title> +285 <sch:rule context="number_of_entries"> +286 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +287 </sch:rule> +288 </sch:pattern> +289 </sch:schema> +290 ''') +291 schematron = isoschematron.Schematron(schema) +292 self.assertTrue(schematron.validator_xslt is None) +293 +294 schematron = isoschematron.Schematron(schema, store_schematron=True) +295 self.assertTrue(isinstance(schematron.schematron, etree._ElementTree), +296 'expected schematron schema to be stored') +
297 +
298 - def test_schematron_store_xslt(self): +
299 schema = self.parse('''\ +300 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +301 <sch:pattern id="number_of_entries"> +302 <sch:title>mandatory number_of_entries tests</sch:title> +303 <sch:rule context="number_of_entries"> +304 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +305 </sch:rule> +306 </sch:pattern> +307 </sch:schema> +308 ''') +309 schematron = isoschematron.Schematron(schema) +310 self.assertTrue(schematron.validator_xslt is None) +311 +312 schematron = isoschematron.Schematron(schema, store_xslt=True) +313 self.assertTrue(isinstance(schematron.validator_xslt, etree._ElementTree), +314 'expected validator xslt to be stored') +
315 +
316 - def test_schematron_abstract(self): +
317 schema = self.parse('''\ +318 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +319 <sch:title>iso schematron validation</sch:title> +320 <sch:ns uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/> +321 <sch:ns uri="http://codespeak.net/lxml/objectify/pytype" prefix="py"/> +322 +323 <!-- of course, these only really make sense when combined with a schema that +324 ensures datatype xs:dateTime --> +325 +326 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc"> +327 <sch:rule context="$datetime"> +328 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +329 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +330 <sch:assert test="$lastchar='Z' or $tz='00:00'">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +331 </sch:rule> +332 </sch:pattern> +333 +334 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc_nillable"> +335 <sch:rule context="$datetime"> +336 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +337 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +338 <sch:assert test="@xsi:nil='true' or ($lastchar='Z' or $tz='00:00')">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +339 </sch:rule> +340 </sch:pattern> +341 +342 <sch:pattern is-a="abstract.dateTime.tz_utc" id="datetime" > +343 <sch:param name="datetime" value="datetime"/> +344 </sch:pattern> +345 +346 <sch:pattern is-a="abstract.dateTime.tz_utc_nillable" id="nillableDatetime"> +347 <sch:param name="datetime" value="nillableDatetime"/> +348 </sch:pattern> +349 +350 </sch:schema> +351 ''') +352 valid_trees = [ +353 self.parse('''\ +354 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +355 <datetime>2009-12-10T15:21:00Z</datetime> +356 <nillableDatetime xsi:nil="true"/> +357 </root> +358 '''), +359 self.parse('''\ +360 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +361 <datetime>2009-12-10T15:21:00Z</datetime> +362 <nillableDatetime>2009-12-10T15:21:00Z</nillableDatetime> +363 </root> +364 '''), +365 self.parse('''\ +366 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +367 <datetime>2009-12-10T15:21:00+00:00</datetime> +368 <nillableDatetime>2009-12-10T15:21:00-00:00</nillableDatetime> +369 </root> +370 '''), +371 ] +372 +373 schematron = isoschematron.Schematron(schema) +374 for tree_valid in valid_trees: +375 self.assertTrue(schematron(tree_valid), schematron.error_log) +376 +377 tree_invalid = self.parse('''\ +378 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +379 <datetime>2009-12-10T16:21:00+01:00</datetime> +380 <nillableDatetime>2009-12-10T16:21:00+01:00</nillableDatetime> +381 </root> +382 ''') +383 expected = 2 +384 valid = schematron(tree_invalid) +385 self.assertTrue(not valid) +386 self.assertEqual( +387 len(schematron.error_log), expected, +388 'expected %s errors: %s (%s errors)' % +389 (expected, schematron.error_log, len(schematron.error_log))) +390 +391 tree_invalid = self.parse('''\ +392 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +393 <datetime xsi:nil="true"/> +394 <nillableDatetime>2009-12-10T16:21:00Z</nillableDatetime> +395 </root> +396 ''') +397 expected = 1 +398 valid = schematron(tree_invalid) +399 self.assertTrue(not valid) +400 self.assertEqual( +401 len(schematron.error_log), expected, +402 'expected %s errors: %s (%s errors)' % +403 (expected, schematron.error_log, len(schematron.error_log))) +
404 +
405 - def test_schematron_phases(self): +
406 schema = self.parse('''\ +407 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +408 <sch:title>iso schematron validation</sch:title> +409 <sch:ns uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/> +410 <sch:ns uri="http://codespeak.net/lxml/objectify/pytype" prefix="py"/> +411 +412 <sch:phase id="mandatory"> +413 <sch:active pattern="number_of_entries"/> +414 </sch:phase> +415 +416 <sch:phase id="datetime_checks"> +417 <sch:active pattern="datetime"/> +418 <sch:active pattern="nillableDatetime"/> +419 </sch:phase> +420 +421 <sch:phase id="full"> +422 <sch:active pattern="number_of_entries"/> +423 <sch:active pattern="datetime"/> +424 <sch:active pattern="nillableDatetime"/> +425 </sch:phase> +426 +427 <!-- of course, these only really make sense when combined with a schema that +428 ensures datatype xs:dateTime --> +429 +430 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc"> +431 <sch:rule context="$datetime"> +432 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +433 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +434 <sch:assert test="$lastchar='Z' or $tz='00:00'">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +435 </sch:rule> +436 </sch:pattern> +437 +438 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc_nillable"> +439 <sch:rule context="$datetime"> +440 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +441 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +442 <sch:assert test="@xsi:nil='true' or ($lastchar='Z' or $tz='00:00')">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +443 </sch:rule> +444 </sch:pattern> +445 +446 <sch:pattern id="number_of_entries"> +447 <sch:title>mandatory number_of_entries test</sch:title> +448 <sch:rule context="number_of_entries"> +449 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +450 </sch:rule> +451 </sch:pattern> +452 +453 <sch:pattern id="datetime" is-a="abstract.dateTime.tz_utc"> +454 <sch:param name="datetime" value="datetime"/> +455 </sch:pattern> +456 +457 <sch:pattern id="nillableDatetime" is-a="abstract.dateTime.tz_utc_nillable"> +458 <sch:param name="datetime" value="nillableDatetime"/> +459 </sch:pattern> +460 +461 </sch:schema> +462 ''') +463 tree_valid = self.parse('''\ +464 <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +465 <datetime>2009-12-10T15:21:00Z</datetime> +466 <nillableDatetime xsi:nil="true"/> +467 <number_of_entries>0</number_of_entries> +468 <entries> +469 </entries> +470 </message> +471 ''') +472 tree_invalid = self.parse('''\ +473 <message> +474 <datetime>2009-12-10T16:21:00+01:00</datetime> +475 <nillableDatetime>2009-12-10T16:21:00+01:00</nillableDatetime> +476 <number_of_entries>3</number_of_entries> +477 <entries> +478 <entry>Entry 1</entry> +479 <entry>Entry 2</entry> +480 </entries> +481 </message> +482 ''') +483 # check everything (default phase #ALL) +484 schematron = isoschematron.Schematron(schema) +485 self.assertTrue(schematron(tree_valid), schematron.error_log) +486 expected = 3 +487 valid = schematron(tree_invalid) +488 self.assertTrue(not valid) +489 self.assertEqual( +490 len(schematron.error_log), expected, +491 'expected %s errors: %s (%s errors)' % +492 (expected, schematron.error_log, len(schematron.error_log))) +493 +494 # check phase mandatory +495 schematron = isoschematron.Schematron( +496 schema, compile_params={'phase': 'mandatory'}) +497 self.assertTrue(schematron(tree_valid), schematron.error_log) +498 expected = 1 +499 valid = schematron(tree_invalid) +500 self.assertTrue(not valid) +501 self.assertEqual( +502 len(schematron.error_log), expected, +503 'expected %s errors: %s (%s errors)' % +504 (expected, schematron.error_log, len(schematron.error_log))) +505 +506 # check phase datetime_checks +507 schematron = isoschematron.Schematron( +508 schema, compile_params={'phase': 'datetime_checks'}) +509 self.assertTrue(schematron(tree_valid), schematron.error_log) +510 expected = 2 +511 valid = schematron(tree_invalid) +512 self.assertTrue(not valid) +513 self.assertEqual( +514 len(schematron.error_log), expected, +515 'expected %s errors: %s (%s errors)' % +516 (expected, schematron.error_log, len(schematron.error_log))) +517 +518 # check phase full +519 schematron = isoschematron.Schematron( +520 schema, compile_params={'phase': 'full'}) +521 self.assertTrue(schematron(tree_valid), schematron.error_log) +522 expected = 3 +523 valid = schematron(tree_invalid) +524 self.assertTrue(not valid) +525 self.assertEqual( +526 len(schematron.error_log), expected, +527 'expected %s errors: %s (%s errors)' % +528 (expected, schematron.error_log, len(schematron.error_log))) +
529 +
531 schema = self.parse('''\ +532 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +533 <sch:title>iso schematron validation</sch:title> +534 <sch:ns uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/> +535 <sch:ns uri="http://codespeak.net/lxml/objectify/pytype" prefix="py"/> +536 +537 <sch:phase id="mandatory"> +538 <sch:active pattern="number_of_entries"/> +539 </sch:phase> +540 +541 <sch:phase id="datetime_checks"> +542 <sch:active pattern="datetime"/> +543 <sch:active pattern="nillableDatetime"/> +544 </sch:phase> +545 +546 <sch:phase id="full"> +547 <sch:active pattern="number_of_entries"/> +548 <sch:active pattern="datetime"/> +549 <sch:active pattern="nillableDatetime"/> +550 </sch:phase> +551 +552 <!-- of course, these only really make sense when combined with a schema that +553 ensures datatype xs:dateTime --> +554 +555 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc"> +556 <sch:rule context="$datetime"> +557 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +558 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +559 <sch:assert test="$lastchar='Z' or $tz='00:00'">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +560 </sch:rule> +561 </sch:pattern> +562 +563 <sch:pattern abstract="true" id="abstract.dateTime.tz_utc_nillable"> +564 <sch:rule context="$datetime"> +565 <sch:let name="tz" value="concat(substring-after(substring-after(./text(), 'T'), '+'), substring-after(substring-after(./text(), 'T'), '-'))"/> +566 <sch:let name="lastchar" value="substring(./text(), string-length(./text()))"/> +567 <sch:assert test="@xsi:nil='true' or ($lastchar='Z' or $tz='00:00')">[ERROR] element (<sch:value-of select="name(.)"/>) dateTime value (<sch:value-of select="."/>) is not qualified as UTC (tz: <sch:value-of select="$tz"/>)</sch:assert> +568 </sch:rule> +569 </sch:pattern> +570 +571 <sch:pattern id="number_of_entries"> +572 <sch:title>mandatory number_of_entries test</sch:title> +573 <sch:rule context="number_of_entries"> +574 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +575 </sch:rule> +576 </sch:pattern> +577 +578 <sch:pattern id="datetime" is-a="abstract.dateTime.tz_utc"> +579 <sch:param name="datetime" value="datetime"/> +580 </sch:pattern> +581 +582 <sch:pattern id="nillableDatetime" is-a="abstract.dateTime.tz_utc_nillable"> +583 <sch:param name="datetime" value="nillableDatetime"/> +584 </sch:pattern> +585 +586 </sch:schema> +587 ''') +588 tree_valid = self.parse('''\ +589 <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +590 <datetime>2009-12-10T15:21:00Z</datetime> +591 <nillableDatetime xsi:nil="true"/> +592 <number_of_entries>0</number_of_entries> +593 <entries> +594 </entries> +595 </message> +596 ''') +597 tree_invalid = self.parse('''\ +598 <message> +599 <datetime>2009-12-10T16:21:00+01:00</datetime> +600 <nillableDatetime>2009-12-10T16:21:00+01:00</nillableDatetime> +601 <number_of_entries>3</number_of_entries> +602 <entries> +603 <entry>Entry 1</entry> +604 <entry>Entry 2</entry> +605 </entries> +606 </message> +607 ''') +608 # check everything (default phase #ALL) +609 schematron = isoschematron.Schematron(schema) +610 self.assertTrue(schematron(tree_valid), schematron.error_log) +611 expected = 3 +612 valid = schematron(tree_invalid) +613 self.assertTrue(not valid) +614 self.assertEqual( +615 len(schematron.error_log), expected, +616 'expected %s errors: %s (%s errors)' % +617 (expected, schematron.error_log, len(schematron.error_log))) +618 +619 # check phase mandatory +620 schematron = isoschematron.Schematron(schema, phase='mandatory') +621 self.assertTrue(schematron(tree_valid), schematron.error_log) +622 expected = 1 +623 valid = schematron(tree_invalid) +624 self.assertTrue(not valid) +625 self.assertEqual( +626 len(schematron.error_log), expected, +627 'expected %s errors: %s (%s errors)' % +628 (expected, schematron.error_log, len(schematron.error_log))) +629 +630 # check phase datetime_checks +631 schematron = isoschematron.Schematron(schema, phase='datetime_checks') +632 self.assertTrue(schematron(tree_valid), schematron.error_log) +633 expected = 2 +634 valid = schematron(tree_invalid) +635 self.assertTrue(not valid) +636 self.assertEqual( +637 len(schematron.error_log), expected, +638 'expected %s errors: %s (%s errors)' % +639 (expected, schematron.error_log, len(schematron.error_log))) +640 +641 # check phase full +642 schematron = isoschematron.Schematron(schema, phase='full') +643 self.assertTrue(schematron(tree_valid), schematron.error_log) +644 expected = 3 +645 valid = schematron(tree_invalid) +646 self.assertTrue(not valid) +647 self.assertEqual( +648 len(schematron.error_log), expected, 'expected %s errors: %s (%s errors)' % +649 (expected, schematron.error_log, len(schematron.error_log))) +
650 +
652 schema = self.parse('''\ +653 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" +654 xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +655 <xs:element name="message"> +656 <xs:complexType> +657 <xs:sequence> +658 <xs:element name="number_of_entries" type="xs:positiveInteger"> +659 <xs:annotation> +660 <xs:appinfo> +661 <sch:pattern id="number_of_entries"> +662 <sch:title>mandatory number_of_entries tests</sch:title> +663 <sch:rule context="number_of_entries"> +664 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +665 </sch:rule> +666 </sch:pattern> +667 </xs:appinfo> +668 </xs:annotation> +669 </xs:element> +670 <xs:element name="entries"> +671 <xs:complexType> +672 <xs:sequence> +673 <xs:element name="entry" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> +674 </xs:sequence> +675 </xs:complexType> +676 </xs:element> +677 </xs:sequence> +678 </xs:complexType> +679 </xs:element> +680 </xs:schema> +681 ''') +682 tree_valid = self.parse('''\ +683 <message> +684 <number_of_entries>2</number_of_entries> +685 <entries> +686 <entry>Entry 1</entry> +687 <entry>Entry 2</entry> +688 </entries> +689 </message> +690 ''') +691 tree_invalid = self.parse('''\ +692 <message> +693 <number_of_entries>1</number_of_entries> +694 <entries> +695 <entry>Entry 1</entry> +696 <entry>Entry 2</entry> +697 </entries> +698 </message> +699 ''') +700 xmlschema = etree.XMLSchema(schema) +701 schematron = isoschematron.Schematron(schema) +702 # fwiw, this must also be XMLSchema-valid +703 self.assertTrue(xmlschema(tree_valid), xmlschema.error_log) +704 self.assertTrue(schematron(tree_valid)) +705 # still schema-valid +706 self.assertTrue(xmlschema(tree_invalid), xmlschema.error_log) +707 self.assertTrue(not schematron(tree_invalid)) +
708 +
710 schema = self.parse('''\ +711 <grammar xmlns="http://relaxng.org/ns/structure/1.0" +712 xmlns:sch="http://purl.oclc.org/dsdl/schematron" +713 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> +714 <start> +715 <ref name="message"/> +716 </start> +717 <define name="message"> +718 <element name="message"> +719 <element name="number_of_entries"> +720 <!-- RelaxNG can be mixed freely with stuff from other namespaces --> +721 <sch:pattern id="number_of_entries"> +722 <sch:title>mandatory number_of_entries tests</sch:title> +723 <sch:rule context="number_of_entries"> +724 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +725 </sch:rule> +726 </sch:pattern> +727 <data type="positiveInteger"/> +728 </element> +729 <element name="entries"> +730 <zeroOrMore> +731 <element name="entry"><data type="string"/></element> +732 </zeroOrMore> +733 </element> +734 </element> +735 </define> +736 </grammar> +737 ''') +738 tree_valid = self.parse('''\ +739 <message> +740 <number_of_entries>2</number_of_entries> +741 <entries> +742 <entry>Entry 1</entry> +743 <entry>Entry 2</entry> +744 </entries> +745 </message> +746 ''') +747 tree_invalid = self.parse('''\ +748 <message> +749 <number_of_entries>1</number_of_entries> +750 <entries> +751 <entry>Entry 1</entry> +752 <entry>Entry 2</entry> +753 </entries> +754 </message> +755 ''') +756 relaxng = etree.RelaxNG(schema) +757 schematron = isoschematron.Schematron(schema) +758 # fwiw, this must also be RelaxNG-valid +759 self.assertTrue(relaxng(tree_valid), relaxng.error_log) +760 self.assertTrue(schematron(tree_valid)) +761 # still schema-valid +762 self.assertTrue(relaxng(tree_invalid), relaxng.error_log) +763 self.assertTrue(not schematron(tree_invalid)) +
764 +
766 schema = self.parse('''\ +767 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> +768 <sch:pattern id="number_of_entries"> +769 <sch:title>mandatory number_of_entries tests</sch:title> +770 <sch:rule context="number_of_entries"> +771 <sch:assert test="text()=count(../entries/entry)">[ERROR] number_of_entries (<sch:value-of select="."/>) must equal the number of entries/entry elements (<sch:value-of select="count(../entries/entry)"/>)</sch:assert> +772 </sch:rule> +773 </sch:pattern> +774 </sch:schema> +775 ''') +776 # handing phase as keyword arg will *not* raise the type error +777 self.assertRaises(TypeError, isoschematron.Schematron, schema, +778 compile_params={'phase': None}) +
779 +
781 class MySchematron(isoschematron.Schematron): +782 def _extract(self, root): +783 schematron = (root.xpath( +784 '//sch:schema', +785 namespaces={'sch': "http://purl.oclc.org/dsdl/schematron"}) +786 or [None])[0] +787 return schematron +
788 +789 def _include(self, schematron, **kwargs): +790 raise RuntimeError('inclusion unsupported') +
791 +792 def _expand(self, schematron, **kwargs): +793 raise RuntimeError('expansion unsupported') +794 +795 def _validation_errors(self, validationReport): +796 valid = etree.XPath( +797 'count(//svrl:successful-report[@flag="critical"])=1', +798 namespaces={'svrl': isoschematron.SVRL_NS})( +799 validationReport) +800 if valid: +801 return [] +802 error = etree.Element('Error') +803 error.text = 'missing critical condition report' +804 return [error] +805 +806 tree_valid = self.parse('<AAA><BBB/><CCC/></AAA>') +807 tree_invalid = self.parse('<AAA><BBB/><CCC/><DDD/></AAA>') +808 schema = self.parse('''\ +809 <schema xmlns="http://www.example.org/yet/another/schema/dialect"> +810 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +811 <pattern id="OpenModel"> +812 <title>Open Model</title> +813 <rule context="AAA"> +814 <report test="BBB" flag="info">BBB element must be present</report> +815 <report test="CCC" flag="info">CCC element must be present</report> +816 </rule> +817 </pattern> +818 <pattern id="ClosedModel"> +819 <title>Closed model"</title> +820 <rule context="AAA"> +821 <report test="BBB" flag="info">BBB element must be present</report> +822 <report test="CCC" flag="info">CCC element must be present</report> +823 <report test="count(BBB|CCC) = count(*)" flag="critical">Only BBB and CCC children must be present</report> +824 </rule> +825 </pattern> +826 </schema> +827 </schema> +828 ''') +829 # check if overridden _include is run +830 self.assertRaises(RuntimeError, MySchematron, schema, store_report=True) +831 # check if overridden _expand is run +832 self.assertRaises(RuntimeError, MySchematron, schema, store_report=True, +833 include=False) +834 +835 schema = MySchematron(schema, store_report=True, include=False, +836 expand=False) +837 self.assertTrue(schema.validate(tree_valid)) +838 self.assertTrue(not schema.validate(tree_invalid)) +839 +840 #TODO: test xslt parameters for inclusion, expand & compile steps (?) +841 +
843 tree_valid = self.parse('<AAA><BBB/><CCC/></AAA>') +844 tree_invalid = self.parse('<AAA><BBB/><CCC/><DDD/></AAA>') +845 schema = self.parse('''\ +846 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +847 <pattern id="OpenModel"> +848 <title>Simple Report</title> +849 <rule context="AAA"> +850 <report test="DDD"> DDD element must not be present</report> +851 </rule> +852 </pattern> +853 </schema> +854 ''') +855 schema_report = isoschematron.Schematron( +856 schema, error_finder=isoschematron.Schematron.ASSERTS_AND_REPORTS) +857 schema_no_report = isoschematron.Schematron(schema) +858 self.assertTrue(schema_report.validate(tree_valid)) +859 self.assertTrue(not schema_report.validate(tree_invalid)) +860 self.assertTrue(schema_no_report.validate(tree_valid)) +861 self.assertTrue(schema_no_report.validate(tree_invalid)) +
862 +863 +
864 -def test_suite(): +
865 suite = unittest.TestSuite() +866 suite.addTests([unittest.makeSuite(ETreeISOSchematronTestCase)]) +867 suite.addTests(doctest.DocTestSuite(isoschematron)) +868 suite.addTests( +869 [make_doctest('../../../doc/validation.txt')]) +870 return suite +
871 +872 if __name__ == '__main__': +873 print('to test use test.py %s' % __file__) +874 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html b/doc/html/api/lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html new file mode 100644 index 00000000..4d88dfc5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html @@ -0,0 +1,713 @@ + + + + + lxml.tests.test_isoschematron.ETreeISOSchematronTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_isoschematron :: + Class ETreeISOSchematronTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeISOSchematronTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeISOSchematronTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_schematron(self) + source code + +
+ +
+   + + + + + + +
test_schematron_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_schematron_empty_pattern(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_schema_empty(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_schema_namespace(self) + source code + +
+ +
+   + + + + + + +
test_schematron_from_tree(self) + source code + +
+ +
+   + + + + + + +
test_schematron_from_element(self) + source code + +
+ +
+   + + + + + + +
test_schematron_from_file(self) + source code + +
+ +
+   + + + + + + +
test_schematron_call(self) + source code + +
+ +
+   + + + + + + +
test_schematron_validate(self) + source code + +
+ +
+   + + + + + + +
test_schematron_assertValid(self) + source code + +
+ +
+   + + + + + + +
test_schematron_error_log(self) + source code + +
+ +
+   + + + + + + +
test_schematron_result_report(self) + source code + +
+ +
+   + + + + + + +
test_schematron_store_schematron(self) + source code + +
+ +
+   + + + + + + +
test_schematron_store_xslt(self) + source code + +
+ +
+   + + + + + + +
test_schematron_abstract(self) + source code + +
+ +
+   + + + + + + +
test_schematron_phases(self) + source code + +
+ +
+   + + + + + + +
test_schematron_phases_kwarg(self) + source code + +
+ +
+   + + + + + + +
test_schematron_xmlschema_embedded(self) + source code + +
+ +
+   + + + + + + +
test_schematron_relaxng_embedded(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_args(self) + source code + +
+ +
+   + + + + + + +
test_schematron_customization(self) + source code + +
+ +
+   + + + + + + +
test_schematron_fail_on_report(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..de4b07ee --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses-module.html @@ -0,0 +1,247 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..0bac1384 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses-pysrc.html @@ -0,0 +1,678 @@ + + + + + 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.assertTrue(isinstance(el, etree.ElementBase)) + 62 self.assertTrue(hasattr(el, 'bluff')) + 63 self.assertFalse(hasattr(el[0], 'maeh')) + 64 self.assertFalse(hasattr(el[0], 'bluff')) + 65 self.assertEqual(el.bluff(), 'bluff') + 66 del el + 67 + 68 self.Namespace('ns11').update(maeh_dict) + 69 el = tree.getroot() + 70 self.assertTrue(hasattr(el, 'bluff')) + 71 self.assertTrue(hasattr(el[0], 'maeh')) + 72 self.assertEqual(el.bluff(), 'bluff') + 73 self.assertEqual(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.assertTrue(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.assertTrue(isinstance(child, etree.ElementBase), child.tag) +106 self.assertFalse(isinstance(el[-1], etree.ElementBase)) +107 +108 self.assertTrue(hasattr(el[0], 'bluff')) +109 self.assertTrue(hasattr(el[1], 'bluff')) +110 self.assertTrue(hasattr(el[2], 'maeh')) +111 self.assertTrue(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.assertTrue(hasattr(el, 'bluff')) +126 +127 child = etree.SubElement(el, "{ns21}maeh") +128 self.assertTrue(hasattr(child, 'maeh')) +129 child = etree.SubElement(el, "{ns20}bluff") +130 self.assertTrue(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.assertTrue(hasattr(el[0], 'maeh')) +136 self.assertTrue(hasattr(el[1], 'bluff')) +137 self.assertFalse(hasattr(el[2], 'bluff')) +138 self.assertFalse(hasattr(el[2], 'maeh')) +139 +140 self.assertEqual(el.bluff(), 'bluff') +141 self.assertEqual(el[0].maeh(), 'maeh') +142 self.assertEqual(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.assertTrue(hasattr(el, 'bluff')) +157 self.assertTrue(hasattr(el[0], 'maeh')) +158 self.assertEqual(el.bluff(), 'bluff') +159 self.assertEqual(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.assertEqual('default_class', el.tag) +180 self.assertEqual('testtext', el.text) +181 self.assertEqual(None, el.tail) +182 self.assertEqual(2, len(el)) +183 self.assertEqual(7, len(list(el.iter()))) +184 +185 self.assertEqual('bluff_class', el[0].tag) +186 self.assertEqual('TaIL', el[0][0].tail) +187 self.assertEqual('TaIL', ''.join(el[0].itertext())) +188 self.assertEqual('{http://a.b/c}HONK', +189 el[0][0].tag) +190 self.assertEqual('maeh_class', +191 el[0][1].tag) +192 +193 self.assertEqual('maeh_class', el[1].tag) +194 self.assertEqual('TeXT', el[1].text) +195 self.assertEqual('bluff_class', el[1][0].tag) +196 self.assertEqual('{http://a.b/c}HONK', el[1][1].tag) +197 self.assertEqual('TAiL', el[1][1].tail) +198 +199 self.assertEqual('TeXTTAiL', +200 ''.join(el[1].itertext())) +201 self.assertEqual('Tail', el[1].tail) +202 self.assertEqual('TAiL', el[1][1].tail) +203 self.assertEqual('bluff_class', el[1][0].tag) +204 self.assertEqual('{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 00000000..62382dff --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html @@ -0,0 +1,559 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeNamespaceClassesTestCase
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + default_class +
+   + + maeh_class +
+   + + bluff_class +
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.case.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 00000000..47e9dff6 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html @@ -0,0 +1,267 @@ + + + + + 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, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..0b04f9be --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html @@ -0,0 +1,251 @@ + + + + + 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, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..6c745cef --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html @@ -0,0 +1,267 @@ + + + + + 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, + cssselect, + 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__, + __format__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..d89fb9eb --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify-module.html @@ -0,0 +1,564 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + 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... +
+   + + __package__ = 'lxml.tests' +
+   + + v = 'NMTOKEN' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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>4</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 00000000..6fcdd633 --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify-pysrc.html @@ -0,0 +1,6187 @@ + + + + + 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>4</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.assertEqual(elt.nsmap, DEFAULT_NSMAP) +
110 +
111 - def test_element_nsmap_empty(self): +
112 nsmap = {} + 113 elt = objectify.Element("test", nsmap=nsmap) + 114 self.assertEqual(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.assertEqual(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.assertTrue(PYTYPE_NAMESPACE in elt.nsmap.values()) + 129 for prefix, ns in nsmap.items(): + 130 self.assertTrue(prefix in elt.nsmap) + 131 self.assertEqual(nsmap[prefix], elt.nsmap[prefix]) +
132 +
134 root = objectify.Element("root") + 135 root.sub = objectify.Element("test") + 136 self.assertEqual(root.sub.nsmap, DEFAULT_NSMAP) +
137 +
139 root = objectify.Element("root") + 140 nsmap = {} + 141 root.sub = objectify.Element("test", nsmap=nsmap) + 142 self.assertEqual(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.assertEqual(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.assertEqual(root.sub.nsmap, expected) +
162 +
164 value = objectify.DataElement("test this") + 165 self.assertEqual(value.nsmap, DEFAULT_NSMAP) +
166 +
168 nsmap = {} + 169 value = objectify.DataElement("test this", nsmap=nsmap) + 170 self.assertEqual(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.assertEqual(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.assertTrue(PYTYPE_NAMESPACE in value.nsmap.values()) + 185 for prefix, ns in nsmap.items(): + 186 self.assertTrue(prefix in value.nsmap) + 187 self.assertEqual(nsmap[prefix], value.nsmap[prefix]) +
188 +
190 root = objectify.Element("root") + 191 root.value = objectify.DataElement("test this") + 192 self.assertEqual(root.value.nsmap, DEFAULT_NSMAP) +
193 +
195 root = objectify.Element("root") + 196 nsmap = {} + 197 root.value = objectify.DataElement("test this", nsmap=nsmap) + 198 self.assertEqual(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.assertEqual(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.assertEqual(root.value.nsmap, expected) +
218 +
220 # ObjectifiedDataElement can also be used as E-Factory + 221 value = objectify.ObjectifiedDataElement('test', 'toast') + 222 self.assertEqual(value.text, 'testtoast') +
223 +
225 # ObjectifiedDataElement can also be used as E-Factory + 226 value = objectify.ObjectifiedElement(objectify.ObjectifiedDataElement(), 'test', 'toast') + 227 self.assertEqual(value.ObjectifiedDataElement.tail, 'testtoast') +
228 +
230 # keyword arguments override attrib entries + 231 value = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 232 attrib={"gnu": "muh", "cat": "meeow", + 233 "dog": "wuff"}, + 234 bird="tchilp", dog="grrr") + 235 self.assertEqual(value.get("gnu"), "muh") + 236 self.assertEqual(value.get("cat"), "meeow") + 237 self.assertEqual(value.get("dog"), "grrr") + 238 self.assertEqual(value.get("bird"), "tchilp") +
239 +
241 # Check that DataElement preserves all attributes ObjectifiedDataElement + 242 # arguments + 243 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 244 attrib={"gnu": "muh", "cat": "meeow", + 245 "dog": "wuff"}, + 246 bird="tchilp", dog="grrr") + 247 value = objectify.DataElement(arg) + 248 self.assertTrue(isinstance(value, objectify.StringElement)) + 249 for attr in arg.attrib: + 250 self.assertEqual(value.get(attr), arg.get(attr)) +
251 +
253 # Check that _pytype arg overrides original py:pytype of + 254 # ObjectifiedDataElement + 255 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 256 attrib={"gnu": "muh", "cat": "meeow", + 257 "dog": "wuff"}, + 258 bird="tchilp", dog="grrr") + 259 value = objectify.DataElement(arg, _pytype="NoneType") + 260 self.assertTrue(isinstance(value, objectify.NoneElement)) + 261 self.assertEqual(value.get(XML_SCHEMA_NIL_ATTR), "true") + 262 self.assertEqual(value.text, None) + 263 self.assertEqual(value.pyval, None) + 264 for attr in arg.attrib: + 265 #if not attr == objectify.PYTYPE_ATTRIBUTE: + 266 self.assertEqual(value.get(attr), arg.get(attr)) +
267 +
269 # Check that _pytype arg overrides original py:pytype of + 270 # ObjectifiedDataElement + 271 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 272 attrib={"gnu": "muh", "cat": "meeow", + 273 "dog": "wuff"}, + 274 bird="tchilp", dog="grrr") + 275 value = objectify.DataElement(arg, _pytype="int") + 276 self.assertTrue(isinstance(value, objectify.IntElement)) + 277 self.assertEqual(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 278 for attr in arg.attrib: + 279 if not attr == objectify.PYTYPE_ATTRIBUTE: + 280 self.assertEqual(value.get(attr), arg.get(attr)) +
281 +
283 # Check that _xsi arg overrides original xsi:type of given + 284 # ObjectifiedDataElement + 285 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 286 attrib={"gnu": "muh", "cat": "meeow", + 287 "dog": "wuff"}, + 288 bird="tchilp", dog="grrr") + 289 value = objectify.DataElement(arg, _xsi="xsd:int") + 290 self.assertTrue(isinstance(value, objectify.IntElement)) + 291 self.assertEqual(value.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), "xsd:int") + 292 self.assertEqual(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 293 for attr in arg.attrib: + 294 if not attr in [objectify.PYTYPE_ATTRIBUTE, + 295 XML_SCHEMA_INSTANCE_TYPE_ATTR]: + 296 self.assertEqual(value.get(attr), arg.get(attr)) +
297 +
299 # Check that _pytype and _xsi args override original py:pytype and + 300 # xsi:type attributes of given ObjectifiedDataElement + 301 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 302 attrib={"gnu": "muh", "cat": "meeow", + 303 "dog": "wuff"}, + 304 bird="tchilp", dog="grrr") + 305 value = objectify.DataElement(arg, _pytype="int", _xsi="xsd:int") + 306 self.assertTrue(isinstance(value, objectify.IntElement)) + 307 self.assertEqual(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 308 self.assertEqual(value.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), "xsd:int") + 309 for attr in arg.attrib: + 310 if not attr in [objectify.PYTYPE_ATTRIBUTE, + 311 XML_SCHEMA_INSTANCE_TYPE_ATTR]: + 312 self.assertEqual(value.get(attr), arg.get(attr)) +
313 +
315 self.assertRaises(ValueError, objectify.DataElement, 3.1415, + 316 _pytype="int") +
317 +
319 self.assertRaises(ValueError, objectify.DataElement, 3.1415, + 320 _xsi="xsd:int") +
321 +
323 arg = objectify.DataElement(3.1415) + 324 self.assertRaises(ValueError, objectify.DataElement, arg, + 325 _pytype="int") +
326 +
328 arg = objectify.DataElement(3.1415) + 329 self.assertRaises(ValueError, objectify.DataElement, arg, + 330 _xsi="xsd:int") +
331 +
333 arg = objectify.Element('arg') + 334 value = objectify.DataElement(arg) + 335 self.assertTrue(isinstance(value, objectify.ObjectifiedElement)) + 336 for attr in arg.attrib: + 337 self.assertEqual(value.get(attr), arg.get(attr)) +
338 +
339 - def test_root(self): +
340 root = self.Element("test") + 341 self.assertTrue(isinstance(root, objectify.ObjectifiedElement)) +
342 +
343 - def test_str(self): +
344 root = self.Element("test") + 345 self.assertEqual('', str(root)) +
346 +
347 - def test_child(self): +
348 root = self.XML(xml_str) + 349 self.assertEqual("0", root.c1.c2.text) +
350 +
351 - def test_child_ns_nons(self): +
352 root = self.XML(""" + 353 <root> + 354 <foo:x xmlns:foo="/foo/bar">1</foo:x> + 355 <x>2</x> + 356 </root> + 357 """) + 358 self.assertEqual(2, root.x) +
359 +
360 - def test_countchildren(self): +
361 root = self.XML(xml_str) + 362 self.assertEqual(1, root.countchildren()) + 363 self.assertEqual(5, root.c1.countchildren()) +
364 +
365 - def test_child_getattr(self): +
366 root = self.XML(xml_str) + 367 self.assertEqual("0", getattr(root.c1, "{objectified}c2").text) + 368 self.assertEqual("3", getattr(root.c1, "{otherNS}c2").text) +
369 +
370 - def test_child_nonexistant(self): +
371 root = self.XML(xml_str) + 372 self.assertRaises(AttributeError, getattr, root.c1, "NOT_THERE") + 373 self.assertRaises(AttributeError, getattr, root.c1, "{unknownNS}c2") +
374 +
375 - def test_child_getattr_empty_ns(self): +
376 root = self.XML(xml_str) + 377 self.assertEqual("4", getattr(root.c1, "{}c2").text) + 378 self.assertEqual("0", getattr(root.c1, "c2").text) +
379 +
380 - def test_setattr(self): +
381 for val in [ + 382 2, 2**32, 1.2, "Won't get fooled again", + 383 _str("W\xf6n't get f\xf6\xf6led \xe4g\xe4in", 'ISO-8859-1'), True, + 384 False, None]: + 385 root = self.Element('root') + 386 attrname = 'val' + 387 setattr(root, attrname, val) + 388 result = getattr(root, attrname) + 389 self.assertEqual(val, result) + 390 self.assertEqual(type(val), type(result.pyval)) +
391 +
392 - def test_setattr_nonunicode(self): +
393 root = self.Element('root') + 394 attrname = 'val' + 395 val = _bytes("W\xf6n't get f\xf6\xf6led \xe4g\xe4in", 'ISO-8859-1') + 396 self.assertRaises(ValueError, setattr, root, attrname, val) + 397 self.assertRaises(AttributeError, getattr, root, attrname) +
398 +
399 - def test_addattr(self): +
400 root = self.XML(xml_str) + 401 self.assertEqual(1, len(root.c1)) + 402 root.addattr("c1", "test") + 403 self.assertEqual(2, len(root.c1)) + 404 self.assertEqual("test", root.c1[1].text) +
405 +
406 - def test_addattr_element(self): +
407 root = self.XML(xml_str) + 408 self.assertEqual(1, len(root.c1)) + 409 + 410 new_el = self.Element("test", myattr="5") + 411 root.addattr("c1", new_el) + 412 self.assertEqual(2, len(root.c1)) + 413 self.assertEqual(None, root.c1[0].get("myattr")) + 414 self.assertEqual("5", root.c1[1].get("myattr")) +
415 +
416 - def test_addattr_list(self): +
417 root = self.XML(xml_str) + 418 self.assertEqual(1, len(root.c1)) + 419 + 420 new_el = self.Element("test") + 421 self.etree.SubElement(new_el, "a", myattr="A") + 422 self.etree.SubElement(new_el, "a", myattr="B") + 423 + 424 root.addattr("c1", list(new_el.a)) + 425 self.assertEqual(3, len(root.c1)) + 426 self.assertEqual(None, root.c1[0].get("myattr")) + 427 self.assertEqual("A", root.c1[1].get("myattr")) + 428 self.assertEqual("B", root.c1[2].get("myattr")) +
429 +
430 - def test_child_addattr(self): +
431 root = self.XML(xml_str) + 432 self.assertEqual(3, len(root.c1.c2)) + 433 root.c1.addattr("c2", 3) + 434 self.assertEqual(4, len(root.c1.c2)) + 435 self.assertEqual("3", root.c1.c2[3].text) +
436 +
437 - def test_child_index(self): +
438 root = self.XML(xml_str) + 439 self.assertEqual("0", root.c1.c2[0].text) + 440 self.assertEqual("1", root.c1.c2[1].text) + 441 self.assertEqual("2", root.c1.c2[2].text) + 442 self.assertRaises(IndexError, operator.getitem, root.c1.c2, 3) + 443 self.assertEqual(root, root[0]) + 444 self.assertRaises(IndexError, operator.getitem, root, 1) + 445 + 446 c1 = root.c1 + 447 del root.c1 # unlink from parent + 448 self.assertEqual(c1, c1[0]) + 449 self.assertRaises(IndexError, operator.getitem, c1, 1) +
450 +
451 - def test_child_index_neg(self): +
452 root = self.XML(xml_str) + 453 self.assertEqual("0", root.c1.c2[0].text) + 454 self.assertEqual("0", root.c1.c2[-3].text) + 455 self.assertEqual("1", root.c1.c2[-2].text) + 456 self.assertEqual("2", root.c1.c2[-1].text) + 457 self.assertRaises(IndexError, operator.getitem, root.c1.c2, -4) + 458 self.assertEqual(root, root[-1]) + 459 self.assertRaises(IndexError, operator.getitem, root, -2) + 460 + 461 c1 = root.c1 + 462 del root.c1 # unlink from parent + 463 self.assertEqual(c1, c1[-1]) + 464 self.assertRaises(IndexError, operator.getitem, c1, -2) +
465 +
466 - def test_child_len(self): +
467 root = self.XML(xml_str) + 468 self.assertEqual(1, len(root)) + 469 self.assertEqual(1, len(root.c1)) + 470 self.assertEqual(3, len(root.c1.c2)) +
471 +
472 - def test_child_iter(self): +
473 root = self.XML(xml_str) + 474 self.assertEqual([root], + 475 list(iter(root))) + 476 self.assertEqual([root.c1], + 477 list(iter(root.c1))) + 478 self.assertEqual([root.c1.c2[0], root.c1.c2[1], root.c1.c2[2]], + 479 list(iter(root.c1.c2))) +
480 +
481 - def test_class_lookup(self): +
482 root = self.XML(xml_str) + 483 self.assertTrue(isinstance(root.c1.c2, objectify.ObjectifiedElement)) + 484 self.assertFalse(isinstance(getattr(root.c1, "{otherNS}c2"), + 485 objectify.ObjectifiedElement)) +
486 +
487 - def test_dir(self): +
488 root = self.XML(xml_str) + 489 dir_c1 = dir(objectify.ObjectifiedElement) + ['c1'] + 490 dir_c1.sort() + 491 dir_c2 = dir(objectify.ObjectifiedElement) + ['c2'] + 492 dir_c2.sort() + 493 + 494 self.assertEqual(dir_c1, dir(root)) + 495 self.assertEqual(dir_c2, dir(root.c1)) +
496 +
497 - def test_vars(self): +
498 root = self.XML(xml_str) + 499 self.assertEqual({'c1' : root.c1}, vars(root)) + 500 self.assertEqual({'c2' : root.c1.c2}, vars(root.c1)) +
501 +
502 - def test_child_set_ro(self): +
503 root = self.XML(xml_str) + 504 self.assertRaises(TypeError, setattr, root.c1.c2, 'text', "test") + 505 self.assertRaises(TypeError, setattr, root.c1.c2, 'pyval', "test") +
506 + 507 # slicing + 508 +
509 - def test_getslice_complete(self): +
510 root = self.XML("<root><c>c1</c><c>c2</c></root>") + 511 self.assertEqual(["c1", "c2"], + 512 [ c.text for c in root.c[:] ]) +
513 +
514 - def test_getslice_partial(self): +
515 root = self.XML("<root><c>c1</c><c>c2</c><c>c3</c><c>c4</c></root>") + 516 test_list = ["c1", "c2", "c3", "c4"] + 517 + 518 self.assertEqual(test_list, + 519 [ c.text for c in root.c[:] ]) + 520 self.assertEqual(test_list[1:2], + 521 [ c.text for c in root.c[1:2] ]) + 522 self.assertEqual(test_list[-3:-1], + 523 [ c.text for c in root.c[-3:-1] ]) + 524 self.assertEqual(test_list[-3:3], + 525 [ c.text for c in root.c[-3:3] ]) + 526 self.assertEqual(test_list[-3000:3], + 527 [ c.text for c in root.c[-3000:3] ]) + 528 self.assertEqual(test_list[-3:3000], + 529 [ c.text for c in root.c[-3:3000] ]) +
530 +
531 - def test_getslice_partial_neg(self): +
532 root = self.XML("<root><c>c1</c><c>c2</c><c>c3</c><c>c4</c></root>") + 533 test_list = ["c1", "c2", "c3", "c4"] + 534 + 535 self.assertEqual(test_list, + 536 [ c.text for c in root.c[:] ]) + 537 self.assertEqual(test_list[2:1:-1], + 538 [ c.text for c in root.c[2:1:-1] ]) + 539 self.assertEqual(test_list[-1:-3:-1], + 540 [ c.text for c in root.c[-1:-3:-1] ]) + 541 self.assertEqual(test_list[2:-3:-1], + 542 [ c.text for c in root.c[2:-3:-1] ]) + 543 self.assertEqual(test_list[2:-3000:-1], + 544 [ c.text for c in root.c[2:-3000:-1] ]) +
545 + 546 # slice assignment + 547 +
548 - def test_setslice_complete(self): +
549 Element = self.Element + 550 root = Element("root") + 551 root.c = ["c1", "c2"] + 552 + 553 c1 = root.c[0] + 554 c2 = root.c[1] + 555 + 556 self.assertEqual([c1,c2], list(root.c)) + 557 self.assertEqual(["c1", "c2"], + 558 [ c.text for c in root.c ]) +
559 +
560 - def test_setslice_elements(self): +
561 Element = self.Element + 562 root = Element("root") + 563 root.c = ["c1", "c2"] + 564 + 565 c1 = root.c[0] + 566 c2 = root.c[1] + 567 + 568 self.assertEqual([c1,c2], list(root.c)) + 569 self.assertEqual(["c1", "c2"], + 570 [ c.text for c in root.c ]) + 571 + 572 root2 = Element("root2") + 573 root2.el = [ "test", "test" ] + 574 self.assertEqual(["test", "test"], + 575 [ el.text for el in root2.el ]) + 576 + 577 root.c = [ root2.el, root2.el ] + 578 self.assertEqual(["test", "test"], + 579 [ c.text for c in root.c ]) + 580 self.assertEqual(["test", "test"], + 581 [ el.text for el in root2.el ]) + 582 + 583 root.c[:] = [ c1, c2, c2, c1 ] + 584 self.assertEqual(["c1", "c2", "c2", "c1"], + 585 [ c.text for c in root.c ]) +
586 +
587 - def test_setslice_partial(self): +
588 Element = self.Element + 589 root = Element("root") + 590 l = ["c1", "c2", "c3", "c4"] + 591 root.c = l + 592 + 593 self.assertEqual(["c1", "c2", "c3", "c4"], + 594 [ c.text for c in root.c ]) + 595 self.assertEqual(l, + 596 [ c.text for c in root.c ]) + 597 + 598 new_slice = ["cA", "cB"] + 599 l[1:2] = new_slice + 600 root.c[1:2] = new_slice + 601 + 602 self.assertEqual(["c1", "cA", "cB", "c3", "c4"], l) + 603 self.assertEqual(["c1", "cA", "cB", "c3", "c4"], + 604 [ c.text for c in root.c ]) + 605 self.assertEqual(l, + 606 [ c.text for c in root.c ]) +
607 +
608 - def test_setslice_insert(self): +
609 Element = self.Element + 610 root = Element("root") + 611 l = ["c1", "c2", "c3", "c4"] + 612 root.c = l + 613 + 614 self.assertEqual(["c1", "c2", "c3", "c4"], + 615 [ c.text for c in root.c ]) + 616 self.assertEqual(l, + 617 [ c.text for c in root.c ]) + 618 + 619 new_slice = ["cA", "cB"] + 620 l[1:1] = new_slice + 621 root.c[1:1] = new_slice + 622 + 623 self.assertEqual(["c1", "cA", "cB", "c2", "c3", "c4"], l) + 624 self.assertEqual(["c1", "cA", "cB", "c2", "c3", "c4"], + 625 [ c.text for c in root.c ]) + 626 self.assertEqual(l, + 627 [ c.text for c in root.c ]) +
628 +
629 - def test_setslice_insert_neg(self): +
630 Element = self.Element + 631 root = Element("root") + 632 l = ["c1", "c2", "c3", "c4"] + 633 root.c = l + 634 + 635 self.assertEqual(["c1", "c2", "c3", "c4"], + 636 [ c.text for c in root.c ]) + 637 self.assertEqual(l, + 638 [ c.text for c in root.c ]) + 639 + 640 new_slice = ["cA", "cB"] + 641 l[-2:-2] = new_slice + 642 root.c[-2:-2] = new_slice + 643 + 644 self.assertEqual(["c1", "c2", "cA", "cB", "c3", "c4"], l) + 645 self.assertEqual(["c1", "c2", "cA", "cB", "c3", "c4"], + 646 [ c.text for c in root.c ]) + 647 self.assertEqual(l, + 648 [ c.text for c in root.c ]) +
649 +
650 - def test_setslice_empty(self): +
651 Element = self.Element + 652 root = Element("root") + 653 + 654 root.c = [] + 655 self.assertRaises( + 656 AttributeError, getattr, root, 'c') +
657 +
659 Element = self.Element + 660 root = Element("root") + 661 l = ["c1", "c2", "c3", "c4"] + 662 root.c = l + 663 + 664 self.assertEqual(["c1", "c2", "c3", "c4"], + 665 [ c.text for c in root.c ]) + 666 self.assertEqual(l, + 667 [ c.text for c in root.c ]) + 668 + 669 new_slice = ["cA", "cB", "cC"] + 670 self.assertRaises( + 671 ValueError, operator.setitem, + 672 l, slice(1,2,-1), new_slice) + 673 self.assertRaises( + 674 ValueError, operator.setitem, + 675 root.c, slice(1,2,-1), new_slice) +
676 +
677 - def test_setslice_partial_neg(self): +
678 Element = self.Element + 679 root = Element("root") + 680 l = ["c1", "c2", "c3", "c4"] + 681 root.c = l + 682 + 683 self.assertEqual(["c1", "c2", "c3", "c4"], + 684 [ c.text for c in root.c ]) + 685 self.assertEqual(l, + 686 [ c.text for c in root.c ]) + 687 + 688 new_slice = ["cA", "cB"] + 689 l[-1:1:-1] = new_slice + 690 root.c[-1:1:-1] = new_slice + 691 + 692 self.assertEqual(["c1", "c2", "cB", "cA"], l) + 693 self.assertEqual(["c1", "c2", "cB", "cA"], + 694 [ c.text for c in root.c ]) + 695 self.assertEqual(l, + 696 [ c.text for c in root.c ]) +
697 +
699 Element = self.Element + 700 root = Element("root") + 701 l = ["c1", "c2", "c3", "c4"] + 702 root.c = l + 703 + 704 self.assertEqual(["c1", "c2", "c3", "c4"], + 705 [ c.text for c in root.c ]) + 706 self.assertEqual(l, + 707 [ c.text for c in root.c ]) + 708 + 709 new_slice = ["cA", "cB"] + 710 l[-1:-4:-2] = new_slice + 711 root.c[-1:-4:-2] = new_slice + 712 + 713 self.assertEqual(["c1", "cB", "c3", "cA"], l) + 714 self.assertEqual(["c1", "cB", "c3", "cA"], + 715 [ c.text for c in root.c ]) + 716 self.assertEqual(l, + 717 [ c.text for c in root.c ]) +
718 + 719 # other stuff + 720 +
721 - def test_setitem_index(self): +
722 Element = self.Element + 723 root = Element("root") + 724 root['child'] = ['CHILD1', 'CHILD2'] + 725 self.assertEqual(["CHILD1", "CHILD2"], + 726 [ c.text for c in root.child ]) + 727 + 728 self.assertRaises(IndexError, operator.setitem, root.child, -3, 'oob') + 729 self.assertRaises(IndexError, operator.setitem, root.child, -300, 'oob') + 730 self.assertRaises(IndexError, operator.setitem, root.child, 2, 'oob') + 731 self.assertRaises(IndexError, operator.setitem, root.child, 200, 'oob') + 732 + 733 root.child[0] = "child0" + 734 root.child[-1] = "child-1" + 735 self.assertEqual(["child0", "child-1"], + 736 [ c.text for c in root.child ]) + 737 + 738 root.child[1] = "child1" + 739 root.child[-2] = "child-2" + 740 self.assertEqual(["child-2", "child1"], + 741 [ c.text for c in root.child ]) +
742 +
743 - def test_delitem_index(self): +
744 # make sure strings are set as children + 745 Element = self.Element + 746 root = Element("root") + 747 root['child'] = ['CHILD1', 'CHILD2', 'CHILD3', 'CHILD4'] + 748 self.assertEqual(["CHILD1", "CHILD2", "CHILD3", "CHILD4"], + 749 [ c.text for c in root.child ]) + 750 + 751 del root.child[-1] + 752 self.assertEqual(["CHILD1", "CHILD2", "CHILD3"], + 753 [ c.text for c in root.child ]) + 754 del root.child[-2] + 755 self.assertEqual(["CHILD1", "CHILD3"], + 756 [ c.text for c in root.child ]) + 757 del root.child[0] + 758 self.assertEqual(["CHILD3"], + 759 [ c.text for c in root.child ]) + 760 del root.child[-1] + 761 self.assertRaises(AttributeError, getattr, root, 'child') +
762 +
763 - def test_set_string(self): +
764 # make sure strings are not handled as sequences + 765 Element = self.Element + 766 root = Element("root") + 767 root.c = "TEST" + 768 self.assertEqual(["TEST"], + 769 [ c.text for c in root.c ]) +
770 +
771 - def test_setitem_string(self): +
772 # make sure strings are set as children + 773 Element = self.Element + 774 root = Element("root") + 775 root["c"] = "TEST" + 776 self.assertEqual(["TEST"], + 777 [ c.text for c in root.c ]) +
778 +
779 - def test_setitem_string_special(self): +
780 # make sure 'text' etc. are set as children + 781 Element = self.Element + 782 root = Element("root") + 783 + 784 root["text"] = "TEST" + 785 self.assertEqual(["TEST"], + 786 [ c.text for c in root["text"] ]) + 787 + 788 root["tail"] = "TEST" + 789 self.assertEqual(["TEST"], + 790 [ c.text for c in root["tail"] ]) + 791 + 792 root["pyval"] = "TEST" + 793 self.assertEqual(["TEST"], + 794 [ c.text for c in root["pyval"] ]) + 795 + 796 root["tag"] = "TEST" + 797 self.assertEqual(["TEST"], + 798 [ c.text for c in root["tag"] ]) +
799 +
800 - def test_findall(self): +
801 XML = self.XML + 802 root = XML('<a><b><c/></b><b/><c><b/></c></a>') + 803 self.assertEqual(1, len(root.findall("c"))) + 804 self.assertEqual(2, len(root.findall(".//c"))) + 805 self.assertEqual(3, len(root.findall(".//b"))) + 806 self.assertTrue(root.findall(".//b")[1] is root.getchildren()[1]) +
807 +
808 - def test_findall_ns(self): +
809 XML = self.XML + 810 root = XML('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>') + 811 self.assertEqual(2, len(root.findall(".//{X}b"))) + 812 self.assertEqual(3, len(root.findall(".//b"))) + 813 self.assertEqual(2, len(root.findall("b"))) +
814 +
815 - def test_build_tree(self): +
816 root = self.Element('root') + 817 root.a = 5 + 818 root.b = 6 + 819 self.assertTrue(isinstance(root, objectify.ObjectifiedElement)) + 820 self.assertTrue(isinstance(root.a, objectify.IntElement)) + 821 self.assertTrue(isinstance(root.b, objectify.IntElement)) +
822 +
823 - def test_type_NoneType(self): +
824 Element = self.Element + 825 SubElement = self.etree.SubElement + 826 + 827 nil_attr = XML_SCHEMA_NIL_ATTR + 828 root = Element("{objectified}root") + 829 SubElement(root, "{objectified}none") + 830 SubElement(root, "{objectified}none", {nil_attr : "true"}) + 831 self.assertFalse(isinstance(root.none, objectify.NoneElement)) + 832 self.assertFalse(isinstance(root.none[0], objectify.NoneElement)) + 833 self.assertTrue(isinstance(root.none[1], objectify.NoneElement)) + 834 self.assertEqual(hash(root.none[1]), hash(None)) + 835 self.assertEqual(root.none[1], None) + 836 self.assertFalse(root.none[1]) +
837 +
838 - def test_data_element_NoneType(self): +
839 value = objectify.DataElement(None) + 840 self.assertTrue(isinstance(value, objectify.NoneElement)) + 841 self.assertEqual(value, None) + 842 self.assertEqual(value.get(XML_SCHEMA_NIL_ATTR), "true") +
843 +
844 - def test_type_bool(self): +
845 Element = self.Element + 846 SubElement = self.etree.SubElement + 847 root = Element("{objectified}root") + 848 root.bool = True + 849 self.assertEqual(root.bool, True) + 850 self.assertEqual(root.bool + root.bool, True + True) + 851 self.assertEqual(True + root.bool, True + root.bool) + 852 self.assertEqual(root.bool * root.bool, True * True) + 853 self.assertEqual(int(root.bool), int(True)) + 854 self.assertEqual(hash(root.bool), hash(True)) + 855 self.assertEqual(complex(root.bool), complex(True)) + 856 self.assertTrue(isinstance(root.bool, objectify.BoolElement)) + 857 + 858 root.bool = False + 859 self.assertEqual(root.bool, False) + 860 self.assertEqual(root.bool + root.bool, False + False) + 861 self.assertEqual(False + root.bool, False + root.bool) + 862 self.assertEqual(root.bool * root.bool, False * False) + 863 self.assertEqual(int(root.bool), int(False)) + 864 self.assertEqual(hash(root.bool), hash(False)) + 865 self.assertEqual(complex(root.bool), complex(False)) + 866 self.assertTrue(isinstance(root.bool, objectify.BoolElement)) +
867 +
868 - def test_data_element_bool(self): +
869 value = objectify.DataElement(True) + 870 self.assertTrue(isinstance(value, objectify.BoolElement)) + 871 self.assertEqual(value, True) + 872 + 873 value = objectify.DataElement(False) + 874 self.assertTrue(isinstance(value, objectify.BoolElement)) + 875 self.assertEqual(value, False) +
876 +
877 - def test_type_str(self): +
878 Element = self.Element + 879 SubElement = self.etree.SubElement + 880 root = Element("{objectified}root") + 881 root.s = "test" + 882 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
883 +
884 - def test_type_str_intliteral(self): +
885 Element = self.Element + 886 SubElement = self.etree.SubElement + 887 root = Element("{objectified}root") + 888 root.s = "3" + 889 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
890 +
891 - def test_type_str_floatliteral(self): +
892 Element = self.Element + 893 SubElement = self.etree.SubElement + 894 root = Element("{objectified}root") + 895 root.s = "3.72" + 896 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
897 +
898 - def test_type_str_mul(self): +
899 Element = self.Element + 900 SubElement = self.etree.SubElement + 901 root = Element("{objectified}root") + 902 root.s = "test" + 903 + 904 self.assertEqual("test" * 5, root.s * 5) + 905 self.assertEqual(5 * "test", 5 * root.s) + 906 + 907 self.assertRaises(TypeError, operator.mul, root.s, "honk") + 908 self.assertRaises(TypeError, operator.mul, "honk", root.s) +
909 +
910 - def test_type_str_add(self): +
911 Element = self.Element + 912 SubElement = self.etree.SubElement + 913 root = Element("{objectified}root") + 914 root.s = "test" + 915 + 916 s = "toast" + 917 self.assertEqual("test" + s, root.s + s) + 918 self.assertEqual(s + "test", s + root.s) +
919 +
920 - def test_type_str_mod(self): +
921 s = "%d %f %s %r" + 922 el = objectify.DataElement(s) + 923 values = (1, 7.0, "abcd", None) + 924 self.assertEqual(s % values, el % values) + 925 + 926 s = "%d" + 927 el = objectify.DataElement(s) + 928 val = 5 + 929 self.assertEqual(s % val, el % val) + 930 + 931 s = "%d %s" + 932 el = objectify.DataElement(s) + 933 val = 5 + 934 self.assertRaises(TypeError, el.__mod__, val) + 935 + 936 s = "" + 937 el = objectify.DataElement(s) + 938 val = 5 + 939 self.assertRaises(TypeError, el.__mod__, val) +
940 +
941 - def test_type_str_hash(self): +
942 v = "1" + 943 el = objectify.DataElement(v) + 944 self.assertEqual(hash(el), hash("1")) +
945 +
946 - def test_type_str_as_int(self): +
947 v = "1" + 948 el = objectify.DataElement(v) + 949 self.assertEqual(int(el), 1) +
950 +
951 - def test_type_str_as_float(self): +
952 v = "1" + 953 el = objectify.DataElement(v) + 954 self.assertEqual(float(el), 1) +
955 +
956 - def test_type_str_as_complex(self): +
957 v = "1" + 958 el = objectify.DataElement(v) + 959 self.assertEqual(complex(el), 1) +
960 +
962 s = "%d %f %s %r" + 963 el = objectify.DataElement(s) + 964 values = (objectify.DataElement(1), + 965 objectify.DataElement(7.0), + 966 objectify.DataElement("abcd"), + 967 objectify.DataElement(None)) + 968 self.assertEqual(s % values, el % values) +
969 +
970 - def test_data_element_str(self): +
971 value = objectify.DataElement("test") + 972 self.assertTrue(isinstance(value, objectify.StringElement)) + 973 self.assertEqual(value, "test") +
974 +
976 value = objectify.DataElement("3") + 977 self.assertTrue(isinstance(value, objectify.StringElement)) + 978 self.assertEqual(value, "3") +
979 +
981 value = objectify.DataElement("3.20") + 982 self.assertTrue(isinstance(value, objectify.StringElement)) + 983 self.assertEqual(value, "3.20") +
984 +
985 - def test_type_ustr(self): +
986 Element = self.Element + 987 SubElement = self.etree.SubElement + 988 root = Element("{objectified}root") + 989 root.s = _str("test") + 990 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
991 +
992 - def test_type_ustr_intliteral(self): +
993 Element = self.Element + 994 SubElement = self.etree.SubElement + 995 root = Element("{objectified}root") + 996 root.s = _str("3") + 997 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
998 +
999 - def test_type_ustr_floatliteral(self): +
1000 Element = self.Element +1001 SubElement = self.etree.SubElement +1002 root = Element("{objectified}root") +1003 root.s = _str("3.72") +1004 self.assertTrue(isinstance(root.s, objectify.StringElement)) +
1005 +
1006 - def test_type_ustr_mul(self): +
1007 Element = self.Element +1008 SubElement = self.etree.SubElement +1009 root = Element("{objectified}root") +1010 root.s = _str("test") +1011 +1012 self.assertEqual(_str("test") * 5, root.s * 5) +1013 self.assertEqual(5 * _str("test"), 5 * root.s) +1014 +1015 self.assertRaises(TypeError, operator.mul, root.s, _str("honk")) +1016 self.assertRaises(TypeError, operator.mul, _str("honk"), root.s) +
1017 +
1018 - def test_type_ustr_add(self): +
1019 Element = self.Element +1020 SubElement = self.etree.SubElement +1021 root = Element("{objectified}root") +1022 root.s = _str("test") +1023 +1024 s = _str("toast") +1025 self.assertEqual(_str("test") + s, root.s + s) +1026 self.assertEqual(s + _str("test"), s + root.s) +
1027 +
1028 - def test_data_element_ustr(self): +
1029 value = objectify.DataElement(_str("test")) +1030 self.assertTrue(isinstance(value, objectify.StringElement)) +1031 self.assertEqual(value, _str("test")) +
1032 +
1034 value = objectify.DataElement("3") +1035 self.assertTrue(isinstance(value, objectify.StringElement)) +1036 self.assertEqual(value, _str("3")) +
1037 +
1039 value = objectify.DataElement(_str("3.20")) +1040 self.assertTrue(isinstance(value, objectify.StringElement)) +1041 self.assertEqual(value, _str("3.20")) +
1042 +
1043 - def test_type_int(self): +
1044 Element = self.Element +1045 root = Element("{objectified}root") +1046 root.none = 5 +1047 self.assertTrue(isinstance(root.none, objectify.IntElement)) +1048 self.assertEqual(5, root.none.__index__()) +
1049 +
1050 - def test_data_element_int(self): +
1051 value = objectify.DataElement(5) +1052 self.assertTrue(isinstance(value, objectify.IntElement)) +1053 self.assertEqual(value, 5) +
1054 +
1055 - def test_data_element_int_hash(self): +
1056 value = objectify.DataElement(123) +1057 self.assertEqual(hash(value), hash(123)) +
1058 +
1059 - def test_type_float(self): +
1060 Element = self.Element +1061 SubElement = self.etree.SubElement +1062 root = Element("{objectified}root") +1063 root.none = 5.5 +1064 self.assertTrue(isinstance(root.none, objectify.FloatElement)) +
1065 +
1066 - def test_data_element_float(self): +
1067 value = objectify.DataElement(5.5) +1068 self.assertTrue(isinstance(value, objectify.FloatElement)) +1069 self.assertEqual(value, 5.5) +
1070 +
1072 value = objectify.DataElement(5.5) +1073 self.assertEqual(hash(value), hash(5.5)) +
1074 +
1075 - def test_type_float_precision(self): +
1076 # test not losing precision by shortened float str() value +1077 # repr(2.305064300557): '2.305064300557' +1078 # str(2.305064300557): '2.30506430056' +1079 # "%57.54f" % 2.305064300557: +1080 # ' 2.305064300556999956626214043353684246540069580078125000' +1081 Element = self.Element +1082 root = Element("{objectified}root") +1083 s = "2.305064300557" +1084 root.f = float(s) +1085 self.assertTrue(isinstance(root.f, objectify.FloatElement)) +1086 self.assertEqual(root.f.text, s) +1087 self.assertEqual(root.f.pyval, float(s)) +
1088 +
1090 # test precision preservation for FloatElement instantiation +1091 s = "2.305064300557" +1092 self.assertEqual(objectify.FloatElement(s), float(s)) +
1093 +
1095 # test consistent FloatElement values for the different instantiation +1096 # possibilities +1097 Element = self.Element +1098 root = Element("{objectified}root") +1099 s = "2.305064300557" +1100 f = float(s) +1101 float_elem = objectify.FloatElement(s) +1102 float_data_elem = objectify.DataElement(f) +1103 root.float_child = float(f) +1104 self.assertTrue(f == float_elem == float_data_elem == root.float_child) +
1105 +
1107 # test not losing precision by shortened float str() value +1108 f = 2305064300557.0 +1109 value = objectify.DataElement(f) +1110 self.assertTrue(isinstance(value, objectify.FloatElement)) +1111 self.assertEqual(value, f) +
1112 +
1114 # test not losing precision by shortened float str() value +1115 f = 2305064300557.0 +1116 value = objectify.DataElement(f) +1117 self.assertEqual(hash(value), hash(f)) +
1118 +
1119 - def test_data_element_xsitypes(self): +
1120 for xsi, objclass in xsitype2objclass.items(): +1121 # 1 is a valid value for all ObjectifiedDataElement classes +1122 pyval = 1 +1123 value = objectify.DataElement(pyval, _xsi=xsi) +1124 self.assertTrue(isinstance(value, objclass), +1125 "DataElement(%s, _xsi='%s') returns %s, expected %s" +1126 % (pyval, xsi, type(value), objclass)) +
1127 +
1129 for xsi, objclass in xsitype2objclass.items(): +1130 # 1 is a valid value for all ObjectifiedDataElement classes +1131 pyval = 1 +1132 value = objectify.DataElement(pyval, _xsi="xsd:%s" % xsi) +1133 self.assertTrue(isinstance(value, objclass), +1134 "DataElement(%s, _xsi='%s') returns %s, expected %s" +1135 % (pyval, xsi, type(value), objclass)) +
1136 +
1138 for xsi, objclass in xsitype2objclass.items(): +1139 # 1 is a valid value for all ObjectifiedDataElement classes +1140 self.assertRaises(ValueError, objectify.DataElement, 1, +1141 _xsi="foo:%s" % xsi) +
1142 +
1143 - def test_data_element_pytypes(self): +
1144 for pytype, objclass in pytype2objclass.items(): +1145 # 1 is a valid value for all ObjectifiedDataElement classes +1146 pyval = 1 +1147 value = objectify.DataElement(pyval, _pytype=pytype) +1148 self.assertTrue(isinstance(value, objclass), +1149 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1150 % (pyval, pytype, type(value), objclass)) +
1151 +
1153 pyval = 1 +1154 pytype = "NoneType" +1155 objclass = objectify.NoneElement +1156 value = objectify.DataElement(pyval, _pytype=pytype) +1157 self.assertTrue(isinstance(value, objclass), +1158 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1159 % (pyval, pytype, type(value), objclass)) +1160 self.assertEqual(value.text, None) +1161 self.assertEqual(value.pyval, None) +
1162 +
1164 # pre-2.0 lxml called NoneElement "none" +1165 pyval = 1 +1166 pytype = "none" +1167 objclass = objectify.NoneElement +1168 value = objectify.DataElement(pyval, _pytype=pytype) +1169 self.assertTrue(isinstance(value, objclass), +1170 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1171 % (pyval, pytype, type(value), objclass)) +1172 self.assertEqual(value.text, None) +1173 self.assertEqual(value.pyval, None) +
1174 +
1175 - def test_type_unregistered(self): +
1176 Element = self.Element +1177 SubElement = self.etree.SubElement +1178 class MyFloat(float): +1179 pass +
1180 root = Element("{objectified}root") +1181 root.myfloat = MyFloat(5.5) +1182 self.assertTrue(isinstance(root.myfloat, objectify.FloatElement)) +1183 self.assertEqual(root.myfloat.get(objectify.PYTYPE_ATTRIBUTE), None) +
1184 +
1186 class MyFloat(float): +1187 pass +
1188 value = objectify.DataElement(MyFloat(5.5)) +1189 self.assertTrue(isinstance(value, objectify.FloatElement)) +1190 self.assertEqual(value, 5.5) +1191 self.assertEqual(value.get(objectify.PYTYPE_ATTRIBUTE), None) +1192 +
1193 - def test_schema_types(self): +
1194 XML = self.XML +1195 root = XML('''\ +1196 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1197 <b xsi:type="boolean">true</b> +1198 <b xsi:type="boolean">false</b> +1199 <b xsi:type="boolean">1</b> +1200 <b xsi:type="boolean">0</b> +1201 +1202 <f xsi:type="float">5</f> +1203 <f xsi:type="double">5</f> +1204 +1205 <s xsi:type="string">5</s> +1206 <s xsi:type="normalizedString">5</s> +1207 <s xsi:type="token">5</s> +1208 <s xsi:type="language">5</s> +1209 <s xsi:type="Name">5</s> +1210 <s xsi:type="NCName">5</s> +1211 <s xsi:type="ID">5</s> +1212 <s xsi:type="IDREF">5</s> +1213 <s xsi:type="ENTITY">5</s> +1214 <s xsi:type="NMTOKEN">5</s> +1215 +1216 <l xsi:type="integer">5</l> +1217 <l xsi:type="nonPositiveInteger">5</l> +1218 <l xsi:type="negativeInteger">5</l> +1219 <l xsi:type="long">5</l> +1220 <l xsi:type="nonNegativeInteger">5</l> +1221 <l xsi:type="unsignedLong">5</l> +1222 <l xsi:type="unsignedInt">5</l> +1223 <l xsi:type="positiveInteger">5</l> +1224 +1225 <i xsi:type="int">5</i> +1226 <i xsi:type="short">5</i> +1227 <i xsi:type="byte">5</i> +1228 <i xsi:type="unsignedShort">5</i> +1229 <i xsi:type="unsignedByte">5</i> +1230 +1231 <n xsi:nil="true"/> +1232 </root> +1233 ''') +1234 +1235 for b in root.b: +1236 self.assertTrue(isinstance(b, objectify.BoolElement)) +1237 self.assertEqual(True, root.b[0]) +1238 self.assertEqual(False, root.b[1]) +1239 self.assertEqual(True, root.b[2]) +1240 self.assertEqual(False, root.b[3]) +1241 +1242 for f in root.f: +1243 self.assertTrue(isinstance(f, objectify.FloatElement)) +1244 self.assertEqual(5, f) +1245 +1246 for s in root.s: +1247 self.assertTrue(isinstance(s, objectify.StringElement)) +1248 self.assertEqual("5", s) +1249 +1250 for i in root.i: +1251 self.assertTrue(isinstance(i, objectify.IntElement)) +1252 self.assertEqual(5, i) +1253 +1254 for l in root.l: +1255 self.assertTrue(isinstance(l, objectify.IntElement)) +1256 self.assertEqual(5, i) +1257 +1258 self.assertTrue(isinstance(root.n, objectify.NoneElement)) +1259 self.assertEqual(None, root.n) +
1260 +
1261 - def test_schema_types_prefixed(self): +
1262 XML = self.XML +1263 root = XML('''\ +1264 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1265 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1266 <b xsi:type="xsd:boolean">true</b> +1267 <b xsi:type="xsd:boolean">false</b> +1268 <b xsi:type="xsd:boolean">1</b> +1269 <b xsi:type="xsd:boolean">0</b> +1270 +1271 <f xsi:type="xsd:float">5</f> +1272 <f xsi:type="xsd:double">5</f> +1273 +1274 <s xsi:type="xsd:string">5</s> +1275 <s xsi:type="xsd:normalizedString">5</s> +1276 <s xsi:type="xsd:token">5</s> +1277 <s xsi:type="xsd:language">5</s> +1278 <s xsi:type="xsd:Name">5</s> +1279 <s xsi:type="xsd:NCName">5</s> +1280 <s xsi:type="xsd:ID">5</s> +1281 <s xsi:type="xsd:IDREF">5</s> +1282 <s xsi:type="xsd:ENTITY">5</s> +1283 <s xsi:type="xsd:NMTOKEN">5</s> +1284 +1285 <l xsi:type="xsd:integer">5</l> +1286 <l xsi:type="xsd:nonPositiveInteger">5</l> +1287 <l xsi:type="xsd:negativeInteger">5</l> +1288 <l xsi:type="xsd:long">5</l> +1289 <l xsi:type="xsd:nonNegativeInteger">5</l> +1290 <l xsi:type="xsd:unsignedLong">5</l> +1291 <l xsi:type="xsd:unsignedInt">5</l> +1292 <l xsi:type="xsd:positiveInteger">5</l> +1293 +1294 <i xsi:type="xsd:int">5</i> +1295 <i xsi:type="xsd:short">5</i> +1296 <i xsi:type="xsd:byte">5</i> +1297 <i xsi:type="xsd:unsignedShort">5</i> +1298 <i xsi:type="xsd:unsignedByte">5</i> +1299 +1300 <n xsi:nil="true"/> +1301 </root> +1302 ''') +1303 +1304 for b in root.b: +1305 self.assertTrue(isinstance(b, objectify.BoolElement)) +1306 self.assertEqual(True, root.b[0]) +1307 self.assertEqual(False, root.b[1]) +1308 self.assertEqual(True, root.b[2]) +1309 self.assertEqual(False, root.b[3]) +1310 +1311 for f in root.f: +1312 self.assertTrue(isinstance(f, objectify.FloatElement)) +1313 self.assertEqual(5, f) +1314 +1315 for s in root.s: +1316 self.assertTrue(isinstance(s, objectify.StringElement)) +1317 self.assertEqual("5", s) +1318 +1319 for i in root.i: +1320 self.assertTrue(isinstance(i, objectify.IntElement)) +1321 self.assertEqual(5, i) +1322 +1323 for l in root.l: +1324 self.assertTrue(isinstance(l, objectify.IntElement)) +1325 self.assertEqual(5, l) +1326 +1327 self.assertTrue(isinstance(root.n, objectify.NoneElement)) +1328 self.assertEqual(None, root.n) +
1329 +
1330 - def test_type_str_sequence(self): +
1331 XML = self.XML +1332 root = XML(_bytes('<root><b>why</b><b>try</b></root>')) +1333 strs = [ str(s) for s in root.b ] +1334 self.assertEqual(["why", "try"], +1335 strs) +
1336 +
1337 - def test_type_str_cmp(self): +
1338 XML = self.XML +1339 root = XML(_bytes('<root><b>test</b><b>taste</b><b></b><b/></root>')) +1340 self.assertFalse(root.b[0] < root.b[1]) +1341 self.assertFalse(root.b[0] <= root.b[1]) +1342 self.assertFalse(root.b[0] == root.b[1]) +1343 +1344 self.assertTrue(root.b[0] != root.b[1]) +1345 self.assertTrue(root.b[0] >= root.b[1]) +1346 self.assertTrue(root.b[0] > root.b[1]) +1347 +1348 self.assertEqual(root.b[0], "test") +1349 self.assertEqual("test", root.b[0]) +1350 +1351 self.assertEqual("", root.b[2]) +1352 self.assertEqual(root.b[2], "") +1353 self.assertEqual("", root.b[3]) +1354 self.assertEqual(root.b[3], "") +1355 self.assertEqual(root.b[2], root.b[3]) +1356 +1357 root.b = "test" +1358 self.assertTrue(root.b) +1359 root.b = "" +1360 self.assertFalse(root.b) +1361 self.assertEqual(root.b, "") +1362 self.assertEqual("", root.b) +
1363 +
1364 - def test_type_int_cmp(self): +
1365 XML = self.XML +1366 root = XML(_bytes('<root><b>5</b><b>6</b></root>')) +1367 self.assertTrue(root.b[0] < root.b[1]) +1368 self.assertTrue(root.b[0] <= root.b[1]) +1369 self.assertTrue(root.b[0] != root.b[1]) +1370 +1371 self.assertFalse(root.b[0] == root.b[1]) +1372 self.assertFalse(root.b[0] >= root.b[1]) +1373 self.assertFalse(root.b[0] > root.b[1]) +1374 +1375 self.assertEqual(root.b[0], 5) +1376 self.assertEqual(5, root.b[0]) +1377 self.assertNotEqual(root.b[0], "5") +1378 +1379 root.b = 5 +1380 self.assertTrue(root.b) +1381 root.b = 0 +1382 self.assertFalse(root.b) +
1383 +1384 # float + long share the NumberElement implementation with int +1385 +
1386 - def test_type_bool_cmp(self): +
1387 XML = self.XML +1388 root = XML(_bytes('<root><b>false</b><b>true</b></root>')) +1389 self.assertTrue(root.b[0] < root.b[1]) +1390 self.assertTrue(root.b[0] <= root.b[1]) +1391 self.assertTrue(root.b[0] != root.b[1]) +1392 +1393 self.assertFalse(root.b[0] == root.b[1]) +1394 self.assertFalse(root.b[0] >= root.b[1]) +1395 self.assertFalse(root.b[0] > root.b[1]) +1396 +1397 self.assertFalse(root.b[0]) +1398 self.assertTrue(root.b[1]) +1399 +1400 self.assertEqual(root.b[0], False) +1401 self.assertEqual(False, root.b[0]) +1402 self.assertTrue(root.b[0] < 5) +1403 self.assertTrue(5 > root.b[0]) +1404 +1405 root.b = True +1406 self.assertTrue(root.b) +1407 root.b = False +1408 self.assertFalse(root.b) +
1409 +
1410 - def test_type_none_cmp(self): +
1411 XML = self.XML +1412 root = XML(_bytes(""" +1413 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1414 <b xsi:nil="true"></b><b xsi:nil="true"/> +1415 </root>""")) +1416 self.assertTrue(root.b[0] == root.b[1]) +1417 self.assertFalse(root.b[0]) +1418 self.assertEqual(root.b[0], None) +1419 self.assertEqual(None, root.b[0]) +
1420 +1421 # doesn't work in Py3: +1422 +1423 #for comparison in ["abc", 5, 7.3, True, [], ()]: +1424 # none = root.b[1] +1425 # self.assertTrue(none < comparison, "%s (%s) should be < %s" % +1426 # (none, type(none), comparison) ) +1427 # self.assertTrue(comparison > none, "%s should be > %s (%s)" % +1428 # (comparison, none, type(none)) ) +1429 +
1430 - def test_dataelement_xsi(self): +
1431 el = objectify.DataElement(1, _xsi="string") +1432 self.assertEqual( +1433 el.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), +1434 'xsd:string') +
1435 +
1436 - def test_dataelement_xsi_nsmap(self): +
1437 el = objectify.DataElement(1, _xsi="string", +1438 nsmap={'schema': XML_SCHEMA_NS}) +1439 self.assertEqual( +1440 el.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), +1441 'schema:string') +
1442 +
1444 self.assertRaises(ValueError, objectify.DataElement, 1, +1445 _xsi="foo:string") +
1446 +
1447 - def test_pytype_annotation(self): +
1448 XML = self.XML +1449 root = XML(_bytes('''\ +1450 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1451 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1452 <b>5</b> +1453 <b>test</b> +1454 <c>1.1</c> +1455 <c>\uF8D2</c> +1456 <x>true</x> +1457 <n xsi:nil="true" /> +1458 <n></n> +1459 <b xsi:type="double">5</b> +1460 <b xsi:type="float">5</b> +1461 <s xsi:type="string">23</s> +1462 <s py:pytype="str">42</s> +1463 <f py:pytype="float">300</f> +1464 <l py:pytype="long">2</l> +1465 <t py:pytype="TREE"></t> +1466 </a> +1467 ''')) +1468 objectify.annotate(root) +1469 +1470 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1471 for c in root.iterchildren() ] +1472 self.assertEqual("int", child_types[ 0]) +1473 self.assertEqual("str", child_types[ 1]) +1474 self.assertEqual("float", child_types[ 2]) +1475 self.assertEqual("str", child_types[ 3]) +1476 self.assertEqual("bool", child_types[ 4]) +1477 self.assertEqual("NoneType", child_types[ 5]) +1478 self.assertEqual(None, child_types[ 6]) +1479 self.assertEqual("float", child_types[ 7]) +1480 self.assertEqual("float", child_types[ 8]) +1481 self.assertEqual("str", child_types[ 9]) +1482 self.assertEqual("int", child_types[10]) +1483 self.assertEqual("int", child_types[11]) +1484 self.assertEqual("int", child_types[12]) +1485 self.assertEqual(None, child_types[13]) +1486 +1487 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1488 +
1490 XML = self.XML +1491 root = XML(_bytes('''\ +1492 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1493 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1494 <n></n> +1495 </a> +1496 ''')) +1497 objectify.annotate(root) +1498 +1499 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1500 for c in root.iterchildren() ] +1501 self.assertEqual(None, child_types[0]) +1502 +1503 objectify.annotate(root, empty_pytype="str") +1504 +1505 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1506 for c in root.iterchildren() ] +1507 self.assertEqual("str", child_types[0]) +
1508 +
1510 XML = self.XML +1511 root = XML(_bytes('''\ +1512 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1513 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1514 <b>5</b> +1515 <b>test</b> +1516 <c>1.1</c> +1517 <c>\uF8D2</c> +1518 <x>true</x> +1519 <n xsi:nil="true" /> +1520 <n></n> +1521 <b xsi:type="double">5</b> +1522 <b xsi:type="float">5</b> +1523 <s xsi:type="string">23</s> +1524 <s py:pytype="str">42</s> +1525 <f py:pytype="float">300</f> +1526 <l py:pytype="long">2</l> +1527 <t py:pytype="TREE"></t> +1528 </a> +1529 ''')) +1530 objectify.annotate(root, ignore_old=False) +1531 +1532 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1533 for c in root.iterchildren() ] +1534 self.assertEqual("int", child_types[ 0]) +1535 self.assertEqual("str", child_types[ 1]) +1536 self.assertEqual("float", child_types[ 2]) +1537 self.assertEqual("str", child_types[ 3]) +1538 self.assertEqual("bool", child_types[ 4]) +1539 self.assertEqual("NoneType", child_types[ 5]) +1540 self.assertEqual(None, child_types[ 6]) +1541 self.assertEqual("float", child_types[ 7]) +1542 self.assertEqual("float", child_types[ 8]) +1543 self.assertEqual("str", child_types[ 9]) +1544 self.assertEqual("str", child_types[10]) +1545 self.assertEqual("float", child_types[11]) +1546 self.assertEqual("int", child_types[12]) +1547 self.assertEqual(TREE_PYTYPE, child_types[13]) +1548 +1549 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1550 +
1552 XML = self.XML +1553 root = XML(_bytes('''\ +1554 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1555 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1556 <b>5</b> +1557 <b>test</b> +1558 <c>1.1</c> +1559 <c>\uF8D2</c> +1560 <x>true</x> +1561 <n xsi:nil="true" /> +1562 <n></n> +1563 <b xsi:type="double">5</b> +1564 <b xsi:type="float">5</b> +1565 <s xsi:type="string">23</s> +1566 <s py:pytype="str">42</s> +1567 <f py:pytype="float">300</f> +1568 <l py:pytype="long">2</l> +1569 <t py:pytype="TREE"></t> +1570 </a> +1571 ''')) +1572 objectify.annotate(root, ignore_old=False, ignore_xsi=False, +1573 annotate_xsi=1, annotate_pytype=1) +1574 +1575 # check py annotations +1576 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1577 for c in root.iterchildren() ] +1578 self.assertEqual("int", child_types[ 0]) +1579 self.assertEqual("str", child_types[ 1]) +1580 self.assertEqual("float", child_types[ 2]) +1581 self.assertEqual("str", child_types[ 3]) +1582 self.assertEqual("bool", child_types[ 4]) +1583 self.assertEqual("NoneType", child_types[ 5]) +1584 self.assertEqual(None, child_types[ 6]) +1585 self.assertEqual("float", child_types[ 7]) +1586 self.assertEqual("float", child_types[ 8]) +1587 self.assertEqual("str", child_types[ 9]) +1588 self.assertEqual("str", child_types[10]) +1589 self.assertEqual("float", child_types[11]) +1590 self.assertEqual("int", child_types[12]) +1591 self.assertEqual(TREE_PYTYPE, child_types[13]) +1592 +1593 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1594 +1595 child_xsitypes = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1596 for c in root.iterchildren() ] +1597 +1598 # check xsi annotations +1599 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1600 for c in root.iterchildren() ] +1601 self.assertEqual("xsd:integer", child_types[ 0]) +1602 self.assertEqual("xsd:string", child_types[ 1]) +1603 self.assertEqual("xsd:double", child_types[ 2]) +1604 self.assertEqual("xsd:string", child_types[ 3]) +1605 self.assertEqual("xsd:boolean", child_types[ 4]) +1606 self.assertEqual(None, child_types[ 5]) +1607 self.assertEqual(None, child_types[ 6]) +1608 self.assertEqual("xsd:double", child_types[ 7]) +1609 self.assertEqual("xsd:float", child_types[ 8]) +1610 self.assertEqual("xsd:string", child_types[ 9]) +1611 self.assertEqual("xsd:string", child_types[10]) +1612 self.assertEqual("xsd:double", child_types[11]) +1613 self.assertEqual("xsd:integer", child_types[12]) +1614 self.assertEqual(None, child_types[13]) +1615 +1616 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1617 +
1618 - def test_xsiannotate_use_old(self): +
1619 XML = self.XML +1620 root = XML(_bytes('''\ +1621 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1622 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1623 <b>5</b> +1624 <b>test</b> +1625 <c>1.1</c> +1626 <c>\uF8D2</c> +1627 <x>true</x> +1628 <n xsi:nil="true" /> +1629 <n></n> +1630 <b xsi:type="double">5</b> +1631 <b xsi:type="float">5</b> +1632 <s xsi:type="string">23</s> +1633 <s py:pytype="str">42</s> +1634 <f py:pytype="float">300</f> +1635 <l py:pytype="long">2</l> +1636 <t py:pytype="TREE"></t> +1637 </a> +1638 ''')) +1639 objectify.xsiannotate(root, ignore_old=False) +1640 +1641 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1642 for c in root.iterchildren() ] +1643 self.assertEqual("xsd:integer", child_types[ 0]) +1644 self.assertEqual("xsd:string", child_types[ 1]) +1645 self.assertEqual("xsd:double", child_types[ 2]) +1646 self.assertEqual("xsd:string", child_types[ 3]) +1647 self.assertEqual("xsd:boolean", child_types[ 4]) +1648 self.assertEqual(None, child_types[ 5]) +1649 self.assertEqual(None, child_types[ 6]) +1650 self.assertEqual("xsd:double", child_types[ 7]) +1651 self.assertEqual("xsd:float", child_types[ 8]) +1652 self.assertEqual("xsd:string", child_types[ 9]) +1653 self.assertEqual("xsd:string", child_types[10]) +1654 self.assertEqual("xsd:double", child_types[11]) +1655 self.assertEqual("xsd:integer", child_types[12]) +1656 self.assertEqual(None, child_types[13]) +
1657 +
1658 - def test_pyannotate_ignore_old(self): +
1659 XML = self.XML +1660 root = XML(_bytes('''\ +1661 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1662 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1663 <b>5</b> +1664 <b>test</b> +1665 <c>1.1</c> +1666 <c>\uF8D2</c> +1667 <x>true</x> +1668 <n xsi:nil="true" /> +1669 <n></n> +1670 <b xsi:type="double">5</b> +1671 <b xsi:type="float">5</b> +1672 <s xsi:type="string">23</s> +1673 <s py:pytype="str">42</s> +1674 <f py:pytype="float">300</f> +1675 <l py:pytype="long">2</l> +1676 <t py:pytype="TREE"></t> +1677 </a> +1678 ''')) +1679 objectify.pyannotate(root, ignore_old=True) +1680 +1681 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1682 for c in root.iterchildren() ] +1683 self.assertEqual("int", child_types[ 0]) +1684 self.assertEqual("str", child_types[ 1]) +1685 self.assertEqual("float", child_types[ 2]) +1686 self.assertEqual("str", child_types[ 3]) +1687 self.assertEqual("bool", child_types[ 4]) +1688 self.assertEqual("NoneType", child_types[ 5]) +1689 self.assertEqual(None, child_types[ 6]) +1690 self.assertEqual("float", child_types[ 7]) +1691 self.assertEqual("float", child_types[ 8]) +1692 self.assertEqual("str", child_types[ 9]) +1693 self.assertEqual("int", child_types[10]) +1694 self.assertEqual("int", child_types[11]) +1695 self.assertEqual("int", child_types[12]) +1696 self.assertEqual(None, child_types[13]) +1697 +1698 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1699 +
1700 - def test_pyannotate_empty(self): +
1701 XML = self.XML +1702 root = XML('''\ +1703 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1704 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1705 <n></n> +1706 </a> +1707 ''') +1708 objectify.pyannotate(root) +1709 +1710 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1711 for c in root.iterchildren() ] +1712 self.assertEqual(None, child_types[0]) +1713 +1714 objectify.annotate(root, empty_pytype="str") +1715 +1716 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1717 for c in root.iterchildren() ] +1718 self.assertEqual("str", child_types[0]) +
1719 +
1720 - def test_pyannotate_use_old(self): +
1721 XML = self.XML +1722 root = XML('''\ +1723 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1724 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1725 <b>5</b> +1726 <b>test</b> +1727 <c>1.1</c> +1728 <c>\uF8D2</c> +1729 <x>true</x> +1730 <n xsi:nil="true" /> +1731 <n></n> +1732 <b xsi:type="double">5</b> +1733 <b xsi:type="float">5</b> +1734 <s xsi:type="string">23</s> +1735 <s py:pytype="str">42</s> +1736 <f py:pytype="float">300</f> +1737 <l py:pytype="long">2</l> +1738 <t py:pytype="TREE"></t> +1739 </a> +1740 ''') +1741 objectify.pyannotate(root) +1742 +1743 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1744 for c in root.iterchildren() ] +1745 self.assertEqual("int", child_types[ 0]) +1746 self.assertEqual("str", child_types[ 1]) +1747 self.assertEqual("float", child_types[ 2]) +1748 self.assertEqual("str", child_types[ 3]) +1749 self.assertEqual("bool", child_types[ 4]) +1750 self.assertEqual("NoneType", child_types[ 5]) +1751 self.assertEqual(None, child_types[ 6]) +1752 self.assertEqual("float", child_types[ 7]) +1753 self.assertEqual("float", child_types[ 8]) +1754 self.assertEqual("str", child_types[ 9]) +1755 self.assertEqual("str", child_types[10]) +1756 self.assertEqual("float", child_types[11]) +1757 self.assertEqual("int", child_types[12]) +1758 self.assertEqual(TREE_PYTYPE, child_types[13]) +1759 +1760 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1761 +
1762 - def test_xsiannotate_ignore_old(self): +
1763 XML = self.XML +1764 root = XML(_bytes('''\ +1765 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1766 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1767 <b>5</b> +1768 <b>test</b> +1769 <c>1.1</c> +1770 <c>\uF8D2</c> +1771 <x>true</x> +1772 <n xsi:nil="true" /> +1773 <n></n> +1774 <b xsi:type="double">5</b> +1775 <b xsi:type="float">5</b> +1776 <s xsi:type="string">23</s> +1777 <s py:pytype="str">42</s> +1778 <f py:pytype="float">300</f> +1779 <l py:pytype="long">2</l> +1780 <t py:pytype="TREE"></t> +1781 </a> +1782 ''')) +1783 objectify.xsiannotate(root, ignore_old=True) +1784 +1785 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1786 for c in root.iterchildren() ] +1787 self.assertEqual("xsd:integer", child_types[ 0]) +1788 self.assertEqual("xsd:string", child_types[ 1]) +1789 self.assertEqual("xsd:double", child_types[ 2]) +1790 self.assertEqual("xsd:string", child_types[ 3]) +1791 self.assertEqual("xsd:boolean", child_types[ 4]) +1792 self.assertEqual(None, child_types[ 5]) +1793 self.assertEqual(None, child_types[ 6]) +1794 self.assertEqual("xsd:integer", child_types[ 7]) +1795 self.assertEqual("xsd:integer", child_types[ 8]) +1796 self.assertEqual("xsd:integer", child_types[ 9]) +1797 self.assertEqual("xsd:string", child_types[10]) +1798 self.assertEqual("xsd:double", child_types[11]) +1799 self.assertEqual("xsd:integer", child_types[12]) +1800 self.assertEqual(None, child_types[13]) +1801 +1802 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1803 +
1804 - def test_deannotate(self): +
1805 XML = self.XML +1806 root = XML(_bytes('''\ +1807 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1808 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1809 <b>5</b> +1810 <b>test</b> +1811 <c>1.1</c> +1812 <c>\uF8D2</c> +1813 <x>true</x> +1814 <n xsi:nil="true" /> +1815 <n></n> +1816 <b xsi:type="double">5</b> +1817 <b xsi:type="float">5</b> +1818 <s xsi:type="string">23</s> +1819 <s py:pytype="str">42</s> +1820 <f py:pytype="float">300</f> +1821 <l py:pytype="long">2</l> +1822 <t py:pytype="TREE"></t> +1823 </a> +1824 ''')) +1825 objectify.deannotate(root) +1826 +1827 for c in root.getiterator(): +1828 self.assertEqual(None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +1829 self.assertEqual(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +1830 +1831 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1832 +
1833 - def test_xsinil_deannotate(self): +
1834 XML = self.XML +1835 root = XML(_bytes('''\ +1836 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1837 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +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 <b xsi:type="float">5</b> +1847 <s xsi:type="string">23</s> +1848 <s py:pytype="str">42</s> +1849 <f py:pytype="float">300</f> +1850 <l py:pytype="long">2</l> +1851 <t py:pytype="TREE"></t> +1852 </a> +1853 ''')) +1854 objectify.annotate( +1855 root, ignore_old=False, ignore_xsi=False, annotate_xsi=True, +1856 empty_pytype='str', empty_type='string') +1857 objectify.deannotate(root, pytype=False, xsi=False, xsi_nil=True) +1858 +1859 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1860 for c in root.iterchildren() ] +1861 self.assertEqual("xsd:integer", child_types[ 0]) +1862 self.assertEqual("xsd:string", child_types[ 1]) +1863 self.assertEqual("xsd:double", child_types[ 2]) +1864 self.assertEqual("xsd:string", child_types[ 3]) +1865 self.assertEqual("xsd:boolean", child_types[ 4]) +1866 self.assertEqual(None, child_types[ 5]) +1867 self.assertEqual("xsd:string", child_types[ 6]) +1868 self.assertEqual("xsd:double", child_types[ 7]) +1869 self.assertEqual("xsd:float", child_types[ 8]) +1870 self.assertEqual("xsd:string", child_types[ 9]) +1871 self.assertEqual("xsd:string", child_types[10]) +1872 self.assertEqual("xsd:double", child_types[11]) +1873 self.assertEqual("xsd:integer", child_types[12]) +1874 self.assertEqual(None, child_types[13]) +1875 +1876 self.assertEqual(None, root.n.get(XML_SCHEMA_NIL_ATTR)) +1877 +1878 for c in root.iterchildren(): +1879 self.assertNotEqual(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +1880 # these have no equivalent in xsi:type +1881 if (c.get(objectify.PYTYPE_ATTRIBUTE) not in [TREE_PYTYPE, +1882 "NoneType"]): +1883 self.assertNotEqual( +1884 None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +
1885 +
1886 - def test_xsitype_deannotate(self): +
1887 XML = self.XML +1888 root = XML(_bytes('''\ +1889 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1890 xmlns:py="http://codespeak.net/lxml/objectify/pytype" +1891 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1892 <b>5</b> +1893 <b>test</b> +1894 <c>1.1</c> +1895 <c>\uF8D2</c> +1896 <x>true</x> +1897 <n xsi:nil="true" /> +1898 <n></n> +1899 <b xsi:type="xsd:double">5</b> +1900 <b xsi:type="xsd:float">5</b> +1901 <s xsi:type="xsd:string">23</s> +1902 <s py:pytype="str">42</s> +1903 <f py:pytype="float">300</f> +1904 <l py:pytype="long">2</l> +1905 <t py:pytype="TREE"></t> +1906 </a> +1907 ''')) +1908 objectify.annotate(root) +1909 objectify.deannotate(root, pytype=False) +1910 +1911 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1912 for c in root.iterchildren() ] +1913 self.assertEqual("int", child_types[ 0]) +1914 self.assertEqual("str", child_types[ 1]) +1915 self.assertEqual("float", child_types[ 2]) +1916 self.assertEqual("str", child_types[ 3]) +1917 self.assertEqual("bool", child_types[ 4]) +1918 self.assertEqual("NoneType", child_types[ 5]) +1919 self.assertEqual(None, child_types[ 6]) +1920 self.assertEqual("float", child_types[ 7]) +1921 self.assertEqual("float", child_types[ 8]) +1922 self.assertEqual("str", child_types[ 9]) +1923 self.assertEqual("int", child_types[10]) +1924 self.assertEqual("int", child_types[11]) +1925 self.assertEqual("int", child_types[12]) +1926 self.assertEqual(None, child_types[13]) +1927 +1928 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1929 +1930 for c in root.getiterator(): +1931 self.assertEqual(None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +
1932 +
1933 - def test_pytype_deannotate(self): +
1934 XML = self.XML +1935 root = XML(_bytes('''\ +1936 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1937 xmlns:py="http://codespeak.net/lxml/objectify/pytype" +1938 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1939 <b xsi:type="xsd:int">5</b> +1940 <b xsi:type="xsd:string">test</b> +1941 <c xsi:type="xsd:float">1.1</c> +1942 <c xsi:type="xsd:string">\uF8D2</c> +1943 <x xsi:type="xsd:boolean">true</x> +1944 <n xsi:nil="true" /> +1945 <n></n> +1946 <b xsi:type="xsd:double">5</b> +1947 <b xsi:type="xsd:float">5</b> +1948 <s xsi:type="xsd:string">23</s> +1949 <s xsi:type="xsd:string">42</s> +1950 <f xsi:type="xsd:float">300</f> +1951 <l xsi:type="xsd:long">2</l> +1952 <t py:pytype="TREE"></t> +1953 </a> +1954 ''')) +1955 objectify.annotate(root) +1956 objectify.deannotate(root, xsi=False) +1957 +1958 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1959 for c in root.iterchildren() ] +1960 self.assertEqual("xsd:int", child_types[ 0]) +1961 self.assertEqual("xsd:string", child_types[ 1]) +1962 self.assertEqual("xsd:float", child_types[ 2]) +1963 self.assertEqual("xsd:string", child_types[ 3]) +1964 self.assertEqual("xsd:boolean", child_types[ 4]) +1965 self.assertEqual(None, child_types[ 5]) +1966 self.assertEqual(None, child_types[ 6]) +1967 self.assertEqual("xsd:double", child_types[ 7]) +1968 self.assertEqual("xsd:float", child_types[ 8]) +1969 self.assertEqual("xsd:string", child_types[ 9]) +1970 self.assertEqual("xsd:string", child_types[10]) +1971 self.assertEqual("xsd:float", child_types[11]) +1972 self.assertEqual("xsd:long", child_types[12]) +1973 self.assertEqual(None, child_types[13]) +1974 +1975 self.assertEqual("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1976 +1977 for c in root.getiterator(): +1978 self.assertEqual(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +
1979 +
1981 XML = self.XML +1982 +1983 xml = _bytes('''\ +1984 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1985 <b>5</b> +1986 <b>test</b> +1987 <c>1.1</c> +1988 <c>\uF8D2</c> +1989 <x>true</x> +1990 <n xsi:nil="true" /> +1991 <n></n> +1992 <b xsi:type="double">5</b> +1993 </a> +1994 ''') +1995 +1996 pytype_ns, pytype_name = objectify.PYTYPE_ATTRIBUTE[1:].split('}') +1997 objectify.set_pytype_attribute_tag("{TEST}test") +1998 +1999 root = XML(xml) +2000 objectify.annotate(root) +2001 +2002 attribs = root.xpath("//@py:%s" % pytype_name, +2003 namespaces={"py" : pytype_ns}) +2004 self.assertEqual(0, len(attribs)) +2005 attribs = root.xpath("//@py:test", +2006 namespaces={"py" : "TEST"}) +2007 self.assertEqual(7, len(attribs)) +2008 +2009 objectify.set_pytype_attribute_tag() +2010 pytype_ns, pytype_name = objectify.PYTYPE_ATTRIBUTE[1:].split('}') +2011 +2012 self.assertNotEqual("test", pytype_ns.lower()) +2013 self.assertNotEqual("test", pytype_name.lower()) +2014 +2015 root = XML(xml) +2016 attribs = root.xpath("//@py:%s" % pytype_name, +2017 namespaces={"py" : pytype_ns}) +2018 self.assertEqual(0, len(attribs)) +2019 +2020 objectify.annotate(root) +2021 attribs = root.xpath("//@py:%s" % pytype_name, +2022 namespaces={"py" : pytype_ns}) +2023 self.assertEqual(7, len(attribs)) +
2024 +
2025 - def test_registered_types(self): +
2026 orig_types = objectify.getRegisteredTypes() +2027 orig_types[0].unregister() +2028 self.assertEqual(orig_types[1:], objectify.getRegisteredTypes()) +2029 +2030 class NewType(objectify.ObjectifiedDataElement): +2031 pass +
2032 +2033 def checkMyType(s): +2034 return True +2035 +2036 pytype = objectify.PyType("mytype", checkMyType, NewType) +2037 self.assertTrue(pytype not in objectify.getRegisteredTypes()) +2038 pytype.register() +2039 self.assertTrue(pytype in objectify.getRegisteredTypes()) +2040 pytype.unregister() +2041 self.assertTrue(pytype not in objectify.getRegisteredTypes()) +2042 +2043 pytype.register(before = [objectify.getRegisteredTypes()[0].name]) +2044 self.assertEqual(pytype, objectify.getRegisteredTypes()[0]) +2045 pytype.unregister() +2046 +2047 pytype.register(after = [objectify.getRegisteredTypes()[0].name]) +2048 self.assertNotEqual(pytype, objectify.getRegisteredTypes()[0]) +2049 pytype.unregister() +2050 +2051 self.assertRaises(ValueError, pytype.register, +2052 before = [objectify.getRegisteredTypes()[0].name], +2053 after = [objectify.getRegisteredTypes()[1].name]) +2054 +
2056 from datetime import datetime +2057 def parse_date(value): +2058 if len(value) != 14: +2059 raise ValueError(value) +2060 Y = int(value[0:4]) +2061 M = int(value[4:6]) +2062 D = int(value[6:8]) +2063 h = int(value[8:10]) +2064 m = int(value[10:12]) +2065 s = int(value[12:14]) +2066 return datetime(Y, M, D, h, m, s) +
2067 +2068 def stringify_date(date): +2069 return date.strftime("%Y%m%d%H%M%S") +2070 +2071 class DatetimeElement(objectify.ObjectifiedDataElement): +2072 def pyval(self): +2073 return parse_date(self.text) +2074 pyval = property(pyval) +2075 +2076 datetime_type = objectify.PyType( +2077 "datetime", parse_date, DatetimeElement, stringify_date) +2078 datetime_type.xmlSchemaTypes = "dateTime" +2079 datetime_type.register() +2080 +2081 NAMESPACE = "http://foo.net/xmlns" +2082 NAMESPACE_MAP = {'ns': NAMESPACE} +2083 +2084 r = objectify.Element("{%s}root" % NAMESPACE, nsmap=NAMESPACE_MAP) +2085 time = datetime.now() +2086 r.date = time +2087 +2088 self.assertTrue(isinstance(r.date, DatetimeElement)) +2089 self.assertTrue(isinstance(r.date.pyval, datetime)) +2090 +2091 self.assertEqual(r.date.pyval, parse_date(stringify_date(time))) +2092 self.assertEqual(r.date.text, stringify_date(time)) +2093 +2094 r.date = objectify.E.date(time) +2095 +2096 self.assertTrue(isinstance(r.date, DatetimeElement)) +2097 self.assertTrue(isinstance(r.date.pyval, datetime)) +2098 +2099 self.assertEqual(r.date.pyval, parse_date(stringify_date(time))) +2100 self.assertEqual(r.date.text, stringify_date(time)) +2101 +2102 date = objectify.DataElement(time) +2103 +2104 self.assertTrue(isinstance(date, DatetimeElement)) +2105 self.assertTrue(isinstance(date.pyval, datetime)) +2106 +2107 self.assertEqual(date.pyval, parse_date(stringify_date(time))) +2108 self.assertEqual(date.text, stringify_date(time)) +2109 +
2110 - def test_object_path(self): +
2111 root = self.XML(xml_str) +2112 path = objectify.ObjectPath( "root.c1.c2" ) +2113 self.assertEqual(root.c1.c2.text, path.find(root).text) +2114 self.assertEqual(root.c1.c2.text, path(root).text) +
2115 +
2116 - def test_object_path_list(self): +
2117 root = self.XML(xml_str) +2118 path = objectify.ObjectPath( ['root', 'c1', 'c2'] ) +2119 self.assertEqual(root.c1.c2.text, path.find(root).text) +2120 self.assertEqual(root.c1.c2.text, path(root).text) +
2121 +
2122 - def test_object_path_fail(self): +
2123 root = self.XML(xml_str) +2124 path = objectify.ObjectPath( "root.c1.c99" ) +2125 self.assertRaises(AttributeError, path, root) +
2126 +
2128 root = self.XML(xml_str) +2129 path = objectify.ObjectPath( "root.c1.c99" ) +2130 self.assertEqual(None, path(root, None)) +2131 path = objectify.ObjectPath( "root.c99.c2" ) +2132 self.assertEqual(None, path(root, None)) +2133 path = objectify.ObjectPath( "notroot.c99.c2" ) +2134 self.assertEqual(None, path(root, None)) +
2135 +
2137 root = self.XML(xml_str) +2138 path = objectify.ObjectPath( ".c1.c99" ) +2139 self.assertEqual(None, path(root, None)) +2140 path = objectify.ObjectPath( ".c99.c2" ) +2141 self.assertEqual(None, path(root, None)) +
2142 +
2143 - def test_object_path_syntax(self): +
2144 root = self.XML(xml_str) +2145 path = objectify.ObjectPath("root . {objectified}c1. c2") +2146 self.assertEqual(root.c1.c2.text, path(root).text) +2147 +2148 path = objectify.ObjectPath(" root.{objectified} c1.c2 [ 0 ] ") +2149 self.assertEqual(root.c1.c2.text, path(root).text) +
2150 +
2152 self.assertRaises(ValueError, objectify.ObjectPath, "") +
2153 +
2155 self.assertRaises(ValueError, objectify.ObjectPath, []) +
2156 +
2157 - def test_object_path_hasattr(self): +
2158 root = self.XML(xml_str) +2159 path = objectify.ObjectPath( "root" ) +2160 self.assertTrue(path.hasattr(root)) +2161 path = objectify.ObjectPath( "root.c1" ) +2162 self.assertTrue(path.hasattr(root)) +2163 path = objectify.ObjectPath( "root.c1.c2" ) +2164 self.assertTrue(path.hasattr(root)) +2165 path = objectify.ObjectPath( "root.c1.{otherNS}c2" ) +2166 self.assertTrue(path.hasattr(root)) +2167 path = objectify.ObjectPath( "root.c1.c2[1]" ) +2168 self.assertTrue(path.hasattr(root)) +2169 path = objectify.ObjectPath( "root.c1.c2[2]" ) +2170 self.assertTrue(path.hasattr(root)) +2171 path = objectify.ObjectPath( "root.c1.c2[3]" ) +2172 self.assertFalse(path.hasattr(root)) +2173 path = objectify.ObjectPath( "root.c1[1].c2" ) +2174 self.assertFalse(path.hasattr(root)) +
2175 +
2176 - def test_object_path_dot(self): +
2177 root = self.XML(xml_str) +2178 path = objectify.ObjectPath( "." ) +2179 self.assertEqual(root.c1.c2.text, path(root).c1.c2.text) +
2180 +
2181 - def test_object_path_dot_list(self): +
2182 root = self.XML(xml_str) +2183 path = objectify.ObjectPath( [''] ) +2184 self.assertEqual(root.c1.c2.text, path(root).c1.c2.text) +
2185 +
2186 - def test_object_path_dot_root(self): +
2187 root = self.XML(xml_str) +2188 path = objectify.ObjectPath( ".c1.c2" ) +2189 self.assertEqual(root.c1.c2.text, path(root).text) +
2190 +
2192 root = self.XML(xml_str) +2193 path = objectify.ObjectPath( ['', 'c1', 'c2'] ) +2194 self.assertEqual(root.c1.c2.text, path(root).text) +
2195 +
2196 - def test_object_path_index(self): +
2197 root = self.XML(xml_str) +2198 path = objectify.ObjectPath( "root.c1[0].c2[0]" ) +2199 self.assertEqual(root.c1.c2.text, path(root).text) +2200 +2201 path = objectify.ObjectPath( "root.c1[0].c2" ) +2202 self.assertEqual(root.c1.c2.text, path(root).text) +2203 +2204 path = objectify.ObjectPath( "root.c1[0].c2[1]" ) +2205 self.assertEqual(root.c1.c2[1].text, path(root).text) +2206 +2207 path = objectify.ObjectPath( "root.c1.c2[2]" ) +2208 self.assertEqual(root.c1.c2[2].text, path(root).text) +2209 +2210 path = objectify.ObjectPath( "root.c1.c2[-1]" ) +2211 self.assertEqual(root.c1.c2[-1].text, path(root).text) +2212 +2213 path = objectify.ObjectPath( "root.c1.c2[-3]" ) +2214 self.assertEqual(root.c1.c2[-3].text, path(root).text) +
2215 +
2216 - def test_object_path_index_list(self): +
2217 root = self.XML(xml_str) +2218 path = objectify.ObjectPath( ['root', 'c1[0]', 'c2[0]'] ) +2219 self.assertEqual(root.c1.c2.text, path(root).text) +2220 +2221 path = objectify.ObjectPath( ['root', 'c1[0]', 'c2[2]'] ) +2222 self.assertEqual(root.c1.c2[2].text, path(root).text) +2223 +2224 path = objectify.ObjectPath( ['root', 'c1', 'c2[2]'] ) +2225 self.assertEqual(root.c1.c2[2].text, path(root).text) +2226 +2227 path = objectify.ObjectPath( ['root', 'c1', 'c2[-1]'] ) +2228 self.assertEqual(root.c1.c2[-1].text, path(root).text) +2229 +2230 path = objectify.ObjectPath( ['root', 'c1', 'c2[-3]'] ) +2231 self.assertEqual(root.c1.c2[-3].text, path(root).text) +
2232 +
2234 self.assertRaises(ValueError, objectify.ObjectPath, +2235 "root.c1[0].c2[-1-2]") +2236 self.assertRaises(ValueError, objectify.ObjectPath, +2237 ['root', 'c1[0]', 'c2[-1-2]']) +2238 +2239 self.assertRaises(ValueError, objectify.ObjectPath, +2240 "root[2].c1.c2") +2241 self.assertRaises(ValueError, objectify.ObjectPath, +2242 ['root[2]', 'c1', 'c2']) +2243 +2244 self.assertRaises(ValueError, objectify.ObjectPath, +2245 []) +2246 self.assertRaises(ValueError, objectify.ObjectPath, +2247 ['', '', '']) +
2248 +
2250 root = self.XML(xml_str) +2251 path = objectify.ObjectPath("root.c1[9999].c2") +2252 self.assertRaises(AttributeError, path, root) +2253 +2254 path = objectify.ObjectPath("root.c1[0].c2[9999]") +2255 self.assertRaises(AttributeError, path, root) +2256 +2257 path = objectify.ObjectPath(".c1[9999].c2[0]") +2258 self.assertRaises(AttributeError, path, root) +2259 +2260 path = objectify.ObjectPath("root.c1[-2].c2") +2261 self.assertRaises(AttributeError, path, root) +2262 +2263 path = objectify.ObjectPath("root.c1[0].c2[-4]") +2264 self.assertRaises(AttributeError, path, root) +
2265 +
2266 - def test_object_path_ns(self): +
2267 root = self.XML(xml_str) +2268 path = objectify.ObjectPath( "{objectified}root.c1.c2" ) +2269 self.assertEqual(root.c1.c2.text, path.find(root).text) +2270 path = objectify.ObjectPath( "{objectified}root.{objectified}c1.c2" ) +2271 self.assertEqual(root.c1.c2.text, path.find(root).text) +2272 path = objectify.ObjectPath( "root.{objectified}c1.{objectified}c2" ) +2273 self.assertEqual(root.c1.c2.text, path.find(root).text) +2274 path = objectify.ObjectPath( "root.c1.{objectified}c2" ) +2275 self.assertEqual(root.c1.c2.text, path.find(root).text) +2276 path = objectify.ObjectPath( "root.c1.{otherNS}c2" ) +2277 self.assertEqual(getattr(root.c1, '{otherNS}c2').text, +2278 path.find(root).text) +
2279 +
2280 - def test_object_path_ns_list(self): +
2281 root = self.XML(xml_str) +2282 path = objectify.ObjectPath( ['{objectified}root', 'c1', 'c2'] ) +2283 self.assertEqual(root.c1.c2.text, path.find(root).text) +2284 path = objectify.ObjectPath( ['{objectified}root', '{objectified}c1', 'c2'] ) +2285 self.assertEqual(root.c1.c2.text, path.find(root).text) +2286 path = objectify.ObjectPath( ['root', '{objectified}c1', '{objectified}c2'] ) +2287 self.assertEqual(root.c1.c2.text, path.find(root).text) +2288 path = objectify.ObjectPath( ['root', '{objectified}c1', '{objectified}c2[2]'] ) +2289 self.assertEqual(root.c1.c2[2].text, path.find(root).text) +2290 path = objectify.ObjectPath( ['root', 'c1', '{objectified}c2'] ) +2291 self.assertEqual(root.c1.c2.text, path.find(root).text) +2292 path = objectify.ObjectPath( ['root', 'c1', '{objectified}c2[2]'] ) +2293 self.assertEqual(root.c1.c2[2].text, path.find(root).text) +2294 path = objectify.ObjectPath( ['root', 'c1', '{otherNS}c2'] ) +2295 self.assertEqual(getattr(root.c1, '{otherNS}c2').text, +2296 path.find(root).text) +
2297 +
2298 - def test_object_path_set(self): +
2299 root = self.XML(xml_str) +2300 path = objectify.ObjectPath( "root.c1.c2" ) +2301 self.assertEqual(root.c1.c2.text, path.find(root).text) +2302 self.assertEqual("1", root.c1.c2[1].text) +2303 +2304 new_value = "my new value" +2305 path.setattr(root, new_value) +2306 +2307 self.assertEqual(new_value, root.c1.c2.text) +2308 self.assertEqual(new_value, path(root).text) +2309 self.assertEqual("1", root.c1.c2[1].text) +
2310 +
2312 root = self.XML(xml_str) +2313 path = objectify.ObjectPath( "root.c1.c2" ) +2314 self.assertEqual(root.c1.c2.text, path.find(root).text) +2315 self.assertEqual("1", root.c1.c2[1].text) +2316 +2317 new_el = self.Element("{objectified}test") +2318 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2319 path.setattr(root, new_el.sub) +2320 +2321 self.assertEqual("ATTR", root.c1.c2.get("myattr")) +2322 self.assertEqual("TEST", root.c1.c2.a.text) +2323 self.assertEqual("TEST", path(root).a.text) +2324 self.assertEqual("1", root.c1.c2[1].text) +
2325 +
2326 - def test_object_path_set_create(self): +
2327 root = self.XML(xml_str) +2328 path = objectify.ObjectPath( "root.c1.c99" ) +2329 self.assertRaises(AttributeError, path.find, root) +2330 +2331 new_value = "my new value" +2332 path.setattr(root, new_value) +2333 +2334 self.assertEqual(1, len(root.c1.c99)) +2335 self.assertEqual(new_value, root.c1.c99.text) +2336 self.assertEqual(new_value, path(root).text) +
2337 +
2339 root = self.XML(xml_str) +2340 path = objectify.ObjectPath( "root.c1.c99" ) +2341 self.assertRaises(AttributeError, path.find, root) +2342 +2343 new_el = self.Element("{objectified}test") +2344 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2345 path.setattr(root, new_el.sub) +2346 +2347 self.assertEqual(1, len(root.c1.c99)) +2348 self.assertEqual("ATTR", root.c1.c99.get("myattr")) +2349 self.assertEqual("TEST", root.c1.c99.a.text) +2350 self.assertEqual("TEST", path(root).a.text) +
2351 +
2353 root = self.XML(xml_str) +2354 path = objectify.ObjectPath( "root.c1.c99" ) +2355 self.assertRaises(AttributeError, path.find, root) +2356 +2357 new_el = self.Element("{objectified}test") +2358 new_el.a = ["TEST1", "TEST2"] +2359 new_el.a[0].set("myattr", "ATTR1") +2360 new_el.a[1].set("myattr", "ATTR2") +2361 +2362 path.setattr(root, list(new_el.a)) +2363 +2364 self.assertEqual(2, len(root.c1.c99)) +2365 self.assertEqual("ATTR1", root.c1.c99[0].get("myattr")) +2366 self.assertEqual("TEST1", root.c1.c99[0].text) +2367 self.assertEqual("ATTR2", root.c1.c99[1].get("myattr")) +2368 self.assertEqual("TEST2", root.c1.c99[1].text) +2369 self.assertEqual("TEST1", path(root).text) +
2370 +
2371 - def test_object_path_addattr(self): +
2372 root = self.XML(xml_str) +2373 path = objectify.ObjectPath( "root.c1.c2" ) +2374 self.assertEqual(3, len(root.c1.c2)) +2375 path.addattr(root, "test") +2376 self.assertEqual(4, len(root.c1.c2)) +2377 self.assertEqual(["0", "1", "2", "test"], +2378 [el.text for el in root.c1.c2]) +
2379 +
2381 root = self.XML(xml_str) +2382 path = objectify.ObjectPath( "root.c1.c2" ) +2383 self.assertEqual(3, len(root.c1.c2)) +2384 +2385 new_el = self.Element("{objectified}test") +2386 etree.SubElement(new_el, "{objectified}sub").a = "TEST" +2387 +2388 path.addattr(root, new_el.sub) +2389 self.assertEqual(4, len(root.c1.c2)) +2390 self.assertEqual("TEST", root.c1.c2[3].a.text) +2391 self.assertEqual(["0", "1", "2"], +2392 [el.text for el in root.c1.c2[:3]]) +
2393 +
2395 root = self.XML(xml_str) +2396 path = objectify.ObjectPath( "root.c1.c99" ) +2397 self.assertRaises(AttributeError, path.find, root) +2398 +2399 new_value = "my new value" +2400 path.addattr(root, new_value) +2401 +2402 self.assertEqual(1, len(root.c1.c99)) +2403 self.assertEqual(new_value, root.c1.c99.text) +2404 self.assertEqual(new_value, path(root).text) +
2405 +
2407 root = self.XML(xml_str) +2408 path = objectify.ObjectPath( "root.c1.c99" ) +2409 self.assertRaises(AttributeError, path.find, root) +2410 +2411 new_el = self.Element("{objectified}test") +2412 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2413 +2414 path.addattr(root, new_el.sub) +2415 self.assertEqual(1, len(root.c1.c99)) +2416 self.assertEqual("TEST", root.c1.c99.a.text) +2417 self.assertEqual("TEST", path(root).a.text) +2418 self.assertEqual("ATTR", root.c1.c99.get("myattr")) +
2419 +
2421 root = self.XML(xml_str) +2422 path = objectify.ObjectPath( "root.c1.c99" ) +2423 self.assertRaises(AttributeError, path.find, root) +2424 +2425 new_el = self.Element("{objectified}test") +2426 new_el.a = ["TEST1", "TEST2"] +2427 +2428 self.assertEqual(2, len(new_el.a)) +2429 +2430 path.addattr(root, list(new_el.a)) +2431 self.assertEqual(2, len(root.c1.c99)) +2432 self.assertEqual("TEST1", root.c1.c99.text) +2433 self.assertEqual("TEST2", path(root)[1].text) +
2434 +
2435 - def test_descendant_paths(self): +
2436 root = self.XML(xml_str) +2437 self.assertEqual( +2438 ['{objectified}root', '{objectified}root.c1', +2439 '{objectified}root.c1.c2', +2440 '{objectified}root.c1.c2[1]', '{objectified}root.c1.c2[2]', +2441 '{objectified}root.c1.{otherNS}c2', '{objectified}root.c1.{}c2'], +2442 root.descendantpaths()) +
2443 +
2444 - def test_descendant_paths_child(self): +
2445 root = self.XML(xml_str) +2446 self.assertEqual( +2447 ['{objectified}c1', '{objectified}c1.c2', +2448 '{objectified}c1.c2[1]', '{objectified}c1.c2[2]', +2449 '{objectified}c1.{otherNS}c2', '{objectified}c1.{}c2'], +2450 root.c1.descendantpaths()) +
2451 +
2453 root = self.XML(xml_str) +2454 self.assertEqual( +2455 ['root.{objectified}c1', 'root.{objectified}c1.c2', +2456 'root.{objectified}c1.c2[1]', 'root.{objectified}c1.c2[2]', +2457 'root.{objectified}c1.{otherNS}c2', +2458 'root.{objectified}c1.{}c2'], +2459 root.c1.descendantpaths('root')) +
2460 +
2461 - def test_pickle(self): +
2462 import pickle +2463 +2464 root = self.XML(xml_str) +2465 out = BytesIO() +2466 pickle.dump(root, out) +2467 +2468 new_root = pickle.loads(out.getvalue()) +2469 self.assertEqual( +2470 etree.tostring(new_root), +2471 etree.tostring(root)) +
2472 +
2473 - def test_pickle_elementtree(self): +
2474 import pickle +2475 +2476 tree = etree.ElementTree(self.XML(xml_str + "<?my pi?>")) +2477 out = BytesIO() +2478 pickle.dump(tree, out) +2479 +2480 new_tree = pickle.loads(out.getvalue()) +2481 self.assertTrue(isinstance(new_tree, etree._ElementTree)) +2482 self.assertEqual( +2483 etree.tostring(new_tree), +2484 etree.tostring(tree)) +
2485 +
2486 - def test_pickle_intelement(self): +
2487 self._test_pickle('<x>42</x>') +2488 self._test_pickle(objectify.DataElement(42)) +
2489 +
2490 - def test_pickle_floattelement(self): +
2491 self._test_pickle('<x>42.0</x>') +2492 self._test_pickle(objectify.DataElement(42.0)) +
2493 +
2494 - def test_pickle_strelement(self): +
2495 self._test_pickle('<x>Pickle me!</x>') +2496 self._test_pickle(objectify.DataElement('Pickle me!')) +
2497 +
2498 - def test_pickle_boolelement(self): +
2499 self._test_pickle('<x>true</x>') +2500 self._test_pickle('<x>false</x>') +2501 self._test_pickle(objectify.DataElement(True)) +2502 self._test_pickle(objectify.DataElement(False)) +
2503 +
2504 - def test_pickle_noneelement(self): +
2505 self._test_pickle(''' +2506 <x xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>''') +2507 self._test_pickle(objectify.DataElement(None)) +
2508 +
2509 - def _test_pickle(self, stringOrElt): +
2510 import pickle +2511 if isinstance(stringOrElt, (etree._Element, etree._ElementTree)): +2512 elt = stringOrElt +2513 else: +2514 elt = self.XML(stringOrElt) +2515 out = BytesIO() +2516 pickle.dump(elt, out) +2517 +2518 new_elt = pickle.loads(out.getvalue()) +2519 self.assertEqual( +2520 etree.tostring(new_elt), +2521 etree.tostring(elt)) +
2522 +2523 # E-Factory tests, need to use sub-elements as root element is always +2524 # type-looked-up as ObjectifiedElement (no annotations) +
2525 - def test_efactory_int(self): +
2526 E = objectify.E +2527 root = E.root(E.val(23)) +2528 self.assertTrue(isinstance(root.val, objectify.IntElement)) +
2529 +
2530 - def test_efactory_float(self): +
2531 E = objectify.E +2532 root = E.root(E.val(233.23)) +2533 self.assertTrue(isinstance(root.val, objectify.FloatElement)) +
2534 +
2535 - def test_efactory_str(self): +
2536 E = objectify.E +2537 root = E.root(E.val("what?")) +2538 self.assertTrue(isinstance(root.val, objectify.StringElement)) +
2539 +
2540 - def test_efactory_unicode(self): +
2541 E = objectify.E +2542 root = E.root(E.val(_str("blöödy häll", encoding="ISO-8859-1"))) +2543 self.assertTrue(isinstance(root.val, objectify.StringElement)) +
2544 +
2545 - def test_efactory_bool(self): +
2546 E = objectify.E +2547 root = E.root(E.val(True)) +2548 self.assertTrue(isinstance(root.val, objectify.BoolElement)) +
2549 +
2550 - def test_efactory_none(self): +
2551 E = objectify.E +2552 root = E.root(E.val(None)) +2553 self.assertTrue(isinstance(root.val, objectify.NoneElement)) +
2554 +
2556 E = objectify.E +2557 root = E.root(E.val(1, "foo", 2.0, "bar ", True, None)) +2558 self.assertTrue(isinstance(root.val, objectify.StringElement)) +
2559 +
2560 - def test_efactory_attrib(self): +
2561 E = objectify.E +2562 root = E.root(foo="bar") +2563 self.assertEqual(root.get("foo"), "bar") +
2564 +
2565 - def test_efactory_nested(self): +
2566 E = objectify.E +2567 DataElement = objectify.DataElement +2568 root = E.root("text", E.sub(E.subsub()), "tail", DataElement(1), +2569 DataElement(2.0)) +2570 self.assertTrue(isinstance(root, objectify.ObjectifiedElement)) +2571 self.assertEqual(root.text, "text") +2572 self.assertTrue(isinstance(root.sub, objectify.ObjectifiedElement)) +2573 self.assertEqual(root.sub.tail, "tail") +2574 self.assertTrue(isinstance(root.sub.subsub, objectify.StringElement)) +2575 self.assertEqual(len(root.value), 2) +2576 self.assertTrue(isinstance(root.value[0], objectify.IntElement)) +2577 self.assertTrue(isinstance(root.value[1], objectify.FloatElement)) +
2578 +
2579 - def test_efactory_subtype(self): +
2580 class Attribute(objectify.ObjectifiedDataElement): +2581 def __init__(self): +2582 objectify.ObjectifiedDataElement.__init__(self) +2583 self.set("datatype", "TYPE") +2584 self.set("range", "0.,1.") +
2585 +2586 attr = Attribute() +2587 self.assertEqual(attr.text, None) +2588 self.assertEqual(attr.get("datatype"), "TYPE") +2589 self.assertEqual(attr.get("range"), "0.,1.") +2590 +
2591 - def test_XML_base_url_docinfo(self): +
2592 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2593 docinfo = root.getroottree().docinfo +2594 self.assertEqual(docinfo.URL, "http://no/such/url") +
2595 +
2597 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2598 docinfo = root.getroottree().docinfo +2599 self.assertEqual(docinfo.URL, "http://no/such/url") +2600 docinfo.URL = "https://secret/url" +2601 self.assertEqual(docinfo.URL, "https://secret/url") +
2602 +
2604 tree = objectify.parse(BytesIO("<root/>"), base_url="http://no/such/url") +2605 docinfo = tree.docinfo +2606 self.assertEqual(docinfo.URL, "http://no/such/url") +
2607 +
2608 - def test_parse_base_url_docinfo(self): +
2609 tree = objectify.parse(fileInTestDir('include/test_xinclude.xml'), +2610 base_url="http://no/such/url") +2611 docinfo = tree.docinfo +2612 self.assertEqual(docinfo.URL, "http://no/such/url") +
2613 +
2614 - def test_xml_base(self): +
2615 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2616 self.assertEqual(root.base, "http://no/such/url") +2617 self.assertEqual( +2618 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2619 root.base = "https://secret/url" +2620 self.assertEqual(root.base, "https://secret/url") +2621 self.assertEqual( +2622 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2623 "https://secret/url") +
2624 +
2625 - def test_xml_base_attribute(self): +
2626 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2627 self.assertEqual(root.base, "http://no/such/url") +2628 self.assertEqual( +2629 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2630 root.set('{http://www.w3.org/XML/1998/namespace}base', +2631 "https://secret/url") +2632 self.assertEqual(root.base, "https://secret/url") +2633 self.assertEqual( +2634 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2635 "https://secret/url") +
2636 +
2637 - def test_standard_lookup(self): +
2638 XML = self.XML +2639 +2640 xml = _bytes('''\ +2641 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +2642 <i>5</i> +2643 <i>-5</i> +2644 <l>4294967296</l> +2645 <l>-4294967296</l> +2646 <f>1.1</f> +2647 <b>true</b> +2648 <b>false</b> +2649 <s>Strange things happen, where strings collide</s> +2650 <s>True</s> +2651 <s>False</s> +2652 <s>t</s> +2653 <s>f</s> +2654 <s></s> +2655 <s>None</s> +2656 <n xsi:nil="true" /> +2657 </root> +2658 ''') +2659 root = XML(xml) +2660 +2661 for i in root.i: +2662 self.assertTrue(isinstance(i, objectify.IntElement)) +2663 for l in root.l: +2664 self.assertTrue(isinstance(l, objectify.IntElement)) +2665 for f in root.f: +2666 self.assertTrue(isinstance(f, objectify.FloatElement)) +2667 for b in root.b: +2668 self.assertTrue(isinstance(b, objectify.BoolElement)) +2669 self.assertEqual(True, root.b[0]) +2670 self.assertEqual(False, root.b[1]) +2671 for s in root.s: +2672 self.assertTrue(isinstance(s, objectify.StringElement)) +2673 self.assertTrue(isinstance(root.n, objectify.NoneElement)) +2674 self.assertEqual(None, root.n) +
2675 +
2676 -def test_suite(): +
2677 suite = unittest.TestSuite() +2678 suite.addTests([unittest.makeSuite(ObjectifyTestCase)]) +2679 suite.addTests(doctest.DocTestSuite(objectify)) +2680 suite.addTests([make_doctest('../../../doc/objectify.txt')]) +2681 return suite +
2682 +2683 if __name__ == '__main__': +2684 print('to test use test.py %s' % __file__) +2685 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..ec344958 --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify.ObjectifyTestCase-class.html @@ -0,0 +1,3688 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ObjectifyTestCase
+
+ +
+Test cases for lxml.objectify + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_date_element_efactory_text(self) + source code + +
+ +
+   + + + + + + +
test_date_element_efactory_tail(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_data_element_element_arg(self) + source code + +
+ +
+   + + + + + + +
test_root(self) + source code + +
+ +
+   + + + + + + +
test_str(self) + source code + +
+ +
+   + + + + + + +
test_child(self) + source code + +
+ +
+   + + + + + + +
test_child_ns_nons(self) + source code + +
+ +
+   + + + + + + +
test_countchildren(self) + source code + +
+ +
+   + + + + + + +
test_child_getattr(self) + source code + +
+ +
+   + + + + + + +
test_child_nonexistant(self) + source code + +
+ +
+   + + + + + + +
test_child_getattr_empty_ns(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_setitem_index(self) + source code + +
+ +
+   + + + + + + +
test_delitem_index(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_hash(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_data_element_int_hash(self) + source code + +
+ +
+   + + + + + + +
test_type_float(self) + source code + +
+ +
+   + + + + + + +
test_data_element_float(self) + source code + +
+ +
+   + + + + + + +
test_data_element_float_hash(self) + source code + +
+ +
+   + + + + + + +
test_type_float_precision(self) + source code + +
+ +
+   + + + + + + +
test_type_float_instantiation_precision(self) + source code + +
+ +
+   + + + + + + +
test_type_float_precision_consistency(self) + source code + +
+ +
+   + + + + + + +
test_data_element_float_precision(self) + source code + +
+ +
+   + + + + + + +
test_data_element_float_hash_repr(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_pickle_intelement(self) + source code + +
+ +
+   + + + + + + +
test_pickle_floattelement(self) + source code + +
+ +
+   + + + + + + +
test_pickle_strelement(self) + source code + +
+ +
+   + + + + + + +
test_pickle_boolelement(self) + source code + +
+ +
+   + + + + + + +
test_pickle_noneelement(self) + source code + +
+ +
+   + + + + + + +
_test_pickle(self, + stringOrElt) + 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_efactory_subtype(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.case.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 00000000..ae9116a9 --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup-module.html @@ -0,0 +1,288 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + xml_str = '<obj:root xmlns:obj="objectified" xmlns:other="othe... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..862ef72b --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup-pysrc.html @@ -0,0 +1,944 @@ + + + + + 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, 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.assertEqual(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.assertNotEqual(None, el_class.EL) + 79 self.assertRaises(ReferenceError, 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.assertNotEqual(None, root.TAG) + 91 self.assertEqual(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.assertNotEqual(None, root.TEXT) +103 self.assertEqual(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.assertEqual(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.assertEqual(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.assertEqual(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.assertEqual(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.assertNotEqual(None, child_tag) +163 self.assertEqual(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.assertNotEqual(None, child_tag) +176 self.assertEqual(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.assertNotEqual(None, child_tags) +189 self.assertEqual([ 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.assertEqual(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.assertTrue(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.assertNotEqual(None, el_class.VAL) +224 self.assertEqual(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.assertEqual(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.assertNotEqual(None, child_tags) +249 self.assertEqual([ 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.assertNotEqual(None, child_tags) +263 self.assertEqual([ 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.assertNotEqual(None, child_tags) +277 self.assertEqual([ 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.assertNotEqual(None, child_tags) +293 self.assertEqual([], child_tags) +294 +295 c1 = root[0] +296 child_tags = root.CHILD_TAGS +297 self.assertNotEqual(None, child_tags) +298 self.assertNotEqual([], child_tags) +299 self.assertEqual( +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.assertEqual(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.assertNotEqual(None, el_class.NEXT) +324 self.assertEqual(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.assertNotEqual(None, el_class.PREV) +336 self.assertEqual(root[0][1].getprevious().tag, el_class.PREV) +337 +
338 - def test_comments_fallback(self): +
339 def return_none(*args): +340 return None +
341 +342 self._setClassLookup(return_none) +343 el = self.XML('<a><!-- hello world --></a>') +344 self.assertEqual(el[0].tag, self.etree.Comment) +345 self.assertEqual(el[0].text, " hello world ") +346 +347 +
348 -def test_suite(): +
349 suite = unittest.TestSuite() +350 suite.addTests([unittest.makeSuite(PyClassLookupTestCase)]) +351 return suite +
352 +353 if __name__ == '__main__': +354 print('to test use test.py %s' % __file__) +355 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..95f00b6e --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html @@ -0,0 +1,893 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               PyClassLookupTestCase
+
+ +
+Test cases for the lxml.pyclasslookup class lookup mechanism. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
Element(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with this parser.
+ + +
+ +
+   + + + + + + +
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 + +
+ +
+   + + + + + + +
test_comments_fallback(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+   + + parser = <lxml.etree.XMLParser object> +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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.case.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 00000000..aeb82f71 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng-module.html @@ -0,0 +1,261 @@ + + + + + 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 +
+   + + RelaxNGCompactTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + rnc2rng = None
+ hash(x) +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..8c0d1561 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng-pysrc.html @@ -0,0 +1,828 @@ + + + + + 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, skipif 
+ 15   
+ 16  try: 
+ 17      import rnc2rng 
+ 18  except ImportError: 
+ 19      rnc2rng = None 
+ 20   
+ 21   
+
22 -class ETreeRelaxNGTestCase(HelperTestCase): +
23 - def test_relaxng(self): +
24 tree_valid = self.parse('<a><b></b></a>') + 25 tree_invalid = self.parse('<a><c></c></a>') + 26 schema = self.parse('''\ + 27 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 28 <zeroOrMore> + 29 <element name="b"> + 30 <text /> + 31 </element> + 32 </zeroOrMore> + 33 </element> + 34 ''') + 35 schema = etree.RelaxNG(schema) + 36 self.assertTrue(schema.validate(tree_valid)) + 37 self.assertFalse(schema.error_log.filter_from_errors()) + 38 + 39 self.assertFalse(schema.validate(tree_invalid)) + 40 self.assertTrue(schema.error_log.filter_from_errors()) + 41 + 42 self.assertTrue(schema.validate(tree_valid)) # repeat valid + 43 self.assertFalse(schema.error_log.filter_from_errors()) # repeat valid +
44 +
45 - def test_relaxng_stringio(self): +
46 tree_valid = self.parse('<a><b></b></a>') + 47 tree_invalid = self.parse('<a><c></c></a>') + 48 schema_file = BytesIO('''\ + 49 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 50 <zeroOrMore> + 51 <element name="b"> + 52 <text /> + 53 </element> + 54 </zeroOrMore> + 55 </element> + 56 ''') + 57 schema = etree.RelaxNG(file=schema_file) + 58 self.assertTrue(schema.validate(tree_valid)) + 59 self.assertFalse(schema.validate(tree_invalid)) +
60 +
62 self.assertRaises(ValueError, etree.RelaxNG, etree.ElementTree()) +
63 +
64 - def test_relaxng_error(self): +
65 tree_invalid = self.parse('<a><c></c></a>') + 66 schema = self.parse('''\ + 67 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 68 <zeroOrMore> + 69 <element name="b"> + 70 <text /> + 71 </element> + 72 </zeroOrMore> + 73 </element> + 74 ''') + 75 schema = etree.RelaxNG(schema) + 76 self.assertFalse(schema.validate(tree_invalid)) + 77 errors = schema.error_log + 78 self.assertTrue([log for log in errors + 79 if log.level_name == "ERROR"]) + 80 self.assertTrue([log for log in errors + 81 if "not expect" in log.message]) +
82 +
83 - def test_relaxng_generic_error(self): +
84 tree_invalid = self.parse('''\ + 85 <test> + 86 <reference id="my-ref">This is my unique ref.</reference> + 87 <data ref="my-ref">Valid data</data> + 88 <data ref="myref">Invalid data</data> + 89 </test> + 90 ''') + 91 schema = self.parse('''\ + 92 <grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" + 93 xmlns="http://relaxng.org/ns/structure/1.0"> + 94 <define name="by-ref"> + 95 <data type="IDREF"/> + 96 </define> + 97 <start> + 98 <element name="test"> + 99 <zeroOrMore> +100 <element name="reference"> +101 <attribute name="id"> +102 <data type="ID"/> +103 </attribute> +104 <text/> +105 </element> +106 </zeroOrMore> +107 <zeroOrMore> +108 <element name="data"> +109 <attribute name="ref"> +110 <data type="IDREF"/> +111 </attribute> +112 <text/> +113 </element> +114 </zeroOrMore> +115 </element> +116 </start> +117 </grammar> +118 ''') +119 +120 schema = etree.RelaxNG(schema) +121 self.assertFalse(schema.validate(tree_invalid)) +122 errors = schema.error_log +123 self.assertTrue(errors) +124 self.assertTrue([log for log in errors if "IDREF" in log.message]) +125 self.assertTrue([log for log in errors if "myref" in log.message]) +
126 +
128 schema = self.parse('''\ +129 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> +130 <zeroOrMore> +131 <element name="b" /> +132 </zeroOrMore> +133 </element> +134 ''') +135 self.assertRaises(etree.RelaxNGParseError, +136 etree.RelaxNG, schema) +
137 +
139 schema = self.parse('''\ +140 <grammar xmlns="http://relaxng.org/ns/structure/1.0" /> +141 ''') +142 self.assertRaises(etree.RelaxNGParseError, +143 etree.RelaxNG, schema) +
144 +
146 schema = self.parse('''\ +147 <grammar xmlns="http://relaxng.org/ns/structure/1.0"> +148 <define name="test"> +149 <element name="test"/> +150 </define> +151 </grammar> +152 ''') +153 self.assertRaises(etree.RelaxNGParseError, +154 etree.RelaxNG, schema) +
155 +
157 # segfault +158 schema = self.parse('''\ +159 <element name="a" xmlns="mynamespace" /> +160 ''') +161 self.assertRaises(etree.RelaxNGParseError, +162 etree.RelaxNG, schema) +
163 +
164 - def test_relaxng_include(self): +
165 # this will only work if we access the file through path or +166 # file object.. +167 f = open(fileInTestDir('test1.rng'), 'rb') +168 try: +169 schema = etree.RelaxNG(file=f) +170 finally: +171 f.close() +
172 +
173 - def test_relaxng_shortcut(self): +
174 tree_valid = self.parse('<a><b></b></a>') +175 tree_invalid = self.parse('<a><c></c></a>') +176 schema = self.parse('''\ +177 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> +178 <zeroOrMore> +179 <element name="b"> +180 <text /> +181 </element> +182 </zeroOrMore> +183 </element> +184 ''') +185 self.assertTrue(tree_valid.relaxng(schema)) +186 self.assertFalse(tree_invalid.relaxng(schema)) +
187 +
188 - def test_multiple_elementrees(self): +
189 tree = self.parse('<a><b>B</b><c>C</c></a>') +190 schema = etree.RelaxNG( self.parse('''\ +191 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> +192 <element name="b"> +193 <text /> +194 </element> +195 <element name="c"> +196 <text /> +197 </element> +198 </element> +199 ''') ) +200 self.assertTrue(schema.validate(tree)) +201 self.assertFalse(schema.error_log.filter_from_errors()) +202 +203 self.assertTrue(schema.validate(tree)) # repeat valid +204 self.assertFalse(schema.error_log.filter_from_errors()) # repeat valid +205 +206 schema = etree.RelaxNG( self.parse('''\ +207 <element name="b" xmlns="http://relaxng.org/ns/structure/1.0"> +208 <text /> +209 </element> +210 ''') ) +211 c_tree = etree.ElementTree(tree.getroot()[1]) +212 self.assertEqual(self._rootstring(c_tree), _bytes('<c>C</c>')) +213 self.assertFalse(schema.validate(c_tree)) +214 self.assertTrue(schema.error_log.filter_from_errors()) +215 +216 b_tree = etree.ElementTree(tree.getroot()[0]) +217 self.assertEqual(self._rootstring(b_tree), _bytes('<b>B</b>')) +218 self.assertTrue(schema.validate(b_tree)) +219 self.assertFalse(schema.error_log.filter_from_errors()) +
220 +221 +
222 -class RelaxNGCompactTestCase(HelperTestCase): +
223 +224 pytestmark = skipif('rnc2rng is None') +225 +
226 - def test_relaxng_compact(self): +
227 tree_valid = self.parse('<a><b>B</b><c>C</c></a>') +228 tree_invalid = self.parse('<a><b></b></a>') +229 schema = etree.RelaxNG(file=fileInTestDir('test.rnc')) +230 self.assertTrue(schema.validate(tree_valid)) +231 self.assertFalse(schema.validate(tree_invalid)) +
232 +
234 with open(fileInTestDir('test.rnc'), 'r') as f: +235 schema = etree.RelaxNG(file=f) +236 +237 tree_valid = self.parse('<a><b>B</b><c>C</c></a>') +238 tree_invalid = self.parse('<a><b></b></a>') +239 self.assertTrue(schema.validate(tree_valid)) +240 self.assertFalse(schema.validate(tree_invalid)) +
241 +
242 - def test_relaxng_compact_str(self): +
243 tree_valid = self.parse('<a><b>B</b></a>') +244 tree_invalid = self.parse('<a><b>X</b></a>') +245 rnc_str = 'element a { element b { "B" } }' +246 schema = etree.RelaxNG.from_rnc_string(rnc_str) +247 self.assertTrue(schema.validate(tree_valid)) +248 self.assertFalse(schema.validate(tree_invalid)) +
249 +250 +
251 -def test_suite(): +
252 suite = unittest.TestSuite() +253 suite.addTests([unittest.makeSuite(ETreeRelaxNGTestCase)]) +254 suite.addTests( +255 [make_doctest('../../../doc/validation.txt')]) +256 if rnc2rng is not None: +257 suite.addTests([unittest.makeSuite(RelaxNGCompactTestCase)]) +258 return suite +
259 +260 if __name__ == '__main__': +261 print('to test use test.py %s' % __file__) +262 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..812c6f37 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html @@ -0,0 +1,537 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeRelaxNGTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_generic_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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html b/doc/html/api/lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html new file mode 100644 index 00000000..08e237fa --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html @@ -0,0 +1,400 @@ + + + + + lxml.tests.test_relaxng.RelaxNGCompactTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_relaxng :: + Class RelaxNGCompactTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGCompactTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               RelaxNGCompactTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_relaxng_compact(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_compact_file_obj(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_compact_str(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + pytestmark = <lxml.tests.common_imports.skipif object> +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..bdca42b3 --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax-module.html @@ -0,0 +1,262 @@ + + + + + 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 +
+   + + SimpleContentHandler
+ A SAX content handler that just stores the events +
+   + + NSPrefixSaxTestCase
+ Testing that namespaces generate the right SAX events +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..56e6bf53 --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax-pysrc.html @@ -0,0 +1,1025 @@ + + + + + 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, make_doctest, BytesIO, _bytes 
+ 14  from lxml import sax 
+ 15  from xml.dom import pulldom 
+ 16  from xml.sax.handler import ContentHandler 
+ 17   
+ 18   
+
19 -class ETreeSaxTestCase(HelperTestCase): +
20 +
21 - def test_etree_sax_simple(self): +
22 tree = self.parse('<a>ab<b/>ba</a>') + 23 xml_out = self._saxify_serialize(tree) + 24 self.assertEqual(_bytes('<a>ab<b/>ba</a>'), + 25 xml_out) +
26 +
27 - def test_etree_sax_double(self): +
28 tree = self.parse('<a>ab<b>bb</b>ba</a>') + 29 xml_out = self._saxify_serialize(tree) + 30 self.assertEqual(_bytes('<a>ab<b>bb</b>ba</a>'), + 31 xml_out) +
32 +
33 - def test_etree_sax_comment(self): +
34 tree = self.parse('<a>ab<!-- TEST -->ba</a>') + 35 xml_out = self._saxify_serialize(tree) + 36 self.assertEqual(_bytes('<a>abba</a>'), + 37 xml_out) +
38 +
39 - def test_etree_sax_pi(self): +
40 tree = self.parse('<a>ab<?this and that?>ba</a>') + 41 xml_out = self._saxify_serialize(tree) + 42 self.assertEqual(_bytes('<a>ab<?this and that?>ba</a>'), + 43 xml_out) +
44 +
46 tree = self.parse('<!-- TEST --><a>ab</a>') + 47 xml_out = self._saxify_serialize(tree) + 48 self.assertEqual(_bytes('<a>ab</a>'), + 49 xml_out) +
50 +
51 - def test_etree_sax_pi_root(self): +
52 tree = self.parse('<?this and that?><a>ab</a>') + 53 xml_out = self._saxify_serialize(tree) + 54 self.assertEqual(_bytes('<?this and that?><a>ab</a>'), + 55 xml_out) +
56 +
57 - def test_etree_sax_attributes(self): +
58 tree = self.parse('<a aa="5">ab<b b="5"/>ba</a>') + 59 xml_out = self._saxify_serialize(tree) + 60 self.assertEqual(_bytes('<a aa="5">ab<b b="5"/>ba</a>'), + 61 xml_out) +
62 +
63 - def test_etree_sax_ns1(self): +
64 tree = self.parse('<a xmlns="bla">ab<b>bb</b>ba</a>') + 65 new_tree = self._saxify_unsaxify(tree) + 66 root = new_tree.getroot() + 67 self.assertEqual('{bla}a', + 68 root.tag) + 69 self.assertEqual('{bla}b', + 70 root[0].tag) +
71 +
72 - def test_etree_sax_ns2(self): +
73 tree = self.parse('<a xmlns="blaA">ab<b:b xmlns:b="blaB">bb</b:b>ba</a>') + 74 new_tree = self._saxify_unsaxify(tree) + 75 root = new_tree.getroot() + 76 self.assertEqual('{blaA}a', + 77 root.tag) + 78 self.assertEqual('{blaB}b', + 79 root[0].tag) +
80 +
81 - def test_sax_to_pulldom(self): +
82 tree = self.parse('<a xmlns="blaA">ab<b:b xmlns:b="blaB">bb</b:b>ba</a>') + 83 handler = pulldom.SAX2DOM() + 84 sax.saxify(tree, handler) + 85 dom = handler.document + 86 + 87 self.assertEqual('a', + 88 dom.firstChild.localName) + 89 self.assertEqual('blaA', + 90 dom.firstChild.namespaceURI) + 91 self.assertEqual(None, + 92 dom.firstChild.prefix) + 93 + 94 children = dom.firstChild.childNodes + 95 self.assertEqual('ab', + 96 children[0].nodeValue) + 97 self.assertEqual('blaB', + 98 children[1].namespaceURI) + 99 self.assertEqual('ba', +100 children[2].nodeValue) +
101 +
103 tree = self.parse('<a xmlns="blaA" xmlns:a="blaA"></a>') +104 handler = pulldom.SAX2DOM() +105 sax.saxify(tree, handler) +106 dom = handler.document +107 +108 # With multiple prefix definitions, the node should keep the one +109 # that was actually used, even if the others also are valid. +110 self.assertEqual('a', +111 dom.firstChild.localName) +112 self.assertEqual('blaA', +113 dom.firstChild.namespaceURI) +114 self.assertEqual(None, +115 dom.firstChild.prefix) +116 +117 tree = self.parse('<a:a xmlns="blaA" xmlns:a="blaA"></a:a>') +118 handler = pulldom.SAX2DOM() +119 sax.saxify(tree, handler) +120 dom = handler.document +121 +122 self.assertEqual('a', +123 dom.firstChild.localName) +124 self.assertEqual('blaA', +125 dom.firstChild.namespaceURI) +126 self.assertEqual('a', +127 dom.firstChild.prefix) +
128 +
129 - def test_element_sax(self): +
130 tree = self.parse('<a><b/></a>') +131 a = tree.getroot() +132 b = a[0] +133 +134 xml_out = self._saxify_serialize(a) +135 self.assertEqual(_bytes('<a><b/></a>'), +136 xml_out) +137 +138 xml_out = self._saxify_serialize(b) +139 self.assertEqual(_bytes('<b/>'), +140 xml_out) +
141 +
142 - def test_element_sax_ns(self): +
143 tree = self.parse('<a:a xmlns:a="blaA"><b/></a:a>') +144 a = tree.getroot() +145 b = a[0] +146 +147 new_tree = self._saxify_unsaxify(a) +148 root = new_tree.getroot() +149 self.assertEqual('{blaA}a', +150 root.tag) +151 self.assertEqual('b', +152 root[0].tag) +153 +154 new_tree = self._saxify_unsaxify(b) +155 root = new_tree.getroot() +156 self.assertEqual('b', +157 root.tag) +158 self.assertEqual(0, +159 len(root)) +
160 +
162 handler = sax.ElementTreeContentHandler() +163 handler.startDocument() +164 handler.startPrefixMapping(None, 'blaA') +165 handler.startElementNS(('blaA', 'a'), 'a', {}) +166 handler.startPrefixMapping(None, 'blaB') +167 handler.startElementNS(('blaB', 'b'), 'b', {}) +168 handler.endElementNS( ('blaB', 'b'), 'b') +169 handler.endPrefixMapping(None) +170 handler.startElementNS(('blaA', 'c'), 'c', {}) +171 handler.endElementNS( ('blaA', 'c'), 'c') +172 handler.endElementNS( ('blaA', 'a'), 'a') +173 handler.endPrefixMapping(None) +174 handler.endDocument() +175 +176 new_tree = handler.etree +177 root = new_tree.getroot() +178 self.assertEqual('{blaA}a', +179 root.tag) +180 self.assertEqual('{blaB}b', +181 root[0].tag) +182 self.assertEqual('{blaA}c', +183 root[1].tag) +
184 +
186 handler = sax.ElementTreeContentHandler() +187 handler.startDocument() +188 handler.startPrefixMapping(None, 'blaA') +189 handler.startElementNS((None, 'a'), 'a', {}) +190 handler.startPrefixMapping(None, 'blaB') +191 handler.startElementNS((None, 'b'), 'b', {}) +192 handler.endElementNS( (None, 'b'), 'b') +193 handler.endPrefixMapping(None) +194 handler.startElementNS((None, 'c'), 'c', {}) +195 handler.endElementNS( (None, 'c'), 'c') +196 handler.endElementNS( (None, 'a'), 'a') +197 handler.endPrefixMapping(None) +198 handler.endDocument() +199 +200 new_tree = handler.etree +201 root = new_tree.getroot() +202 self.assertEqual('{blaA}a', +203 root.tag) +204 self.assertEqual('{blaB}b', +205 root[0].tag) +206 self.assertEqual('{blaA}c', +207 root[1].tag) +
208 +
209 - def test_etree_sax_redefine_ns(self): +
210 handler = sax.ElementTreeContentHandler() +211 handler.startDocument() +212 handler.startPrefixMapping('ns', 'blaA') +213 handler.startElementNS(('blaA', 'a'), 'ns:a', {}) +214 handler.startPrefixMapping('ns', 'blaB') +215 handler.startElementNS(('blaB', 'b'), 'ns:b', {}) +216 handler.endElementNS( ('blaB', 'b'), 'ns:b') +217 handler.endPrefixMapping('ns') +218 handler.startElementNS(('blaA', 'c'), 'ns:c', {}) +219 handler.endElementNS( ('blaA', 'c'), 'ns:c') +220 handler.endElementNS( ('blaA', 'a'), 'ns:a') +221 handler.endPrefixMapping('ns') +222 handler.endDocument() +223 +224 new_tree = handler.etree +225 root = new_tree.getroot() +226 self.assertEqual('{blaA}a', +227 root.tag) +228 self.assertEqual('{blaB}b', +229 root[0].tag) +230 self.assertEqual('{blaA}c', +231 root[1].tag) +
232 +
233 - def test_etree_sax_no_ns(self): +
234 handler = sax.ElementTreeContentHandler() +235 handler.startDocument() +236 handler.startElement('a', {}) +237 handler.startElement('b', {}) +238 handler.endElement('b') +239 handler.startElement('c') # with empty attributes +240 handler.endElement('c') +241 handler.endElement('a') +242 handler.endDocument() +243 +244 new_tree = handler.etree +245 root = new_tree.getroot() +246 self.assertEqual('a', root.tag) +247 self.assertEqual('b', root[0].tag) +248 self.assertEqual('c', root[1].tag) +
249 +
251 handler = sax.ElementTreeContentHandler() +252 handler.startDocument() +253 handler.startElement('a', {"attr_a1": "a1"}) +254 handler.startElement('b', {"attr_b1": "b1"}) +255 handler.endElement('b') +256 handler.endElement('a') +257 handler.endDocument() +258 +259 new_tree = handler.etree +260 root = new_tree.getroot() +261 self.assertEqual('a', root.tag) +262 self.assertEqual('b', root[0].tag) +263 self.assertEqual('a1', root.attrib["attr_a1"]) +264 self.assertEqual('b1', root[0].attrib["attr_b1"]) +
265 +
267 handler = sax.ElementTreeContentHandler() +268 handler.startDocument() +269 +270 self.assertRaises(ValueError, +271 handler.startElement, +272 'a', {"blaA:attr_a1": "a1"} +273 ) +
274 +
275 - def test_etree_sax_error(self): +
276 handler = sax.ElementTreeContentHandler() +277 handler.startDocument() +278 handler.startElement('a') +279 self.assertRaises(sax.SaxError, handler.endElement, 'b') +
280 +
281 - def test_etree_sax_error2(self): +
282 handler = sax.ElementTreeContentHandler() +283 handler.startDocument() +284 handler.startElement('a') +285 handler.startElement('b') +286 self.assertRaises(sax.SaxError, handler.endElement, 'a') +
287 +
288 - def _saxify_unsaxify(self, saxifiable): +
289 handler = sax.ElementTreeContentHandler() +290 sax.ElementTreeProducer(saxifiable, handler).saxify() +291 return handler.etree +
292 +
293 - def _saxify_serialize(self, tree): +
294 new_tree = self._saxify_unsaxify(tree) +295 f = BytesIO() +296 new_tree.write(f) +297 return f.getvalue().replace(_bytes('\n'), _bytes('')) +
298 +299 +
300 -class SimpleContentHandler(ContentHandler, object): +
301 """A SAX content handler that just stores the events""" +302 +
303 - def __init__(self): +
304 self.sax_events = [] +305 super(SimpleContentHandler, self).__init__() +
306 +
307 - def startDocument(self): +
308 self.sax_events.append(('startDocument',)) +
309 +
310 - def endDocument(self): +
311 self.sax_events.append(('endDocument',)) +
312 +
313 - def startPrefixMapping(self, prefix, uri): +
314 self.sax_events.append(('startPrefixMapping', prefix, uri)) +
315 +
316 - def endPrefixMapping(self, prefix): +
317 self.sax_events.append(('endPrefixMapping', prefix)) +
318 +
319 - def startElement(self, name, attrs): +
320 self.sax_events.append(('startElement', name, dict(attrs))) +
321 +
322 - def endElement(self, name): +
323 self.sax_events.append(('endElement', name)) +
324 +
325 - def startElementNS(self, name, qname, attrs): +
326 self.sax_events.append(('startElementNS', name, qname, attrs._qnames)) +
327 +
328 - def endElementNS(self, name, qname): +
329 self.sax_events.append(('endElementNS', name, qname)) +
330 +
331 - def characters(self, content): +
332 self.sax_events.append(('characters', content)) +
333 +
334 - def ignorableWhitespace(self, whitespace): +
335 self.sax_events.append(('ignorableWhitespace', whitespace)) +
336 +
337 - def processingInstruction(self, target, data): +
338 self.sax_events.append(('processingInstruction', target, data)) +
339 +
340 - def skippedEntity(self, name): +
341 self.sax_events.append(('skippedEntity', name)) +
342 +343 +
344 -class NSPrefixSaxTestCase(HelperTestCase): +
345 """Testing that namespaces generate the right SAX events""" +346 +
347 - def _saxify(self, tree): +
348 handler = SimpleContentHandler() +349 sax.ElementTreeProducer(tree, handler).saxify() +350 return handler.sax_events +
351 +
352 - def test_element_sax_ns_prefix(self): +
353 # The name of the prefix should be preserved, if the uri is unique +354 tree = self.parse('<a:a xmlns:a="blaA" xmlns:c="blaC">' +355 '<d a:attr="value" c:attr="value" /></a:a>') +356 a = tree.getroot() +357 +358 self.assertEqual( +359 [('startElementNS', ('blaA', 'a'), 'a:a', {}), +360 ('startElementNS', (None, 'd'), 'd', +361 {('blaA', 'attr'): 'a:attr', ('blaC', 'attr'): 'c:attr'}), +362 ('endElementNS', (None, 'd'), 'd'), +363 ('endElementNS', ('blaA', 'a'), 'a:a'), +364 ], +365 self._saxify(a)[3:7]) +
366 +
368 # Default prefixes should also not get a generated prefix +369 tree = self.parse('<a xmlns="blaA"><b attr="value" /></a>') +370 a = tree.getroot() +371 +372 self.assertEqual( +373 [('startDocument',), +374 # NS prefix should be None: +375 ('startPrefixMapping', None, 'blaA'), +376 ('startElementNS', ('blaA', 'a'), 'a', {}), +377 # Attribute prefix should be None: +378 ('startElementNS', ('blaA', 'b'), 'b', {(None, 'attr'): 'attr'}), +379 ('endElementNS', ('blaA', 'b'), 'b'), +380 ('endElementNS', ('blaA', 'a'), 'a'), +381 # Prefix should be None again: +382 ('endPrefixMapping', None), +383 ('endDocument',)], +384 self._saxify(a)) +385 +386 # Except for attributes, if there is both a default namespace +387 # and a named namespace with the same uri +388 tree = self.parse('<a xmlns="bla" xmlns:a="bla">' +389 '<b a:attr="value" /></a>') +390 a = tree.getroot() +391 +392 self.assertEqual( +393 ('startElementNS', ('bla', 'b'), 'b', {('bla', 'attr'): 'a:attr'}), +394 self._saxify(a)[4]) +
395 +
397 # Make an element with an doubly registered uri +398 tree = self.parse('<a xmlns:b="bla" xmlns:c="bla">' +399 '<d c:attr="attr" /></a>') +400 a = tree.getroot() +401 +402 self.assertEqual( +403 # It should get the b prefix in this case +404 ('startElementNS', (None, 'd'), 'd', {('bla', 'attr'): 'b:attr'}), +405 self._saxify(a)[4]) +
406 +407 +
408 -def test_suite(): +
409 suite = unittest.TestSuite() +410 suite.addTests([unittest.makeSuite(ETreeSaxTestCase)]) +411 suite.addTests([unittest.makeSuite(NSPrefixSaxTestCase)]) +412 suite.addTests( +413 [make_doctest('../../../doc/sax.txt')]) +414 return suite +
415 +416 +417 if __name__ == '__main__': +418 print('to test use test.py %s' % __file__) +419 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..6754af9d --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax.ETreeSaxTestCase-class.html @@ -0,0 +1,715 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeSaxTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_sax_to_pulldom_multiple_namespaces(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_handler_default_ns_None(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_redefine_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_no_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_no_ns_attributes(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_ns_attributes(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_sax.NSPrefixSaxTestCase-class.html b/doc/html/api/lxml.tests.test_sax.NSPrefixSaxTestCase-class.html new file mode 100644 index 00000000..e4ad93f1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax.NSPrefixSaxTestCase-class.html @@ -0,0 +1,412 @@ + + + + + lxml.tests.test_sax.NSPrefixSaxTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_sax :: + Class NSPrefixSaxTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class NSPrefixSaxTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               NSPrefixSaxTestCase
+
+ +
+Testing that namespaces generate the right SAX events + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_saxify(self, + tree) + source code + +
+ +
+   + + + + + + +
test_element_sax_ns_prefix(self) + source code + +
+ +
+   + + + + + + +
test_element_sax_default_ns_prefix(self) + source code + +
+ +
+   + + + + + + +
test_element_sax_twin_ns_prefix(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_sax.SimpleContentHandler-class.html b/doc/html/api/lxml.tests.test_sax.SimpleContentHandler-class.html new file mode 100644 index 00000000..34ee7edd --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax.SimpleContentHandler-class.html @@ -0,0 +1,836 @@ + + + + + lxml.tests.test_sax.SimpleContentHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_sax :: + Class SimpleContentHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SimpleContentHandler

source code

+
+xml.sax.handler.ContentHandler --+
+                                 |
+                        object --+
+                                 |
+                                SimpleContentHandler
+
+ +
+A SAX content handler that just stores the events + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ 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 + +
+ +
+   + + + + + + +
startElement(self, + name, + attrs)
+ 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 + +
+ +
+   + + + + + + +
startElementNS(self, + name, + qname, + attrs)
+ Signals the start of an element in namespace mode.
+ source code + +
+ +
+   + + + + + + +
endElementNS(self, + name, + qname)
+ Signals the end of an element in namespace mode.
+ source code + +
+ +
+   + + + + + + +
characters(self, + content)
+ Receive notification of character data.
+ source code + +
+ +
+   + + + + + + +
ignorableWhitespace(self, + whitespace)
+ Receive notification of ignorable whitespace in element content.
+ source code + +
+ +
+   + + + + + + +
processingInstruction(self, + target, + data)
+ Receive notification of a processing instruction.
+ source code + +
+ +
+   + + + + + + +
skippedEntity(self, + name)
+ Receive notification of a skipped entity.
+ source code + +
+ +
+

Inherited from xml.sax.handler.ContentHandler: + setDocumentLocator +

+

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

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

Inherited from object: + __class__ +

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

__init__(self) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(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)
+ +
+
+
+ +
+ +
+ + +
+

startElement(self, + name, + attrs) +

+
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)
+ +
+
+
+ +
+ +
+ + +
+

startElementNS(self, + name, + qname, + attrs) +

+
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)
+ +
+
+
+ +
+ +
+ + +
+

endElementNS(self, + 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)
+ +
+
+
+ +
+ +
+ + +
+

characters(self, + content) +

+
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, + whitespace) +

+
source code  +
+ +

Receive notification of ignorable whitespace in element content.

+

Validating Parsers must use this method to report each chunk +of ignorable whitespace (see the W3C XML 1.0 recommendation, +section 2.10): non-validating parsers may also use this method +if they are capable of parsing and using content models.

+

SAX parsers may return all contiguous whitespace 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)
+ +
+
+
+ +
+ +
+ + +
+

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)
+ +
+
+
+ +
+ +
+ + +
+

skippedEntity(self, + name) +

+
source code  +
+ +

Receive notification of a skipped entity.

+

The Parser will invoke this method once for each entity +skipped. Non-validating processors may skip entities if they +have not seen the declarations (because, for example, the +entity was declared in an external DTD subset). All processors +may skip external entities, depending on the values of the +http://xml.org/sax/features/external-general-entities and the +http://xml.org/sax/features/external-parameter-entities +properties.

+
+
Overrides: + xml.sax.handler.ContentHandler.skippedEntity +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..0372624a --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron-module.html @@ -0,0 +1,246 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..2a17a22e --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron-pysrc.html @@ -0,0 +1,403 @@ + + + + + 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.assertTrue(schema.validate(tree_valid)) +39 self.assertFalse(schema.error_log.filter_from_errors()) +40 +41 self.assertFalse(schema.validate(tree_invalid)) +42 self.assertTrue(schema.error_log.filter_from_errors()) +43 +44 self.assertTrue(schema.validate(tree_valid)) # repeat valid +45 self.assertFalse(schema.error_log.filter_from_errors()) # repeat valid +
46 +
48 self.assertRaises(ValueError, etree.Schematron, etree.ElementTree()) +
49 +
51 schema = self.parse('''\ +52 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +53 <pattern name="Open model"> +54 </pattern> +55 </schema> +56 ''') +57 self.assertRaises(etree.SchematronParseError, +58 etree.Schematron, schema) +
59 +
61 schema = self.parse('''\ +62 <schema xmlns="http://purl.oclc.org/dsdl/schematron" /> +63 ''') +64 self.assertRaises(etree.SchematronParseError, +65 etree.Schematron, schema) +
66 +
68 # segfault +69 schema = self.parse('''\ +70 <schema xmlns="mynamespace" /> +71 ''') +72 self.assertRaises(etree.SchematronParseError, +73 etree.Schematron, schema) +
74 +75 +
76 -def test_suite(): +
77 suite = unittest.TestSuite() +78 suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)]) +79 suite.addTests( +80 [make_doctest('../../../doc/validation.txt')]) +81 return suite +
82 +83 if __name__ == '__main__': +84 print('to test use test.py %s' % __file__) +85 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7b8da0df --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron.ETreeSchematronTestCase-class.html @@ -0,0 +1,425 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeSchematronTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..148a195f --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading-module.html @@ -0,0 +1,255 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..add34883 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading-pysrc.html @@ -0,0 +1,1579 @@ + + + + + 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 re 
+  8  import sys 
+  9  import os.path 
+ 10  import unittest 
+ 11  import threading 
+ 12   
+ 13  this_dir = os.path.dirname(__file__) 
+ 14  if this_dir not in sys.path: 
+ 15      sys.path.insert(0, this_dir) # needed for Py3 
+ 16   
+ 17  from common_imports import etree, HelperTestCase, BytesIO, _bytes 
+ 18   
+ 19  try: 
+ 20      from Queue import Queue 
+ 21  except ImportError: 
+ 22      from queue import Queue # Py3 
+ 23   
+ 24   
+
25 -class ThreadingTestCase(HelperTestCase): +
26 """Threading tests""" + 27 etree = etree + 28 +
29 - def _run_thread(self, func): +
30 thread = threading.Thread(target=func) + 31 thread.start() + 32 thread.join() +
33 +
34 - def _run_threads(self, count, func, main_func=None): +
35 sync = threading.Event() + 36 lock = threading.Lock() + 37 counter = dict(started=0, finished=0, failed=0) + 38 + 39 def sync_start(func): + 40 with lock: + 41 started = counter['started'] + 1 + 42 counter['started'] = started + 43 if started < count + (main_func is not None): + 44 sync.wait(4) # wait until the other threads have started up + 45 assert sync.is_set() + 46 sync.set() # all waiting => go! + 47 try: + 48 func() + 49 except: + 50 with lock: + 51 counter['failed'] += 1 + 52 raise + 53 else: + 54 with lock: + 55 counter['finished'] += 1 +
56 + 57 threads = [threading.Thread(target=sync_start, args=(func,)) for _ in range(count)] + 58 for thread in threads: + 59 thread.start() + 60 if main_func is not None: + 61 sync_start(main_func) + 62 for thread in threads: + 63 thread.join() + 64 + 65 self.assertEqual(0, counter['failed']) + 66 self.assertEqual(counter['finished'], counter['started']) +
67 +
68 - def test_subtree_copy_thread(self): +
69 tostring = self.etree.tostring + 70 XML = self.etree.XML + 71 xml = _bytes("<root><threadtag/></root>") + 72 main_root = XML(_bytes("<root/>")) + 73 + 74 def run_thread(): + 75 thread_root = XML(xml) + 76 main_root.append(thread_root[0]) + 77 del thread_root +
78 + 79 self._run_thread(run_thread) + 80 self.assertEqual(xml, tostring(main_root)) + 81 +
82 - def test_main_xslt_in_thread(self): +
83 XML = self.etree.XML + 84 style = XML(_bytes('''\ + 85 <xsl:stylesheet version="1.0" + 86 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 87 <xsl:template match="*"> + 88 <foo><xsl:copy><xsl:value-of select="/a/b/text()" /></xsl:copy></foo> + 89 </xsl:template> + 90 </xsl:stylesheet>''')) + 91 st = etree.XSLT(style) + 92 + 93 result = [] + 94 + 95 def run_thread(): + 96 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) + 97 result.append( st(root) ) +
98 + 99 self._run_thread(run_thread) +100 self.assertEqual('''\ +101 <?xml version="1.0"?> +102 <foo><a>B</a></foo> +103 ''', +104 str(result[0])) +105 +
106 - def test_thread_xslt(self): +
107 XML = self.etree.XML +108 tostring = self.etree.tostring +109 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) +110 +111 def run_thread(): +112 style = XML(_bytes('''\ +113 <xsl:stylesheet version="1.0" +114 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +115 <xsl:template match="*"> +116 <foo><xsl:copy><xsl:value-of select="/a/b/text()" /></xsl:copy></foo> +117 </xsl:template> +118 </xsl:stylesheet>''')) +119 st = etree.XSLT(style) +120 root.append( st(root).getroot() ) +
121 +122 self._run_thread(run_thread) +123 self.assertEqual(_bytes('<a><b>B</b><c>C</c><foo><a>B</a></foo></a>'), +124 tostring(root)) +125 +
127 style = self.parse('''\ +128 <xsl:stylesheet version="1.0" +129 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +130 <xsl:template match="tag" /> +131 <!-- extend time for parsing + transform --> +132 ''' + '\n'.join('<xsl:template match="tag%x" />' % i for i in range(200)) + ''' +133 <xsl:UnExpectedElement /> +134 </xsl:stylesheet>''') +135 self.assertRaises(etree.XSLTParseError, +136 etree.XSLT, style) +137 +138 error_logs = [] +139 +140 def run_thread(): +141 try: +142 etree.XSLT(style) +143 except etree.XSLTParseError as e: +144 error_logs.append(e.error_log) +145 else: +146 self.assertFalse(True, "XSLT parsing should have failed but didn't") +
147 +148 self._run_threads(16, run_thread) +149 +150 self.assertEqual(16, len(error_logs)) +151 last_log = None +152 for log in error_logs: +153 self.assertTrue(len(log)) +154 if last_log is not None: +155 self.assertEqual(len(last_log), len(log)) +156 self.assertTrue(len(log) >= 2, len(log)) +157 for error in log: +158 self.assertTrue(':ERROR:XSLT:' in str(error), str(error)) +159 self.assertTrue(any('UnExpectedElement' in str(error) for error in log), log) +160 last_log = log +161 +
163 tree = self.parse('<tagFF/>') +164 style = self.parse('''\ +165 <xsl:stylesheet version="1.0" +166 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +167 <xsl:template name="tag0"> +168 <xsl:message terminate="yes">FAIL</xsl:message> +169 </xsl:template> +170 <!-- extend time for parsing + transform --> +171 ''' + '\n'.join('<xsl:template match="tag%X" name="tag%x"> <xsl:call-template name="tag%x" /> </xsl:template>' % (i, i, i-1) +172 for i in range(1, 256)) + ''' +173 </xsl:stylesheet>''') +174 self.assertRaises(etree.XSLTApplyError, +175 etree.XSLT(style), tree) +176 +177 error_logs = [] +178 +179 def run_thread(): +180 transform = etree.XSLT(style) +181 try: +182 transform(tree) +183 except etree.XSLTApplyError: +184 error_logs.append(transform.error_log) +185 else: +186 self.assertFalse(True, "XSLT parsing should have failed but didn't") +
187 +188 self._run_threads(16, run_thread) +189 +190 self.assertEqual(16, len(error_logs)) +191 last_log = None +192 for log in error_logs: +193 self.assertTrue(len(log)) +194 if last_log is not None: +195 self.assertEqual(len(last_log), len(log)) +196 self.assertEqual(1, len(log)) +197 for error in log: +198 self.assertTrue(':ERROR:XSLT:' in str(error)) +199 last_log = log +200 +
202 # this is the only case in XSLT where the result tree can be +203 # modified in-place +204 XML = self.etree.XML +205 tostring = self.etree.tostring +206 style = self.etree.XSLT(XML(_bytes('''\ +207 <xsl:stylesheet version="1.0" +208 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +209 <xsl:template match="*"> +210 <root class="abc"> +211 <xsl:copy-of select="@class" /> +212 <xsl:attribute name="class">xyz</xsl:attribute> +213 </root> +214 </xsl:template> +215 </xsl:stylesheet>'''))) +216 +217 result = [] +218 def run_thread(): +219 root = XML(_bytes('<ROOT class="ABC" />')) +220 result.append( style(root).getroot() ) +
221 +222 self._run_thread(run_thread) +223 self.assertEqual(_bytes('<root class="xyz"/>'), +224 tostring(result[0])) +225 +
226 - def test_thread_create_xslt(self): +
227 XML = self.etree.XML +228 tostring = self.etree.tostring +229 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) +230 +231 stylesheets = [] +232 +233 def run_thread(): +234 style = XML(_bytes('''\ +235 <xsl:stylesheet +236 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +237 version="1.0"> +238 <xsl:output method="xml" /> +239 <xsl:template match="/"> +240 <div id="test"> +241 <xsl:apply-templates/> +242 </div> +243 </xsl:template> +244 </xsl:stylesheet>''')) +245 stylesheets.append( etree.XSLT(style) ) +
246 +247 self._run_thread(run_thread) +248 +249 st = stylesheets[0] +250 result = tostring( st(root) ) +251 +252 self.assertEqual(_bytes('<div id="test">BC</div>'), +253 result) +254 +
255 - def test_thread_error_log(self): +
256 XML = self.etree.XML +257 expected_error = [self.etree.ErrorTypes.ERR_TAG_NAME_MISMATCH] +258 children = "<a>test</a>" * 100 +259 +260 def parse_error_test(thread_no): +261 tag = "tag%d" % thread_no +262 xml = "<%s>%s</%s>" % (tag, children, tag.upper()) +263 parser = self.etree.XMLParser() +264 for _ in range(10): +265 errors = None +266 try: +267 XML(xml, parser) +268 except self.etree.ParseError: +269 e = sys.exc_info()[1] +270 errors = e.error_log.filter_types(expected_error) +271 self.assertTrue(errors, "Expected error not found") +272 for error in errors: +273 self.assertTrue( +274 tag in error.message and tag.upper() in error.message, +275 "%s and %s not found in '%s'" % ( +276 tag, tag.upper(), error.message)) +
277 +278 self.etree.clear_error_log() +279 threads = [] +280 for thread_no in range(1, 10): +281 t = threading.Thread(target=parse_error_test, +282 args=(thread_no,)) +283 threads.append(t) +284 t.start() +285 +286 parse_error_test(0) +287 +288 for t in threads: +289 t.join() +290 +
291 - def test_thread_mix(self): +
292 XML = self.etree.XML +293 Element = self.etree.Element +294 SubElement = self.etree.SubElement +295 tostring = self.etree.tostring +296 xml = _bytes('<a><b>B</b><c xmlns="test">C</c></a>') +297 root = XML(xml) +298 fragment = XML(_bytes("<other><tags/></other>")) +299 +300 result = self.etree.Element("{myns}root", att = "someval") +301 +302 def run_XML(): +303 thread_root = XML(xml) +304 result.append(thread_root[0]) +305 result.append(thread_root[-1]) +
306 +307 def run_parse(): +308 thread_root = self.etree.parse(BytesIO(xml)).getroot() +309 result.append(thread_root[0]) +310 result.append(thread_root[-1]) +311 +312 def run_move_main(): +313 result.append(fragment[0]) +314 +315 def run_build(): +316 result.append( +317 Element("{myns}foo", attrib={'{test}attr':'val'})) +318 SubElement(result, "{otherns}tasty") +319 +320 def run_xslt(): +321 style = XML(_bytes('''\ +322 <xsl:stylesheet version="1.0" +323 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +324 <xsl:template match="*"> +325 <xsl:copy><foo><xsl:value-of select="/a/b/text()" /></foo></xsl:copy> +326 </xsl:template> +327 </xsl:stylesheet>''')) +328 st = etree.XSLT(style) +329 result.append( st(root).getroot() ) +330 +331 for test in (run_XML, run_parse, run_move_main, run_xslt, run_build): +332 tostring(result) +333 self._run_thread(test) +334 +335 self.assertEqual( +336 _bytes('<ns0:root xmlns:ns0="myns" att="someval"><b>B</b>' +337 '<c xmlns="test">C</c><b>B</b><c xmlns="test">C</c><tags/>' +338 '<a><foo>B</foo></a>' +339 '<ns0:foo xmlns:ns1="test" ns1:attr="val"/>' +340 '<ns1:tasty xmlns:ns1="otherns"/></ns0:root>'), +341 tostring(result)) +342 +343 def strip_first(): +344 root = Element("newroot") +345 root.append(result[0]) +346 +347 while len(result): +348 self._run_thread(strip_first) +349 +350 self.assertEqual( +351 _bytes('<ns0:root xmlns:ns0="myns" att="someval"/>'), +352 tostring(result)) +353 +
355 SubElement = self.etree.SubElement +356 names = list('abcdefghijklmnop') +357 runs_per_name = range(50) +358 result_matches = re.compile( +359 br'<thread_root>' +360 br'(?:<[a-p]{5} thread_attr_[a-p]="value" thread_attr2_[a-p]="value2"\s?/>)+' +361 br'</thread_root>').match +362 +363 def testrun(): +364 for _ in range(3): +365 root = self.etree.Element('thread_root') +366 for name in names: +367 tag_name = name * 5 +368 new = [] +369 for _ in runs_per_name: +370 el = SubElement(root, tag_name, {'thread_attr_' + name: 'value'}) +371 new.append(el) +372 for el in new: +373 el.set('thread_attr2_' + name, 'value2') +374 s = etree.tostring(root) +375 self.assertTrue(result_matches(s)) +
376 +377 # first, run only in sub-threads +378 self._run_threads(10, testrun) +379 +380 # then, additionally include the main thread (and its parent dict) +381 self._run_threads(10, testrun, main_func=testrun) +382 +
383 - def test_concurrent_proxies(self): +
384 XML = self.etree.XML +385 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b><c/></root>')) +386 child_count = len(root) +387 def testrun(): +388 for i in range(10000): +389 el = root[i%child_count] +390 del el +
391 self._run_threads(10, testrun) +392 +
394 XML = self.etree.XML +395 +396 class TestElement(etree.ElementBase): +397 pass +
398 +399 class MyLookup(etree.CustomElementClassLookup): +400 repeat = range(100) +401 def lookup(self, t, d, ns, name): +402 count = 0 +403 for i in self.repeat: +404 # allow other threads to run +405 count += 1 +406 return TestElement +407 +408 parser = self.etree.XMLParser() +409 parser.set_element_class_lookup(MyLookup()) +410 +411 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b><c/></root>'), +412 parser) +413 +414 child_count = len(root) +415 def testrun(): +416 for i in range(1000): +417 el = root[i%child_count] +418 del el +419 self._run_threads(10, testrun) +420 +421 +
422 -class ThreadPipelineTestCase(HelperTestCase): +
423 """Threading tests based on a thread worker pipeline. +424 """ +425 etree = etree +426 item_count = 40 +427 +
428 - class Worker(threading.Thread): +
429 - def __init__(self, in_queue, in_count, **kwargs): +
430 threading.Thread.__init__(self) +431 self.in_queue = in_queue +432 self.in_count = in_count +433 self.out_queue = Queue(in_count) +434 self.__dict__.update(kwargs) +
435 +
436 - def run(self): +
437 get, put = self.in_queue.get, self.out_queue.put +438 handle = self.handle +439 for _ in range(self.in_count): +440 put(handle(get())) +
441 +
442 - def handle(self, data): +
443 raise NotImplementedError() +
444 +
445 - class ParseWorker(Worker): +
446 - def handle(self, xml, _fromstring=etree.fromstring): +
447 return _fromstring(xml) +
448 +
449 - class RotateWorker(Worker): +
450 - def handle(self, element): +
451 first = element[0] +452 element[:] = element[1:] +453 element.append(first) +454 return element +
455 +
456 - class ReverseWorker(Worker): +
457 - def handle(self, element): +
458 element[:] = element[::-1] +459 return element +
460 +
461 - class ParseAndExtendWorker(Worker): +
462 - def handle(self, element, _fromstring=etree.fromstring): +
463 element.extend(_fromstring(self.xml)) +464 return element +
465 +
466 - class ParseAndInjectWorker(Worker): +
467 - def handle(self, element, _fromstring=etree.fromstring): +
468 root = _fromstring(self.xml) +469 root.extend(element) +470 return root +
471 +
472 - class Validate(Worker): +
473 - def handle(self, element): +
476 +
477 - class SerialiseWorker(Worker): +
478 - def handle(self, element): +
479 return etree.tostring(element) +
480 +481 xml = (b'''\ +482 <!DOCTYPE threadtest [ +483 <!ELEMENT threadtest (thread-tag1,thread-tag2)+> +484 <!ATTLIST threadtest +485 version CDATA "1.0" +486 > +487 <!ELEMENT thread-tag1 EMPTY> +488 <!ELEMENT thread-tag2 (div)> +489 <!ELEMENT div (threaded)> +490 <!ATTLIST div +491 huhu CDATA #IMPLIED +492 > +493 <!ELEMENT threaded EMPTY> +494 <!ATTLIST threaded +495 host CDATA #REQUIRED +496 > +497 ]> +498 <threadtest version="123"> +499 ''' + (b''' +500 <thread-tag1 /> +501 <thread-tag2> +502 <div huhu="true"> +503 <threaded host="here" /> +504 </div> +505 </thread-tag2> +506 ''') * 20 + b''' +507 </threadtest>''') +508 +
509 - def _build_pipeline(self, item_count, *classes, **kwargs): +
510 in_queue = Queue(item_count) +511 start = last = classes[0](in_queue, item_count, **kwargs) +512 start.setDaemon(True) +513 for worker_class in classes[1:]: +514 last = worker_class(last.out_queue, item_count, **kwargs) +515 last.setDaemon(True) +516 last.start() +517 return in_queue, start, last +
518 +
520 item_count = self.item_count +521 xml = self.xml.replace(b'thread', b'THREAD') # use fresh tag names +522 +523 # build and start the pipeline +524 in_queue, start, last = self._build_pipeline( +525 item_count, +526 self.ParseWorker, +527 self.RotateWorker, +528 self.ReverseWorker, +529 self.ParseAndExtendWorker, +530 self.Validate, +531 self.ParseAndInjectWorker, +532 self.SerialiseWorker, +533 xml=xml) +534 +535 # fill the queue +536 put = start.in_queue.put +537 for _ in range(item_count): +538 put(xml) +539 +540 # start the first thread and thus everything +541 start.start() +542 # make sure the last thread has terminated +543 last.join(60) # time out after 60 seconds +544 self.assertEqual(item_count, last.out_queue.qsize()) +545 # read the results +546 get = last.out_queue.get +547 results = [get() for _ in range(item_count)] +548 +549 comparison = results[0] +550 for i, result in enumerate(results[1:]): +551 self.assertEqual(comparison, result) +
552 +
554 item_count = self.item_count +555 xml = self.xml.replace(b'thread', b'GLOBAL') # use fresh tag names +556 XML = self.etree.XML +557 # build and start the pipeline +558 in_queue, start, last = self._build_pipeline( +559 item_count, +560 self.RotateWorker, +561 self.ReverseWorker, +562 self.ParseAndExtendWorker, +563 self.Validate, +564 self.SerialiseWorker, +565 xml=xml) +566 +567 # fill the queue +568 put = start.in_queue.put +569 for _ in range(item_count): +570 put(XML(xml)) +571 +572 # start the first thread and thus everything +573 start.start() +574 # make sure the last thread has terminated +575 last.join(60) # time out after 90 seconds +576 self.assertEqual(item_count, last.out_queue.qsize()) +577 # read the results +578 get = last.out_queue.get +579 results = [get() for _ in range(item_count)] +580 +581 comparison = results[0] +582 for i, result in enumerate(results[1:]): +583 self.assertEqual(comparison, result) +
584 +585 +
586 -def test_suite(): +
587 suite = unittest.TestSuite() +588 suite.addTests([unittest.makeSuite(ThreadingTestCase)]) +589 suite.addTests([unittest.makeSuite(ThreadPipelineTestCase)]) +590 return suite +
591 +592 if __name__ == '__main__': +593 print('to test use test.py %s' % __file__) +594 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..aa09616b --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase-class.html @@ -0,0 +1,544 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ThreadPipelineTestCase
+
+ +
+Threading tests based on a thread worker pipeline. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + Worker +
+   + + ParseWorker +
+   + + RotateWorker +
+   + + ReverseWorker +
+   + + ParseAndExtendWorker +
+   + + ParseAndInjectWorker +
+   + + Validate +
+   + + SerialiseWorker +
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+   + + item_count = 40 +
+   + + xml = '<!DOCTYPE threadtest [\n <!ELEMENT threadtest (threa... +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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:
+
+'''<!DOCTYPE threadtest [
+    <!ELEMENT threadtest (thread-tag1,thread-tag2)+>
+    <!ATTLIST threadtest
+        version    CDATA  "1.0"
+    >
+    <!ELEMENT thread-tag1 EMPTY>
+    <!ELEMENT thread-tag2 (div)>
+    <!ELEMENT div (threaded)>
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7b4c0dcf --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html @@ -0,0 +1,283 @@ + + + + + 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]
+
+   + + + + + + +
handle(self, + element, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html new file mode 100644 index 00000000..00921cfb --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html @@ -0,0 +1,283 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class ParseAndInjectWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParseAndInjectWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.ParseAndInjectWorker
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
handle(self, + element, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..6d4e7b7c --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html @@ -0,0 +1,283 @@ + + + + + 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]
+
+   + + + + + + +
handle(self, + xml, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + xml, + _fromstring=<cyfunction fromstring at 0x7f4dd3fccd10>) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..c2885d8b --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html @@ -0,0 +1,281 @@ + + + + + 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, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..09462ff5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html @@ -0,0 +1,281 @@ + + + + + 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, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..de8053a5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html @@ -0,0 +1,281 @@ + + + + + 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, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html new file mode 100644 index 00000000..370c15ae --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html @@ -0,0 +1,281 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.Validate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class Validate + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Validate

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.Validate
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
handle(self, + element) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

handle(self, + element) +

+
source code  +
+ + +
+
Overrides: + Worker.handle +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f087396f --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html @@ -0,0 +1,361 @@ + + + + + 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)
+ This constructor should always be called with keyword arguments. Arguments are:
+ source code + +
+ +
+   + + + + + + +
run(self)
+ Method representing the thread's activity.
+ source code + +
+ +
+   + + + + + + +
handle(self, + data) + source code + +
+ +
+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + is_alive, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _reset_internal_locks, + _set_daemon, + _set_ident +

+

Inherited from threading._Verbose (private): + _note +

+

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

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

Inherited from threading.Thread: + daemon, + ident, + name +

+

Inherited from threading.Thread (private): + _block +

+

Inherited from object: + __class__ +

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

__init__(self, + in_queue, + in_count, + **kwargs) +
(Constructor) +

+
source code  +
+ +

This constructor should always be called with keyword arguments. Arguments are:

+

group should be None; reserved for future extension when a ThreadGroup +class is implemented.

+

target is the callable object to be invoked by the run() +method. Defaults to None, meaning nothing is called.

+

name is the thread name. By default, a unique name is constructed of +the form "Thread-N" where N is a small decimal number.

+

args is the argument tuple for the target invocation. Defaults to ().

+

kwargs is a dictionary of keyword arguments for the target +invocation. Defaults to {}.

+

If a subclass overrides the constructor, it must make sure to invoke +the base class constructor (Thread.__init__()) before doing anything +else to the thread.

+
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

run(self) +

+
source code  +
+ +

Method representing the thread's activity.

+

You may override this method in a subclass. The standard run() method +invokes the callable object passed to the object's constructor as the +target argument, if any, with sequential and keyword arguments taken +from the args and kwargs arguments, respectively.

+
+
Overrides: + threading.Thread.run +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7cb59424 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadingTestCase-class.html @@ -0,0 +1,617 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ThreadingTestCase
+
+ +
+Threading tests + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_run_thread(self, + func) + source code + +
+ +
+   + + + + + + +
_run_threads(self, + count, + func, + main_func=None) + 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_parsing_error_log(self) + source code + +
+ +
+   + + + + + + +
test_thread_xslt_apply_error_log(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_attribute_names_in_dicts(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API for XML. +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..a1c3400d --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode-module.html @@ -0,0 +1,312 @@ + + + + + lxml.tests.test_unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_unicode + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_unicode

source code

+ + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + unicode
+ str(object='') -> string +
+   + + UnicodeTestCase +
+   + + EncodingsTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + ascii_uni = u'a' +
+   + + klingon = u'' +
+   + + invalid_tag = u'test' +
+   + + uni = u'Ãڀㄠ' +
+   + + uxml = u'<test><title>test áㄠ</title><h1>page áㄠ title</h1><... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..7547e52a --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode-pysrc.html @@ -0,0 +1,792 @@ + + + + + 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 
+  3  import sys 
+  4  import os.path 
+  5   
+  6  this_dir = os.path.dirname(__file__) 
+  7  if this_dir not in sys.path: 
+  8      sys.path.insert(0, this_dir)  # needed for Py3 
+  9   
+ 10  from common_imports import StringIO, etree, SillyFileLike, HelperTestCase 
+ 11  from common_imports import _str, _bytes, _chr 
+ 12   
+ 13  try: 
+ 14      unicode 
+ 15  except NameError: 
+ 16      unicode = str 
+ 17   
+ 18  ascii_uni = _bytes('a').decode('utf8') 
+ 19   
+ 20  klingon = _bytes("\\uF8D2").decode("unicode_escape") # not valid for XML names 
+ 21   
+ 22  invalid_tag = _bytes("test").decode('utf8') + klingon 
+ 23   
+ 24  uni = _bytes('\\xc3\\u0680\\u3120').decode("unicode_escape") # some non-ASCII characters 
+ 25   
+ 26  uxml = _bytes("<test><title>test \\xc3\\xa1\\u3120</title><h1>page \\xc3\\xa1\\u3120 title</h1></test>" 
+ 27                ).decode("unicode_escape") 
+ 28   
+ 29   
+
30 -class UnicodeTestCase(HelperTestCase): +
31 - def test__str(self): +
32 # test the testing framework, namely _str from common_imports + 33 self.assertEqual(_str('\x10'), _str('\u0010')) + 34 self.assertEqual(_str('\x10'), _str('\U00000010')) + 35 self.assertEqual(_str('\u1234'), _str('\U00001234')) +
36 +
37 - def test_unicode_xml(self): +
38 tree = etree.XML('<p>%s</p>' % uni) + 39 self.assertEqual(uni, tree.text) +
40 +
41 - def test_wide_unicode_xml(self): +
42 if sys.maxunicode < 1114111: + 43 return # skip test + 44 tree = etree.XML(_bytes('<p>\\U00026007</p>').decode('unicode_escape')) + 45 self.assertEqual(1, len(tree.text)) + 46 self.assertEqual(_bytes('\\U00026007').decode('unicode_escape'), + 47 tree.text) +
48 +
49 - def test_unicode_xml_broken(self): +
50 uxml = ('<?xml version="1.0" encoding="UTF-8"?>' + + 51 '<p>%s</p>' % uni) + 52 self.assertRaises(ValueError, etree.XML, uxml) +
53 +
54 - def test_unicode_tag(self): +
55 el = etree.Element(uni) + 56 self.assertEqual(uni, el.tag) +
57 +
58 - def test_unicode_tag_invalid(self): +
59 # sadly, Klingon is not well-formed + 60 self.assertRaises(ValueError, etree.Element, invalid_tag) +
61 +
62 - def test_unicode_nstag(self): +
63 tag = "{http://abc/}%s" % uni + 64 el = etree.Element(tag) + 65 self.assertEqual(tag, el.tag) +
66 +
67 - def test_unicode_ns_invalid(self): +
68 # namespace URIs must conform to RFC 3986 + 69 tag = "{http://%s/}abc" % uni + 70 self.assertRaises(ValueError, etree.Element, tag) +
71 +
72 - def test_unicode_nstag_invalid(self): +
73 # sadly, Klingon is not well-formed + 74 tag = "{http://abc/}%s" % invalid_tag + 75 self.assertRaises(ValueError, etree.Element, tag) +
76 +
77 - def test_unicode_qname(self): +
78 qname = etree.QName(uni, uni) + 79 tag = "{%s}%s" % (uni, uni) + 80 self.assertEqual(qname.text, tag) + 81 self.assertEqual(unicode(qname), tag) +
82 +
83 - def test_unicode_qname_invalid(self): +
84 self.assertRaises(ValueError, etree.QName, invalid_tag) +
85 +
86 - def test_unicode_attr(self): +
87 el = etree.Element('foo', {'bar': uni}) + 88 self.assertEqual(uni, el.attrib['bar']) +
89 +
90 - def test_unicode_comment(self): +
91 el = etree.Comment(uni) + 92 self.assertEqual(uni, el.text) +
93 +
94 - def test_unicode_repr1(self): +
95 x = etree.Element(_str('å')) + 96 # must not raise UnicodeEncodeError + 97 repr(x) +
98 +
99 - def test_unicode_repr2(self): +
100 x = etree.Comment(_str('ö')) +101 repr(x) +
102 +
103 - def test_unicode_repr3(self): +
104 x = etree.ProcessingInstruction(_str('Å'), _str('\u0131')) +105 repr(x) +
106 +
107 - def test_unicode_repr4(self): +
108 x = etree.Entity(_str('ä')) +109 repr(x) +
110 +
111 - def test_unicode_text(self): +
112 e = etree.Element('e') +113 +114 def settext(text): +115 e.text = text +
116 +117 self.assertRaises(ValueError, settext, _str('ab\ufffe')) +118 self.assertRaises(ValueError, settext, _str('ö\ffff')) +119 self.assertRaises(ValueError, settext, _str('\u0123\ud800')) +120 self.assertRaises(ValueError, settext, _str('x\ud8ff')) +121 self.assertRaises(ValueError, settext, _str('\U00010000\udfff')) +122 self.assertRaises(ValueError, settext, _str('abd\x00def')) +123 # should not Raise +124 settext(_str('\ud7ff\ue000\U00010000\U0010FFFFäöas')) +125 +126 for char_val in range(0xD800, 0xDFFF+1): +127 self.assertRaises(ValueError, settext, 'abc' + _chr(char_val)) +128 self.assertRaises(ValueError, settext, _chr(char_val)) +129 self.assertRaises(ValueError, settext, _chr(char_val) + 'abc') +130 +131 self.assertRaises(ValueError, settext, _bytes('\xe4')) +132 self.assertRaises(ValueError, settext, _bytes('\x80')) +133 self.assertRaises(ValueError, settext, _bytes('\xff')) +134 self.assertRaises(ValueError, settext, _bytes('\x08')) +135 self.assertRaises(ValueError, settext, _bytes('\x19')) +136 self.assertRaises(ValueError, settext, _bytes('\x20\x00')) +137 # should not Raise +138 settext(_bytes('\x09\x0A\x0D\x20\x60\x7f')) +
139 +
140 - def test_uniname(self): +
141 Element = etree.Element +142 def el(name): +143 return Element(name) +
144 +145 self.assertRaises(ValueError, el, ':') +146 self.assertRaises(ValueError, el, '0a') +147 self.assertRaises(ValueError, el, _str('\u203f')) +148 # should not Raise +149 el(_str('\u0132')) +150 +151 +152 +
154 el = etree.parse(StringIO('<p>%s</p>' % uni)).getroot() +155 self.assertEqual(uni, el.text) +
156 +157 ## def test_parse_fileobject_unicode(self): +158 ## # parse unicode from unamed file object (not support by ElementTree) +159 ## f = SillyFileLike(uxml) +160 ## root = etree.parse(f).getroot() +161 ## self.assertEqual(unicode(etree.tostring(root, 'UTF-8'), 'UTF-8'), +162 ## uxml) +163 +164 +
165 -class EncodingsTestCase(HelperTestCase): +
166 - def test_illegal_utf8(self): +
167 data = _bytes('<test>\x80\x80\x80</test>', encoding='iso8859-1') +168 self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data) +
169 +
170 - def test_illegal_utf8_recover(self): +
171 data = _bytes('<test>\x80\x80\x80</test>', encoding='iso8859-1') +172 parser = etree.XMLParser(recover=True) +173 self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) +
174 +
175 - def _test_encoding(self, encoding, xml_encoding_name=None): +
176 foo = """<?xml version='1.0' encoding='%s'?>\n<tag attrib='123'></tag>""" % ( +177 xml_encoding_name or encoding) +178 root = etree.fromstring(foo.encode(encoding)) +179 self.assertEqual('tag', root.tag) +180 +181 doc_encoding = root.getroottree().docinfo.encoding +182 self.assertTrue( +183 doc_encoding.lower().rstrip('lbe'), +184 (xml_encoding_name or encoding).lower().rstrip('lbe')) +
185 +
186 - def test_utf8_fromstring(self): +
187 self._test_encoding('utf-8') +
188 +
189 - def test_utf8sig_fromstring(self): +
190 self._test_encoding('utf_8_sig', 'utf-8') +
191 +
192 - def test_utf16_fromstring(self): +
193 self._test_encoding('utf-16') +
194 +
195 - def test_utf16LE_fromstring(self): +
196 self._test_encoding('utf-16le', 'utf-16') +
197 +
198 - def test_utf16BE_fromstring(self): +
199 self._test_encoding('utf-16be', 'utf-16') +
200 +
201 - def test_utf32_fromstring(self): +
202 self._test_encoding('utf-32', 'utf-32') +
203 +
204 - def test_utf32LE_fromstring(self): +
205 self._test_encoding('utf-32le', 'utf-32') +
206 +
207 - def test_utf32BE_fromstring(self): +
208 self._test_encoding('utf-32be', 'utf-32') +
209 +210 +
211 -def test_suite(): +
212 suite = unittest.TestSuite() +213 suite.addTests([unittest.makeSuite(UnicodeTestCase)]) +214 suite.addTests([unittest.makeSuite(EncodingsTestCase)]) +215 return suite +
216 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_unicode.EncodingsTestCase-class.html b/doc/html/api/lxml.tests.test_unicode.EncodingsTestCase-class.html new file mode 100644 index 00000000..ba981aef --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode.EncodingsTestCase-class.html @@ -0,0 +1,523 @@ + + + + + lxml.tests.test_unicode.EncodingsTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_unicode :: + Class EncodingsTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class EncodingsTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               EncodingsTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_illegal_utf8(self) + source code + +
+ +
+   + + + + + + +
test_illegal_utf8_recover(self) + source code + +
+ +
+   + + + + + + +
_test_encoding(self, + encoding, + xml_encoding_name=None) + source code + +
+ +
+   + + + + + + +
test_utf8_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf8sig_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf16_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf16LE_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf16BE_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf32_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf32LE_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_utf32BE_fromstring(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f6a5bc28 --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode.UnicodeTestCase-class.html @@ -0,0 +1,665 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               UnicodeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test__str(self) + source code + +
+ +
+   + + + + + + +
test_unicode_xml(self) + source code + +
+ +
+   + + + + + + +
test_wide_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_ns_invalid(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_repr1(self) + source code + +
+ +
+   + + + + + + +
test_unicode_repr2(self) + source code + +
+ +
+   + + + + + + +
test_unicode_repr3(self) + source code + +
+ +
+   + + + + + + +
test_unicode_repr4(self) + source code + +
+ +
+   + + + + + + +
test_unicode_text(self) + source code + +
+ +
+   + + + + + + +
test_uniname(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..21876b01 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema-module.html @@ -0,0 +1,253 @@ + + + + + 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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..30ac69b8 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema-pysrc.html @@ -0,0 +1,1622 @@ + + + + + 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   
+
17 -class ETreeXMLSchemaTestCase(HelperTestCase): +
18 - def test_xmlschema(self): +
19 tree_valid = self.parse('<a><b></b></a>') + 20 tree_invalid = self.parse('<a><c></c></a>') + 21 schema = self.parse(''' + 22 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 23 <xsd:element name="a" type="AType"/> + 24 <xsd:complexType name="AType"> + 25 <xsd:sequence> + 26 <xsd:element name="b" type="xsd:string" /> + 27 </xsd:sequence> + 28 </xsd:complexType> + 29 </xsd:schema> + 30 ''') + 31 schema = etree.XMLSchema(schema) + 32 self.assertTrue(schema.validate(tree_valid)) + 33 self.assertFalse(schema.validate(tree_invalid)) + 34 self.assertTrue(schema.validate(tree_valid)) # retry valid + 35 self.assertFalse(schema.validate(tree_invalid)) # retry invalid +
36 +
37 - def test_xmlschema_error_log(self): +
38 tree_valid = self.parse('<a><b></b></a>') + 39 tree_invalid = self.parse('<a><c></c></a>') + 40 schema = self.parse(''' + 41 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 42 <xsd:element name="a" type="AType"/> + 43 <xsd:complexType name="AType"> + 44 <xsd:sequence> + 45 <xsd:element name="b" type="xsd:string" /> + 46 </xsd:sequence> + 47 </xsd:complexType> + 48 </xsd:schema> + 49 ''') + 50 schema = etree.XMLSchema(schema) + 51 self.assertTrue(schema.validate(tree_valid)) + 52 self.assertFalse(schema.error_log.filter_from_errors()) + 53 + 54 self.assertFalse(schema.validate(tree_invalid)) + 55 self.assertTrue(schema.error_log.filter_from_errors()) + 56 self.assertTrue(schema.error_log.filter_types( + 57 etree.ErrorTypes.SCHEMAV_ELEMENT_CONTENT)) + 58 + 59 self.assertTrue(schema.validate(tree_valid)) + 60 self.assertFalse(schema.error_log.filter_from_errors()) + 61 + 62 self.assertFalse(schema.validate(tree_invalid)) + 63 self.assertTrue(schema.error_log.filter_from_errors()) + 64 self.assertTrue(schema.error_log.filter_types( + 65 etree.ErrorTypes.SCHEMAV_ELEMENT_CONTENT)) +
66 +
68 """We don't have a guarantee that there will always be a path + 69 for a _LogEntry object (or even a node for which to determine + 70 a path), but at least when this test was created schema validation + 71 errors always got a node and an XPath value. If that ever changes, + 72 we can modify this test to something like: + 73 self.assertTrue(error_path is None or tree_path == error_path) + 74 That way, we can at least verify that if we did get a path value + 75 it wasn't bogus. + 76 """ + 77 tree = self.parse('<a><b>42</b><b>dada</b></a>') + 78 schema = self.parse(''' + 79 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 80 <xsd:element name="a" type="AType"/> + 81 <xsd:complexType name="AType"> + 82 <xsd:sequence> + 83 <xsd:element name="b" type="xsd:integer" maxOccurs="2"/> + 84 </xsd:sequence> + 85 </xsd:complexType> + 86 </xsd:schema> + 87 ''') + 88 schema = etree.XMLSchema(schema) + 89 schema.validate(tree) + 90 tree_path = tree.getpath(tree.findall('b')[1]) + 91 error_path = schema.error_log[0].path + 92 self.assertTrue(tree_path == error_path) +
93 +
95 schema = self.parse(''' + 96 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 97 <xsd:element name="a" type="AType"/> + 98 <xsd:complexType name="AType"> + 99 <xsd:sequence minOccurs="4" maxOccurs="4"> +100 <xsd:element name="b" type="BType" /> +101 </xsd:sequence> +102 </xsd:complexType> +103 <xsd:complexType name="BType"> +104 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> +105 </xsd:complexType> +106 </xsd:schema> +107 ''') +108 schema = etree.XMLSchema(schema, attribute_defaults=True) +109 +110 tree = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>') +111 +112 root = tree.getroot() +113 self.assertEqual('ho', root[0].get('hardy')) +114 self.assertEqual(None, root[1].get('hardy')) +115 self.assertEqual('ho', root[2].get('hardy')) +116 self.assertEqual(None, root[3].get('hardy')) +117 +118 self.assertTrue(schema(tree)) +119 +120 root = tree.getroot() +121 self.assertEqual('ho', root[0].get('hardy')) +122 self.assertEqual('hey', root[1].get('hardy')) +123 self.assertEqual('ho', root[2].get('hardy')) +124 self.assertEqual('hey', root[3].get('hardy')) +
125 +
126 - def test_xmlschema_parse(self): +
127 schema = self.parse(''' +128 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +129 <xsd:element name="a" type="AType"/> +130 <xsd:complexType name="AType"> +131 <xsd:sequence> +132 <xsd:element name="b" type="xsd:string" /> +133 </xsd:sequence> +134 </xsd:complexType> +135 </xsd:schema> +136 ''') +137 schema = etree.XMLSchema(schema) +138 parser = etree.XMLParser(schema=schema) +139 +140 tree_valid = self.parse('<a><b></b></a>', parser=parser) +141 self.assertEqual('a', tree_valid.getroot().tag) +142 +143 self.assertRaises(etree.XMLSyntaxError, +144 self.parse, '<a><c></c></a>', parser=parser) +
145 +
147 # does not work as of libxml2 2.7.3 +148 schema = self.parse(''' +149 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +150 <xsd:element name="a" type="AType"/> +151 <xsd:complexType name="AType"> +152 <xsd:sequence minOccurs="4" maxOccurs="4"> +153 <xsd:element name="b" type="BType" /> +154 </xsd:sequence> +155 </xsd:complexType> +156 <xsd:complexType name="BType"> +157 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> +158 </xsd:complexType> +159 </xsd:schema> +160 ''') +161 schema = etree.XMLSchema(schema) +162 parser = etree.XMLParser(schema=schema, attribute_defaults=True) +163 +164 tree_valid = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>', +165 parser=parser) +166 root = tree_valid.getroot() +167 self.assertEqual('ho', root[0].get('hardy')) +168 self.assertEqual('hey', root[1].get('hardy')) +169 self.assertEqual('ho', root[2].get('hardy')) +170 self.assertEqual('hey', root[3].get('hardy')) +
171 +
173 # does not work as of libxml2 2.7.3 +174 schema = self.parse(''' +175 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +176 <xsd:element name="a" type="AType"/> +177 <xsd:complexType name="AType"> +178 <xsd:sequence minOccurs="4" maxOccurs="4"> +179 <xsd:element name="b" type="BType" /> +180 </xsd:sequence> +181 </xsd:complexType> +182 <xsd:complexType name="BType"> +183 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> +184 </xsd:complexType> +185 </xsd:schema> +186 ''') +187 schema = etree.XMLSchema(schema, attribute_defaults=True) +188 parser = etree.XMLParser(schema=schema) +189 +190 tree_valid = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>', +191 parser=parser) +192 root = tree_valid.getroot() +193 self.assertEqual('ho', root[0].get('hardy')) +194 self.assertEqual('hey', root[1].get('hardy')) +195 self.assertEqual('ho', root[2].get('hardy')) +196 self.assertEqual('hey', root[3].get('hardy')) +
197 +
199 # does not work as of libxml2 2.7.3 +200 schema = self.parse(''' +201 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +202 <xsd:element name="a" type="AType"/> +203 <xsd:complexType name="AType"> +204 <xsd:sequence minOccurs="3" maxOccurs="3"> +205 <xsd:element name="b" type="BType" /> +206 </xsd:sequence> +207 </xsd:complexType> +208 <xsd:complexType name="BType"> +209 <xsd:attribute name="hardy" type="xsd:string" fixed="hey" /> +210 </xsd:complexType> +211 </xsd:schema> +212 ''') +213 schema = etree.XMLSchema(schema) +214 parser = etree.XMLParser(schema=schema, attribute_defaults=True) +215 +216 tree_valid = self.parse('<a><b/><b hardy="hey"/><b/></a>', +217 parser=parser) +218 root = tree_valid.getroot() +219 self.assertEqual('hey', root[0].get('hardy')) +220 self.assertEqual('hey', root[1].get('hardy')) +221 self.assertEqual('hey', root[2].get('hardy')) +
222 +
223 - def test_xmlschema_stringio(self): +
224 schema_file = BytesIO(''' +225 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +226 <xsd:element name="a" type="AType"/> +227 <xsd:complexType name="AType"> +228 <xsd:sequence> +229 <xsd:element name="b" type="xsd:string" /> +230 </xsd:sequence> +231 </xsd:complexType> +232 </xsd:schema> +233 ''') +234 schema = etree.XMLSchema(file=schema_file) +235 parser = etree.XMLParser(schema=schema) +236 +237 tree_valid = self.parse('<a><b></b></a>', parser=parser) +238 self.assertEqual('a', tree_valid.getroot().tag) +239 +240 self.assertRaises(etree.XMLSyntaxError, +241 self.parse, '<a><c></c></a>', parser=parser) +
242 +
243 - def test_xmlschema_iterparse(self): +
244 schema = self.parse(''' +245 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +246 <xsd:element name="a" type="AType"/> +247 <xsd:complexType name="AType"> +248 <xsd:sequence> +249 <xsd:element name="b" type="xsd:string" /> +250 </xsd:sequence> +251 </xsd:complexType> +252 </xsd:schema> +253 ''') +254 schema = etree.XMLSchema(schema) +255 xml = BytesIO('<a><b></b></a>') +256 events = [ (event, el.tag) +257 for (event, el) in etree.iterparse(xml, schema=schema) ] +258 +259 self.assertEqual([('end', 'b'), ('end', 'a')], +260 events) +
261 +
263 schema = self.parse(''' +264 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +265 <xsd:element name="a" type="AType"/> +266 <xsd:complexType name="AType"> +267 <xsd:sequence> +268 <xsd:element name="b" type="xsd:string" /> +269 </xsd:sequence> +270 </xsd:complexType> +271 </xsd:schema> +272 ''') +273 schema = etree.XMLSchema(schema) +274 xml = BytesIO('<a><b></b></a>') +275 event, element = next(iter(etree.iterparse(xml, schema=schema))) +276 self.assertEqual('end', event) +277 self.assertEqual('b', element.tag) +
278 +
280 schema = self.parse(''' +281 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +282 <xsd:element name="a" type="AType"/> +283 <xsd:complexType name="AType"> +284 <xsd:sequence> +285 <xsd:element name="b" type="xsd:string" /> +286 </xsd:sequence> +287 </xsd:complexType> +288 </xsd:schema> +289 ''') +290 schema = etree.XMLSchema(schema) +291 self.assertRaises( +292 etree.XMLSyntaxError, +293 list, etree.iterparse(BytesIO('<a><c></c></a>'), schema=schema)) +
294 +
296 self.assertRaises(ValueError, etree.XMLSchema, etree.ElementTree()) +
297 +
299 self.assertRaises(ValueError, etree.XMLSchema, etree.Comment('TEST')) +
300 +
302 schema = self.parse(''' +303 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +304 <xsd:element name="a" type="xsd:string"/> +305 </xsd:schema> +306 ''') +307 schema = etree.XMLSchema(schema) +308 +309 root = etree.Element('a') +310 root.text = 'TEST' +311 self.assertTrue(schema(root)) +312 +313 self.assertRaises(ValueError, schema, etree.Comment('TEST')) +314 self.assertRaises(ValueError, schema, etree.PI('a', 'text')) +315 self.assertRaises(ValueError, schema, etree.Entity('text')) +
316 +
318 schema = self.parse('''\ +319 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +320 <element name="a" type="AType"/> +321 <xsd:complexType name="AType"> +322 <xsd:sequence> +323 <xsd:element name="b" type="xsd:string" /> +324 </xsd:sequence> +325 </xsd:complexType> +326 </xsd:schema> +327 ''') +328 self.assertRaises(etree.XMLSchemaParseError, +329 etree.XMLSchema, schema) +
330 +
332 schema = self.parse('<test/>') +333 self.assertRaises(etree.XMLSchemaParseError, +334 etree.XMLSchema, schema) +
335 +
336 - def test_xmlschema_file(self): +
337 # this will only work if we access the file through path or +338 # file object.. +339 f = open(fileInTestDir('test.xsd'), 'rb') +340 try: +341 schema = etree.XMLSchema(file=f) +342 finally: +343 f.close() +344 tree_valid = self.parse('<a><b></b></a>') +345 self.assertTrue(schema.validate(tree_valid)) +
346 +
347 - def test_xmlschema_import_file(self): +
348 # this will only work if we access the file through path or +349 # file object.. +350 schema = etree.XMLSchema(file=fileInTestDir('test_import.xsd')) +351 tree_valid = self.parse( +352 '<a:x xmlns:a="http://codespeak.net/lxml/schema/ns1"><b></b></a:x>') +353 self.assertTrue(schema.validate(tree_valid)) +
354 +
355 - def test_xmlschema_shortcut(self): +
356 tree_valid = self.parse('<a><b></b></a>') +357 tree_invalid = self.parse('<a><c></c></a>') +358 schema = self.parse('''\ +359 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +360 <xsd:element name="a" type="AType"/> +361 <xsd:complexType name="AType"> +362 <xsd:sequence> +363 <xsd:element name="b" type="xsd:string" /> +364 </xsd:sequence> +365 </xsd:complexType> +366 </xsd:schema> +367 ''') +368 self.assertTrue(tree_valid.xmlschema(schema)) +369 self.assertFalse(tree_invalid.xmlschema(schema)) +
370 +
372 # this used to crash because the schema part was not properly copied out +373 wsdl = self.parse('''\ +374 <wsdl:definitions +375 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" +376 xmlns:xs="http://www.w3.org/2001/XMLSchema"> +377 <wsdl:types> +378 <xs:schema> +379 </xs:schema> +380 </wsdl:types> +381 </wsdl:definitions> +382 ''') +383 schema_element = wsdl.find( +384 "{http://schemas.xmlsoap.org/wsdl/}types/" +385 "{http://www.w3.org/2001/XMLSchema}schema" +386 ) +387 etree.XMLSchema(schema_element) +388 etree.XMLSchema(schema_element) +389 etree.XMLSchema(schema_element) +
390 +391 +
392 -class ETreeXMLSchemaResolversTestCase(HelperTestCase): +
393 resolver_schema_int = BytesIO("""\ +394 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +395 xmlns:etype="http://codespeak.net/lxml/test/external" +396 targetNamespace="http://codespeak.net/lxml/test/internal"> +397 <xsd:import namespace="http://codespeak.net/lxml/test/external" schemaLocation="XXX.xsd" /> +398 <xsd:element name="a" type="etype:AType"/> +399 </xsd:schema>""") +400 +401 resolver_schema_int2 = BytesIO("""\ +402 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +403 xmlns:etype="http://codespeak.net/lxml/test/external" +404 targetNamespace="http://codespeak.net/lxml/test/internal"> +405 <xsd:import namespace="http://codespeak.net/lxml/test/external" schemaLocation="YYY.xsd" /> +406 <xsd:element name="a" type="etype:AType"/> +407 </xsd:schema>""") +408 +409 resolver_schema_ext = """\ +410 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +411 targetNamespace="http://codespeak.net/lxml/test/external"> +412 <xsd:complexType name="AType"> +413 <xsd:sequence><xsd:element name="b" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /></xsd:sequence> +414 </xsd:complexType> +415 </xsd:schema>""" +416 +
417 - class simple_resolver(etree.Resolver): +
418 - def __init__(self, schema): +
419 self.schema = schema +
420 +
421 - def resolve(self, url, id, context): +
422 assert url == 'XXX.xsd' +423 return self.resolve_string(self.schema, context) +
424 +425 # tests: +426 +
427 - def test_xmlschema_resolvers(self): +
428 # test that resolvers work with schema. +429 parser = etree.XMLParser() +430 parser.resolvers.add(self.simple_resolver(self.resolver_schema_ext)) +431 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +432 schema = etree.XMLSchema(schema_doc) +
433 +
435 # test that the default resolver will get called if there's no +436 # specific parser resolver. +437 root_resolver = self.simple_resolver(self.resolver_schema_ext) +438 etree.get_default_parser().resolvers.add(root_resolver) +439 schema_doc = etree.parse(self.resolver_schema_int) +440 schema = etree.XMLSchema(schema_doc) +441 etree.get_default_parser().resolvers.remove(root_resolver) +
442 +
444 # test that the default resolver will not get called when a +445 # more specific resolver is registered. +446 +447 class res_root(etree.Resolver): +448 def resolve(self, url, id, context): +449 assert False +450 return None +
451 +452 root_resolver = res_root() +453 etree.get_default_parser().resolvers.add(root_resolver) +454 +455 parser = etree.XMLParser() +456 parser.resolvers.add(self.simple_resolver(self.resolver_schema_ext)) +457 +458 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +459 schema = etree.XMLSchema(schema_doc) +460 etree.get_default_parser().resolvers.remove(root_resolver) +461 +
463 # test that resolvers work in a nested fashion. +464 +465 resolver_schema = self.resolver_schema_ext +466 +467 class res_nested(etree.Resolver): +468 def __init__(self, ext_schema): +469 self.ext_schema = ext_schema +
470 +471 def resolve(self, url, id, context): +472 assert url == 'YYY.xsd' +473 return self.resolve_string(self.ext_schema, context) +474 +475 class res(etree.Resolver): +476 def __init__(self, ext_schema_1, ext_schema_2): +477 self.ext_schema_1 = ext_schema_1 +478 self.ext_schema_2 = ext_schema_2 +479 +480 def resolve(self, url, id, context): +481 assert url == 'XXX.xsd' +482 +483 new_parser = etree.XMLParser() +484 new_parser.resolvers.add(res_nested(self.ext_schema_2)) +485 new_schema_doc = etree.parse(self.ext_schema_1, parser = new_parser) +486 new_schema = etree.XMLSchema(new_schema_doc) +487 +488 return self.resolve_string(resolver_schema, context) +489 +490 parser = etree.XMLParser() +491 parser.resolvers.add(res(self.resolver_schema_int2, self.resolver_schema_ext)) +492 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +493 schema = etree.XMLSchema(schema_doc) +494 +495 +
496 -def test_suite(): +
497 suite = unittest.TestSuite() +498 suite.addTests([unittest.makeSuite(ETreeXMLSchemaTestCase)]) +499 suite.addTests([unittest.makeSuite(ETreeXMLSchemaResolversTestCase)]) +500 suite.addTests( +501 [make_doctest('../../../doc/validation.txt')]) +502 return suite +
503 +504 +505 if __name__ == '__main__': +506 print('to test use test.py %s' % __file__) +507 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..a2a4e4ae --- /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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXMLSchemaResolversTestCase
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + simple_resolver +
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xmlschema_resolvers(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_resolvers_root(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_resolvers_noroot(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_nested_resolvers(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + resolver_schema_int = <_io.BytesIO object> +
+   + + resolver_schema_int2 = <_io.BytesIO object> +
+   + + resolver_schema_ext = '<xsd:schema xmlns:xsd="http://www.w3.or... +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

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 00000000..a0fd30ae --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html @@ -0,0 +1,307 @@ + + + + + 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 help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
resolve(self, + url, + id, + context)
+ Override this method to resolve an external source by +system_url and public_id. The third argument is an +opaque context object.
+ source code + +
+ +
+

Inherited from etree.Resolver: + __new__, + resolve_empty, + resolve_file, + resolve_filename, + resolve_string +

+

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

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

Inherited from object: + __class__ +

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

__init__(self, + schema) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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 00000000..88c130f4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html @@ -0,0 +1,733 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXMLSchemaTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xmlschema(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_error_log(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_error_log_path(self)
+ We don't have a guarantee that there will always be a path +for a _LogEntry object (or even a node for which to determine +a path), but at least when this test was created schema validation +errors always got a node and an XPath value.
+ 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_incomplete(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_iterparse_fail(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_comment_error(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_illegal_validation_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 + +
+ +
+   + + + + + + +
test_create_from_partial_doc(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

test_xmlschema_error_log_path(self) +

+
source code  +
+ +
+We don't have a guarantee that there will always be a path
+for a _LogEntry object (or even a node for which to determine
+a path), but at least when this test was created schema validation
+errors always got a node and an XPath value. If that ever changes,
+we can modify this test to something like:
+    self.assertTrue(error_path is None or tree_path == error_path)
+That way, we can at least verify that if we did get a path value
+it wasn't bogus.
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..96a97cb3 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator-module.html @@ -0,0 +1,547 @@ + + + + + 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 +
+   + + ETreeXPathExsltTestCase
+ Tests for the EXSLT support in XPath (requires libxslt 1.1.25+) +
+   + + ETreeETXPathClassTestCase
+ Tests for the ETXPath class +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
tag(elem) + source code + +
+ +
+   + + + + + + +
tag_or_value(elem) + source code + +
+ +
+   + + + + + + +
stringTest(ctxt, + s1) + source code + +
+ +
+   + + + + + + +
stringListTest(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/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + SAMPLE_XML = <lxml.etree._ElementTree object> +
+   + + uri = 'http://www.example.com/' +
+   + + extension = {(None, 'argsTest1'): <__builtin__.function object... +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

extension

+ +
+
+
+
Value:
+
+{(None, 'argsTest1'): <__builtin__.function object>,
+ (None, 'argsTest2'): <__builtin__.function object>,
+ (None, 'booleanTest'): <__builtin__.function object>,
+ (None, 'floatTest'): <__builtin__.function object>,
+ (None, 'resultTypesTest'): <__builtin__.function object>,
+ (None, 'resultTypesTest2'): <__builtin__.function object>,
+ (None, 'setTest'): <__builtin__.function object>,
+ (None, 'setTest2'): <__builtin__.function object>,
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..f833ee8d --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator-pysrc.html @@ -0,0 +1,2229 @@ + + + + + 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.assertTrue(tree.xpath('boolean(/a/b)')) + 22 self.assertTrue(not tree.xpath('boolean(/a/c)')) +
23 +
24 - def test_xpath_number(self): +
25 tree = self.parse('<a>1</a>') + 26 self.assertEqual(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.assertEqual('Foo', + 37 tree.xpath('string(/a/text())')) +
38 +
39 - def test_xpath_document_root(self): +
40 tree = self.parse('<a><b/></a>') + 41 self.assertEqual([], + 42 tree.xpath('/')) +
43 +
44 - def test_xpath_namespace(self): +
45 tree = self.parse('<a xmlns="test" xmlns:p="myURI"/>') + 46 self.assertTrue((None, "test") in tree.xpath('namespace::*')) + 47 self.assertTrue(('p', 'myURI') in tree.xpath('namespace::*')) +
48 +
49 - def test_xpath_namespace_empty(self): +
50 tree = self.parse('<a/>') + 51 self.assertEqual([('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.assertEqual([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.assertEqual([], + 63 tree.xpath('/a/c')) + 64 # this seems to pass a different code path, also should return nothing + 65 self.assertEqual([], + 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.assertEqual(['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.assertEqual(['FooBar', 'BarFoo'], + 78 tree.xpath('/a/b/text()')) + 79 self.assertEqual([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.assertEqual(['FooBar', 'BarFoo'], + 86 tree.xpath('/a/b/text()', smart_strings=True)) + 87 self.assertEqual([root[0], root[1]], + 88 [r.getparent() for r in + 89 tree.xpath('/a/b/text()', smart_strings=True)]) + 90 self.assertEqual([None, None], + 91 [r.attrname for r in + 92 tree.xpath('/a/b/text()', smart_strings=True)]) + 93 + 94 self.assertEqual(['FooBar', 'BarFoo'], + 95 tree.xpath('/a/b/text()', smart_strings=False)) + 96 self.assertEqual([False, False], + 97 [hasattr(r, 'getparent') for r in + 98 tree.xpath('/a/b/text()', smart_strings=False)]) + 99 self.assertEqual([None, None], +100 [r.attrname for r in +101 tree.xpath('/a/b/text()', smart_strings=True)]) +
102 +
104 xml = _bytes('<a><b>FooBar\\u0680\\u3120</b><b>BarFoo\\u0680\\u3120</b></a>').decode("unicode_escape") +105 tree = self.parse(xml.encode('utf-8')) +106 root = tree.getroot() +107 self.assertEqual([_bytes('FooBar\\u0680\\u3120').decode("unicode_escape"), +108 _bytes('BarFoo\\u0680\\u3120').decode("unicode_escape")], +109 tree.xpath('/a/b/text()')) +110 self.assertEqual([root[0], root[1]], +111 [r.getparent() for r in tree.xpath('/a/b/text()')]) +
112 +
113 - def test_xpath_list_attribute(self): +
114 tree = self.parse('<a b="B" c="C"/>') +115 self.assertEqual(['B'], +116 tree.xpath('/a/@b')) +
117 +
119 tree = self.parse('<a b="BaSdFgHjKl" c="CqWeRtZuI"/>') +120 results = tree.xpath('/a/@c') +121 self.assertEqual(1, len(results)) +122 self.assertEqual('CqWeRtZuI', results[0]) +123 self.assertEqual(tree.getroot().tag, results[0].getparent().tag) +
124 +
126 tree = self.parse('<a b="BaSdFgHjKl" c="CqWeRtZuI"/>') +127 +128 results = tree.xpath('/a/@c', smart_strings=True) +129 self.assertEqual(1, len(results)) +130 self.assertEqual('CqWeRtZuI', results[0]) +131 self.assertEqual('c', results[0].attrname) +132 self.assertEqual(tree.getroot().tag, results[0].getparent().tag) +133 +134 results = tree.xpath('/a/@c', smart_strings=False) +135 self.assertEqual(1, len(results)) +136 self.assertEqual('CqWeRtZuI', results[0]) +137 self.assertEqual(False, hasattr(results[0], 'getparent')) +138 self.assertEqual(False, hasattr(results[0], 'attrname')) +
139 +
141 xml_data = ''' +142 <table> +143 <item xml:id="k1"><value>v1</value></item> +144 <item xml:id="k2"><value>v2</value></item> +145 </table> +146 ''' +147 +148 def lookup(dummy, id): +149 return etree.XML(xml_data).xpath('id(%r)' % id) +
150 functions = {(None, 'lookup') : lookup} +151 +152 root = etree.XML('<dummy/>') +153 values = root.xpath("lookup('k1')/value/text()", +154 extensions=functions) +155 self.assertEqual(['v1'], values) +156 self.assertEqual('value', values[0].getparent().tag) +
157 +
158 - def test_xpath_list_comment(self): +
159 tree = self.parse('<a><!-- Foo --></a>') +160 self.assertEqual(['<!-- Foo -->'], +161 list(map(repr, tree.xpath('/a/node()')))) +
162 +
163 - def test_rel_xpath_boolean(self): +
164 root = etree.XML('<a><b><c/></b></a>') +165 el = root[0] +166 self.assertTrue(el.xpath('boolean(c)')) +167 self.assertTrue(not el.xpath('boolean(d)')) +
168 +
170 tree = self.parse('<a><c><b>Foo</b><b>Bar</b></c><c><b>Hey</b></c></a>') +171 root = tree.getroot() +172 c = root[0] +173 self.assertEqual([c[0], c[1]], +174 c.xpath('b')) +175 self.assertEqual([c[0], c[1], root[1][0]], +176 c.xpath('//b')) +
177 +
178 - def test_xpath_ns(self): +
179 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +180 root = tree.getroot() +181 self.assertEqual( +182 [root[0]], +183 tree.xpath('//foo:b', namespaces={'foo': 'uri:a'})) +184 self.assertEqual( +185 [], +186 tree.xpath('//foo:b', namespaces={'foo': 'uri:c'})) +187 self.assertEqual( +188 [root[0]], +189 root.xpath('//baz:b', namespaces={'baz': 'uri:a'})) +
190 +
191 - def test_xpath_ns_none(self): +
192 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +193 root = tree.getroot() +194 self.assertRaises( +195 TypeError, +196 root.xpath, '//b', namespaces={None: 'uri:a'}) +
197 +
198 - def test_xpath_ns_empty(self): +
199 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +200 root = tree.getroot() +201 self.assertRaises( +202 TypeError, +203 root.xpath, '//b', namespaces={'': 'uri:a'}) +
204 +
205 - def test_xpath_error(self): +
206 tree = self.parse('<a/>') +207 self.assertRaises(etree.XPathEvalError, tree.xpath, '\\fad') +
208 +
209 - def test_xpath_class_error(self): +
210 self.assertRaises(SyntaxError, etree.XPath, '\\fad') +211 self.assertRaises(etree.XPathSyntaxError, etree.XPath, '\\fad') +
212 +
213 - def test_xpath_prefix_error(self): +
214 tree = self.parse('<a/>') +215 self.assertRaises(etree.XPathEvalError, tree.xpath, '/fa:d') +
216 +
218 tree = self.parse('<a/>') +219 xpath = etree.XPath("/fa:d") +220 self.assertRaises(etree.XPathEvalError, xpath, tree) +
221 +
222 - def test_elementtree_getpath(self): +
223 a = etree.Element("a") +224 b = etree.SubElement(a, "b") +225 c = etree.SubElement(a, "c") +226 d1 = etree.SubElement(c, "d") +227 d2 = etree.SubElement(c, "d") +228 +229 tree = etree.ElementTree(a) +230 self.assertEqual('/a/c/d', +231 tree.getpath(d2)[:6]) +232 self.assertEqual([d2], +233 tree.xpath(tree.getpath(d2))) +
234 +
236 a = etree.Element("a") +237 b = etree.SubElement(a, "b") +238 c = etree.SubElement(a, "c") +239 d1 = etree.SubElement(c, "d") +240 d2 = etree.SubElement(c, "d") +241 +242 tree = etree.ElementTree(c) +243 self.assertEqual('/c/d', +244 tree.getpath(d2)[:4]) +245 self.assertEqual([d2], +246 tree.xpath(tree.getpath(d2))) +
247 +
248 - def test_xpath_evaluator(self): +
249 tree = self.parse('<a><b><c></c></b></a>') +250 e = etree.XPathEvaluator(tree) +251 root = tree.getroot() +252 self.assertEqual( +253 [root], +254 e('//a')) +
255 +
256 - def test_xpath_evaluator_tree(self): +
257 tree = self.parse('<a><b><c></c></b></a>') +258 child_tree = etree.ElementTree(tree.getroot()[0]) +259 e = etree.XPathEvaluator(child_tree) +260 self.assertEqual( +261 [], +262 e('a')) +263 root = child_tree.getroot() +264 self.assertEqual( +265 [root[0]], +266 e('c')) +
267 +
269 tree = self.parse('<a><b><c></c></b></a>') +270 child_tree = etree.ElementTree(tree.getroot()[0]) +271 e = etree.XPathEvaluator(child_tree) +272 self.assertEqual( +273 [], +274 e('/a')) +275 root = child_tree.getroot() +276 self.assertEqual( +277 [root], +278 e('/b')) +279 self.assertEqual( +280 [], +281 e('/c')) +
282 +
284 tree = self.parse('<a><b><c></c></b></a>') +285 root = tree.getroot() +286 e = etree.XPathEvaluator(root[0]) +287 self.assertEqual( +288 [root[0][0]], +289 e('c')) +
290 +
291 - def test_xpath_extensions(self): +
292 def foo(evaluator, a): +293 return 'hello %s' % a +
294 extension = {(None, 'foo'): foo} +295 tree = self.parse('<a><b></b></a>') +296 e = etree.XPathEvaluator(tree, extensions=[extension]) +297 self.assertEqual( +298 "hello you", e("foo('you')")) +299 +
301 def foo(evaluator, a, b): +302 return "hello %s and %s" % (a, b) +
303 extension = {(None, 'foo'): foo} +304 tree = self.parse('<a><b></b></a>') +305 e = etree.XPathEvaluator(tree, extensions=[extension]) +306 self.assertRaises(TypeError, e, "foo('you')") +307 +
309 def foo(evaluator, a): +310 return 1/0 +
311 extension = {(None, 'foo'): foo} +312 tree = self.parse('<a/>') +313 e = etree.XPathEvaluator(tree, extensions=[extension]) +314 self.assertRaises(ZeroDivisionError, e, "foo('test')") +315 +
317 def f(evaluator, arg): +318 r = etree.Element('results') +319 b = etree.SubElement(r, 'result') +320 b.text = 'Hoi' +321 b = etree.SubElement(r, 'result') +322 b.text = 'Dag' +323 return r +
324 +325 x = self.parse('<a/>') +326 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +327 r = e("foo('World')/result") +328 self.assertEqual(2, len(r)) +329 self.assertEqual('Hoi', r[0].text) +330 self.assertEqual('Dag', r[1].text) +331 +
333 def f(evaluator, nodes): +334 r = etree.SubElement(nodes[0], 'results') +335 b = etree.SubElement(r, 'result') +336 b.text = 'Hoi' +337 b = etree.SubElement(r, 'result') +338 b.text = 'Dag' +339 return r +
340 +341 x = self.parse('<a/>') +342 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +343 r = e("foo(/*)/result") +344 self.assertEqual(2, len(r)) +345 self.assertEqual('Hoi', r[0].text) +346 self.assertEqual('Dag', r[1].text) +347 +
349 def f(evaluator, nodes): +350 r = etree.Element('results') +351 b = etree.SubElement(r, 'result') +352 b.text = 'Hoi' +353 b = etree.SubElement(r, 'result') +354 b.text = 'Dag' +355 r.append(nodes[0]) +356 return r +
357 +358 x = self.parse('<result>Honk</result>') +359 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +360 r = e("foo(/*)/result") +361 self.assertEqual(3, len(r)) +362 self.assertEqual('Hoi', r[0].text) +363 self.assertEqual('Dag', r[1].text) +364 self.assertEqual('Honk', r[2].text) +365 +
366 - def test_xpath_context_node(self): +
367 tree = self.parse('<root><a/><b><c/></b></root>') +368 +369 check_call = [] +370 def check_context(ctxt, nodes): +371 self.assertEqual(len(nodes), 1) +372 check_call.append(nodes[0].tag) +373 self.assertEqual(ctxt.context_node, nodes[0]) +374 return True +
375 +376 find = etree.XPath("//*[p:foo(.)]", +377 namespaces={'p' : 'ns'}, +378 extensions=[{('ns', 'foo') : check_context}]) +379 find(tree) +380 +381 check_call.sort() +382 self.assertEqual(check_call, ["a", "b", "c", "root"]) +383 +
385 tree = self.parse('<root><a/><b><c/></b></root>') +386 +387 check_call = {} +388 def check_context(ctxt, nodes): +389 self.assertEqual(len(nodes), 1) +390 tag = nodes[0].tag +391 # empty during the "b" call, a "b" during the "c" call +392 check_call[tag] = ctxt.eval_context.get("b") +393 ctxt.eval_context[tag] = tag +394 return True +
395 +396 find = etree.XPath("//b[p:foo(.)]/c[p:foo(.)]", +397 namespaces={'p' : 'ns'}, +398 extensions=[{('ns', 'foo') : check_context}]) +399 result = find(tree) +400 +401 self.assertEqual(result, [tree.getroot()[1][0]]) +402 self.assertEqual(check_call, {'b':None, 'c':'b'}) +403 +
405 tree = self.parse('<root><a/><b><c/></b></root>') +406 +407 check_call = {} +408 def check_context(ctxt): +409 check_call["done"] = True +410 # context must be empty for each new evaluation +411 self.assertEqual(len(ctxt.eval_context), 0) +412 ctxt.eval_context["test"] = True +413 return True +
414 +415 find = etree.XPath("//b[p:foo()]", +416 namespaces={'p' : 'ns'}, +417 extensions=[{('ns', 'foo') : check_context}]) +418 result = find(tree) +419 +420 self.assertEqual(result, [tree.getroot()[1]]) +421 self.assertEqual(check_call["done"], True) +422 +423 check_call.clear() +424 find = etree.XPath("//b[p:foo()]", +425 namespaces={'p' : 'ns'}, +426 extensions=[{('ns', 'foo') : check_context}]) +427 result = find(tree) +428 +429 self.assertEqual(result, [tree.getroot()[1]]) +430 self.assertEqual(check_call["done"], True) +431 +
432 - def test_xpath_variables(self): +
433 x = self.parse('<a attr="true"/>') +434 e = etree.XPathEvaluator(x) +435 +436 expr = "/a[@attr=$aval]" +437 r = e(expr, aval=1) +438 self.assertEqual(0, len(r)) +439 +440 r = e(expr, aval="true") +441 self.assertEqual(1, len(r)) +442 self.assertEqual("true", r[0].get('attr')) +443 +444 r = e(expr, aval=True) +445 self.assertEqual(1, len(r)) +446 self.assertEqual("true", r[0].get('attr')) +
447 +
449 x = self.parse('<a attr="true"/>') +450 e = etree.XPathEvaluator(x) +451 +452 element = etree.Element("test-el") +453 etree.SubElement(element, "test-sub") +454 expr = "$value" +455 r = e(expr, value=element) +456 self.assertEqual(1, len(r)) +457 self.assertEqual(element.tag, r[0].tag) +458 self.assertEqual(element[0].tag, r[0][0].tag) +
459 +
460 - def test_xpath_extensions_mix(self): +
461 x = self.parse('<a attr="true"><test/></a>') +462 +463 class LocalException(Exception): +464 pass +
465 +466 def foo(evaluator, a, varval): +467 etree.Element("DUMMY") +468 if varval == 0: +469 raise LocalException +470 elif varval == 1: +471 return () +472 elif varval == 2: +473 return None +474 elif varval == 3: +475 return a[0][0] +476 a = a[0] +477 if a.get("attr") == str(varval): +478 return a +479 else: +480 return etree.Element("NODE") +481 +482 extension = {(None, 'foo'): foo} +483 e = etree.XPathEvaluator(x, extensions=[extension]) +484 del x +485 +486 self.assertRaises(LocalException, e, "foo(., 0)") +487 self.assertRaises(LocalException, e, "foo(., $value)", value=0) +488 +489 r = e("foo(., $value)", value=1) +490 self.assertEqual(len(r), 0) +491 +492 r = e("foo(., 1)") +493 self.assertEqual(len(r), 0) +494 +495 r = e("foo(., $value)", value=2) +496 self.assertEqual(len(r), 0) +497 +498 r = e("foo(., $value)", value=3) +499 self.assertEqual(len(r), 1) +500 self.assertEqual(r[0].tag, "test") +501 +502 r = e("foo(., $value)", value="false") +503 self.assertEqual(len(r), 1) +504 self.assertEqual(r[0].tag, "NODE") +505 +506 r = e("foo(., 'false')") +507 self.assertEqual(len(r), 1) +508 self.assertEqual(r[0].tag, "NODE") +509 +510 r = e("foo(., 'true')") +511 self.assertEqual(len(r), 1) +512 self.assertEqual(r[0].tag, "a") +513 self.assertEqual(r[0][0].tag, "test") +514 +515 r = e("foo(., $value)", value="true") +516 self.assertEqual(len(r), 1) +517 self.assertEqual(r[0].tag, "a") +518 +519 self.assertRaises(LocalException, e, "foo(., 0)") +520 self.assertRaises(LocalException, e, "foo(., $value)", value=0) +521 +522 +
523 -class ETreeXPathClassTestCase(HelperTestCase): +
524 "Tests for the XPath class" +
525 - def test_xpath_compile_doc(self): +
526 x = self.parse('<a attr="true"/>') +527 +528 expr = etree.XPath("/a[@attr != 'true']") +529 r = expr(x) +530 self.assertEqual(0, len(r)) +531 +532 expr = etree.XPath("/a[@attr = 'true']") +533 r = expr(x) +534 self.assertEqual(1, len(r)) +535 +536 expr = etree.XPath( expr.path ) +537 r = expr(x) +538 self.assertEqual(1, len(r)) +
539 +
540 - def test_xpath_compile_element(self): +
541 x = self.parse('<a><b/><c/></a>') +542 root = x.getroot() +543 +544 expr = etree.XPath("./b") +545 r = expr(root) +546 self.assertEqual(1, len(r)) +547 self.assertEqual('b', r[0].tag) +548 +549 expr = etree.XPath("./*") +550 r = expr(root) +551 self.assertEqual(2, len(r)) +
552 +
553 - def test_xpath_compile_vars(self): +
554 x = self.parse('<a attr="true"/>') +555 +556 expr = etree.XPath("/a[@attr=$aval]") +557 r = expr(x, aval=False) +558 self.assertEqual(0, len(r)) +559 +560 r = expr(x, aval=True) +561 self.assertEqual(1, len(r)) +
562 +
563 - def test_xpath_compile_error(self): +
564 self.assertRaises(SyntaxError, etree.XPath, '\\fad') +
565 +
567 self.assertRaises(ValueError, etree.XPath('*'), etree.ElementTree()) +
568 +569 +
570 -class ETreeXPathExsltTestCase(HelperTestCase): +
571 "Tests for the EXSLT support in XPath (requires libxslt 1.1.25+)" +572 +573 NSMAP = dict( +574 date = "http://exslt.org/dates-and-times", +575 math = "http://exslt.org/math", +576 set = "http://exslt.org/sets", +577 str = "http://exslt.org/strings", +578 ) +579 +
581 tree = self.parse('<a><b>2009-11-12</b><b>2008-12-11</b></a>') +582 +583 match_dates = tree.xpath('//b[date:year(string()) = 2009]', +584 namespaces=self.NSMAP) +585 self.assertTrue(match_dates, str(match_dates)) +586 self.assertEqual(len(match_dates), 1, str(match_dates)) +587 self.assertEqual(match_dates[0].text, '2009-11-12') +
588 +
590 tree = self.parse('<a><b>2009-11-12</b><b>2008-12-11</b></a>') +591 +592 aligned_date = tree.xpath( +593 'str:align(string(//b[1]), "%s", "center")' % ('-'*20), +594 namespaces=self.NSMAP) +595 self.assertTrue(aligned_date, str(aligned_date)) +596 self.assertEqual(aligned_date, '-----2009-11-12-----') +
597 +598 +
599 -class ETreeETXPathClassTestCase(HelperTestCase): +
600 "Tests for the ETXPath class" +
601 - def test_xpath_compile_ns(self): +
602 x = self.parse('<a><b xmlns="nsa"/><b xmlns="nsb"/></a>') +603 +604 expr = etree.ETXPath("/a/{nsa}b") +605 r = expr(x) +606 self.assertEqual(1, len(r)) +607 self.assertEqual('{nsa}b', r[0].tag) +608 +609 expr = etree.ETXPath("/a/{nsb}b") +610 r = expr(x) +611 self.assertEqual(1, len(r)) +612 self.assertEqual('{nsb}b', r[0].tag) +
613 +614 # disabled this test as non-ASCII characters in namespace URIs are +615 # not acceptable +
617 x = self.parse(_bytes('<a><b xmlns="http://nsa/\\uf8d2"/><b xmlns="http://nsb/\\uf8d1"/></a>' +618 ).decode("unicode_escape")) +619 +620 expr = etree.ETXPath(_bytes("/a/{http://nsa/\\uf8d2}b").decode("unicode_escape")) +621 r = expr(x) +622 self.assertEqual(1, len(r)) +623 self.assertEqual(_bytes('{http://nsa/\\uf8d2}b').decode("unicode_escape"), r[0].tag) +624 +625 expr = etree.ETXPath(_bytes("/a/{http://nsb/\\uf8d1}b").decode("unicode_escape")) +626 r = expr(x) +627 self.assertEqual(1, len(r)) +628 self.assertEqual(_bytes('{http://nsb/\\uf8d1}b').decode("unicode_escape"), r[0].tag) +
629 +630 SAMPLE_XML = etree.parse(BytesIO(""" +631 <body> +632 <tag>text</tag> +633 <section> +634 <tag>subtext</tag> +635 </section> +636 <tag /> +637 <tag /> +638 </body> +639 """)) +640 +
641 -def tag(elem): +
642 return elem.tag +
643 +
644 -def tag_or_value(elem): +
645 return getattr(elem, 'tag', elem) +
646 +
647 -def stringTest(ctxt, s1): +
648 return "Hello "+s1 +
649 +
650 -def stringListTest(ctxt, s1): +
651 return ["Hello "] + list(s1) + ["!"] +
652 +
653 -def floatTest(ctxt, f1): +
654 return f1+4 +
655 +
656 -def booleanTest(ctxt, b1): +
657 return not b1 +
658 +
659 -def setTest(ctxt, st1): +
660 return st1[0] +
661 +
662 -def setTest2(ctxt, st1): +
663 return st1[0:2] +
664 +
665 -def argsTest1(ctxt, s, f, b, st): +
666 return ", ".join(map(str, (s, f, b, list(map(tag, st))))) +
667 +
668 -def argsTest2(ctxt, st1, st2): +
669 st1.extend(st2) +670 return st1 +
671 +
672 -def resultTypesTest(ctxt): +
673 return [None,None] +
674 +
675 -def resultTypesTest2(ctxt): +
676 return resultTypesTest +
677 +678 uri = "http://www.example.com/" +679 +680 extension = {(None, 'stringTest'): stringTest, +681 (None, 'stringListTest'): stringListTest, +682 (None, 'floatTest'): floatTest, +683 (None, 'booleanTest'): booleanTest, +684 (None, 'setTest'): setTest, +685 (None, 'setTest2'): setTest2, +686 (None, 'argsTest1'): argsTest1, +687 (None, 'argsTest2'): argsTest2, +688 (None, 'resultTypesTest'): resultTypesTest, +689 (None, 'resultTypesTest2'): resultTypesTest2,} +690 +
691 -def xpath(): +
692 """ +693 Test xpath extension functions. +694 +695 >>> root = SAMPLE_XML +696 >>> e = etree.XPathEvaluator(root, extensions=[extension]) +697 >>> e("stringTest('you')") +698 'Hello you' +699 >>> e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape")) +700 u'Hello \\xe9lan' +701 >>> e("stringTest('you','there')") #doctest: +ELLIPSIS +702 Traceback (most recent call last): +703 ... +704 TypeError: stringTest() takes... 2 ...arguments ... +705 >>> e("floatTest(2)") +706 6.0 +707 >>> e("booleanTest(true())") +708 False +709 >>> list(map(tag, e("setTest(/body/tag)"))) +710 ['tag'] +711 >>> list(map(tag, e("setTest2(/body/*)"))) +712 ['tag', 'section'] +713 >>> list(map(tag_or_value, e("stringListTest(/body/tag)"))) +714 ['Hello ', 'tag', 'tag', 'tag', '!'] +715 >>> e("argsTest1('a',1.5,true(),/body/tag)") +716 "a, 1.5, True, ['tag', 'tag', 'tag']" +717 >>> list(map(tag, e("argsTest2(/body/tag, /body/section)"))) +718 ['tag', 'section', 'tag', 'tag'] +719 >>> e("resultTypesTest()") +720 Traceback (most recent call last): +721 ... +722 XPathResultError: This is not a supported node-set result: None +723 >>> try: +724 ... e("resultTypesTest2()") +725 ... except etree.XPathResultError: +726 ... print("Got error") +727 Got error +728 """ +
729 +730 if sys.version_info[0] >= 3: +731 xpath.__doc__ = xpath.__doc__.replace(" u'", " '") +732 xpath.__doc__ = xpath.__doc__.replace(" XPathResultError", +733 " lxml.etree.XPathResultError") +734 xpath.__doc__ = xpath.__doc__.replace(" exactly 2 arguments", +735 " exactly 2 positional arguments") +736 +
737 -def test_suite(): +
738 suite = unittest.TestSuite() +739 suite.addTests([unittest.makeSuite(ETreeXPathTestCase)]) +740 suite.addTests([unittest.makeSuite(ETreeXPathClassTestCase)]) +741 if etree.LIBXSLT_COMPILED_VERSION >= (1,1,25): +742 suite.addTests([unittest.makeSuite(ETreeXPathExsltTestCase)]) +743 suite.addTests([unittest.makeSuite(ETreeETXPathClassTestCase)]) +744 suite.addTests([doctest.DocTestSuite()]) +745 suite.addTests( +746 [make_doctest('../../../doc/xpathxslt.txt')]) +747 return suite +
748 +749 if __name__ == '__main__': +750 print('to test use test.py %s' % __file__) +751 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..c9589667 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html @@ -0,0 +1,379 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeETXPathClassTestCase
+
+ +
+Tests for the ETXPath class + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..ba8ee68b --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html @@ -0,0 +1,427 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXPathClassTestCase
+
+ +
+Tests for the XPath class + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html new file mode 100644 index 00000000..010ac467 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html @@ -0,0 +1,429 @@ + + + + + lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator :: + Class ETreeXPathExsltTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXPathExsltTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXPathExsltTestCase
+
+ +
+Tests for the EXSLT support in XPath (requires libxslt 1.1.25+) + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xpath_exslt_functions_date(self) + source code + +
+ +
+   + + + + + + +
test_xpath_exslt_functions_strings(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + NSMAP = {'date': 'http://exslt.org/dates-and-times', 'math': '... +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

NSMAP

+ +
+
+
+
Value:
+
+{'date': 'http://exslt.org/dates-and-times',
+ 'math': 'http://exslt.org/math',
+ 'set': 'http://exslt.org/sets',
+ 'str': 'http://exslt.org/strings'}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..016848c8 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html @@ -0,0 +1,1051 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXPathTestCase
+
+ +
+XPath tests etree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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_text_from_other_document(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..1145e67a --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt-module.html @@ -0,0 +1,302 @@ + + + + + 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]
+
+   + + unicode
+ str(object='') -> string +
+   + + basestring
+ str(object='') -> string +
+   + + ETreeXSLTTestCase
+ XSLT tests etree +
+   + + ETreeEXSLTTestCase
+ EXSLT tests +
+   + + ETreeXSLTExtFuncTestCase
+ Tests for XPath extension functions in XSLT. +
+   + + ETreeXSLTExtElementTestCase
+ Tests for extension elements in XSLT. +
+   + + Py3XSLTTestCase
+ XSLT tests for etree under Python 3 +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/stefan/source/Python/lxml/lxml-release/src/l... +
+   + + is_python3 = False +
+   + + __package__ = 'lxml.tests' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/stefan/source/Python/lxml/lxml-release/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 00000000..4a7c1d3d --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt-pysrc.html @@ -0,0 +1,5146 @@ + + + + + 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 io 
+   8  import sys 
+   9  import copy 
+  10  import gzip 
+  11  import os.path 
+  12  import unittest 
+  13  import contextlib 
+  14  from textwrap import dedent 
+  15  from tempfile import NamedTemporaryFile, mkdtemp 
+  16   
+  17  this_dir = os.path.dirname(__file__) 
+  18  if this_dir not in sys.path: 
+  19      sys.path.insert(0, this_dir) # needed for Py3 
+  20   
+  21  is_python3 = sys.version_info[0] >= 3 
+  22   
+  23  try: 
+  24      unicode 
+  25  except NameError: # Python 3 
+  26      unicode = str 
+  27   
+  28  try: 
+  29      basestring 
+  30  except NameError: # Python 3 
+  31      basestring = str 
+  32   
+  33  from .common_imports import etree, BytesIO, HelperTestCase, fileInTestDir 
+  34  from .common_imports import doctest, _bytes, _str, make_doctest, skipif 
+
35 + 36 -class ETreeXSLTTestCase(HelperTestCase): +
37 """XSLT tests etree""" + 38 +
39 - def test_xslt(self): +
40 tree = self.parse('<a><b>B</b><c>C</c></a>') + 41 style = self.parse('''\ + 42 <xsl:stylesheet version="1.0" + 43 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 44 <xsl:template match="*" /> + 45 <xsl:template match="/"> + 46 <foo><xsl:value-of select="/a/b/text()" /></foo> + 47 </xsl:template> + 48 </xsl:stylesheet>''') + 49 + 50 st = etree.XSLT(style) + 51 res = st(tree) + 52 self.assertEqual('''\ + 53 <?xml version="1.0"?> + 54 <foo>B</foo> + 55 ''', + 56 str(res)) +
57 +
59 self.assertRaises(ValueError, etree.XSLT, etree.ElementTree()) +
60 +
61 - def test_xslt_input_none(self): +
62 self.assertRaises(TypeError, etree.XSLT, None) +
63 +
65 style = self.parse('''\ + 66 <xsl:stylesheet version="1.0" + 67 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 68 <xsl:stylesheet /> + 69 </xsl:stylesheet>''') + 70 + 71 self.assertRaises( + 72 etree.XSLTParseError, etree.XSLT, style) +
73 +
74 - def test_xslt_copy(self): +
75 tree = self.parse('<a><b>B</b><c>C</c></a>') + 76 style = self.parse('''\ + 77 <xsl:stylesheet version="1.0" + 78 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 79 <xsl:template match="*" /> + 80 <xsl:template match="/"> + 81 <foo><xsl:value-of select="/a/b/text()" /></foo> + 82 </xsl:template> + 83 </xsl:stylesheet>''') + 84 + 85 transform = etree.XSLT(style) + 86 res = transform(tree) + 87 self.assertEqual('''\ + 88 <?xml version="1.0"?> + 89 <foo>B</foo> + 90 ''', + 91 str(res)) + 92 + 93 transform_copy = copy.deepcopy(transform) + 94 res = transform_copy(tree) + 95 self.assertEqual('''\ + 96 <?xml version="1.0"?> + 97 <foo>B</foo> + 98 ''', + 99 str(res)) + 100 + 101 transform = etree.XSLT(style) + 102 res = transform(tree) + 103 self.assertEqual('''\ + 104 <?xml version="1.0"?> + 105 <foo>B</foo> + 106 ''', + 107 str(res)) +
108 + 109 @contextlib.contextmanager +
110 - def _xslt_setup( + 111 self, encoding='UTF-16', expected_encoding=None, + 112 expected='<?xml version="1.0" encoding="%(ENCODING)s"?><foo>\\uF8D2</foo>'): +
113 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 114 ).decode("unicode_escape")) + 115 style = self.parse('''\ + 116 <xsl:stylesheet version="1.0" + 117 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 118 <xsl:output encoding="%(ENCODING)s"/> + 119 <xsl:template match="/"> + 120 <foo><xsl:value-of select="/a/b/text()" /></foo> + 121 </xsl:template> + 122 </xsl:stylesheet>''' % {'ENCODING': encoding}) + 123 + 124 st = etree.XSLT(style) + 125 res = st(tree) + 126 expected = _bytes(dedent(expected).strip()).decode("unicode_escape").replace('\n', '') % { + 127 'ENCODING': expected_encoding or encoding, + 128 } + 129 + 130 data = [res] + 131 yield data + 132 self.assertEqual(expected, data[0].replace('\n', '')) +
133 +
134 - def test_xslt_utf8(self): +
135 with self._xslt_setup(encoding='UTF-8') as res: + 136 res[0] = unicode(bytes(res[0]), 'UTF-8') + 137 assert 'UTF-8' in res[0] +
138 +
139 - def test_xslt_encoding(self): +
140 with self._xslt_setup() as res: + 141 res[0] = unicode(bytes(res[0]), 'UTF-16') + 142 assert 'UTF-16' in res[0] +
143 +
144 - def test_xslt_encoding_override(self): +
145 with self._xslt_setup(encoding='UTF-8', expected_encoding='UTF-16') as res: + 146 f = BytesIO() + 147 res[0].write(f, encoding='UTF-16') + 148 if is_python3: + 149 output = str(f.getvalue(), 'UTF-16') + 150 else: + 151 output = unicode(str(f.getvalue()), 'UTF-16') + 152 res[0] = output.replace("'", '"') +
153 +
155 with self._xslt_setup() as res: + 156 f = BytesIO() + 157 res[0].write_output(f) + 158 res[0] = f.getvalue().decode('UTF-16') +
159 +
161 class Writer(object): + 162 def write(self, data): + 163 raise ValueError("FAILED!") +
164 + 165 try: + 166 with self._xslt_setup() as res: + 167 res[0].write_output(Writer()) + 168 except ValueError as exc: + 169 self.assertTrue("FAILED!" in str(exc), exc) + 170 else: + 171 self.assertTrue(False, "exception not raised") + 172 +
173 - def test_xslt_write_output_file(self): +
174 with self._xslt_setup() as res: + 175 f = NamedTemporaryFile(delete=False) + 176 try: + 177 try: + 178 res[0].write_output(f) + 179 finally: + 180 f.close() + 181 with io.open(f.name, encoding='UTF-16') as f: + 182 res[0] = f.read() + 183 finally: + 184 os.unlink(f.name) +
185 +
187 with self._xslt_setup() as res: + 188 f = NamedTemporaryFile(delete=False) + 189 try: + 190 try: + 191 res[0].write_output(f.name, compression=9) + 192 finally: + 193 f.close() + 194 with gzip.GzipFile(f.name) as f: + 195 res[0] = f.read().decode("UTF-16") + 196 finally: + 197 os.unlink(f.name) +
198 +
200 # libxml2 should not unescape file paths. + 201 with self._xslt_setup() as res: + 202 f = NamedTemporaryFile(prefix='tmp%2e', suffix='.xml.gz', delete=False) + 203 try: + 204 try: + 205 res[0].write_output(f.name, compression=3) + 206 finally: + 207 f.close() + 208 with gzip.GzipFile(f.name) as f: + 209 res[0] = f.read().decode("UTF-16") + 210 finally: + 211 os.unlink(f.name) +
212 +
214 with self._xslt_setup() as res: + 215 f = NamedTemporaryFile(prefix='p+%2e', suffix='.xml.gz', delete=False) + 216 try: + 217 try: + 218 res[0].write_output(f.name, compression=1) + 219 finally: + 220 f.close() + 221 with gzip.GzipFile(f.name) as f: + 222 res[0] = f.read().decode("UTF-16") + 223 finally: + 224 os.unlink(f.name) +
225 +
227 with self._xslt_setup(expected='') as res: + 228 tempdir = mkdtemp() + 229 try: + 230 res[0].write_output(os.path.join(tempdir, 'missing_subdir', 'out.xml')) + 231 except IOError: + 232 res[0] = '' + 233 else: + 234 self.fail("IOError not raised") + 235 finally: + 236 os.rmdir(tempdir) +
237 +
238 - def test_xslt_unicode(self): +
239 expected = ''' + 240 <?xml version="1.0"?> + 241 <foo>\\uF8D2</foo> + 242 ''' + 243 with self._xslt_setup(expected=expected) as res: + 244 res[0] = unicode(res[0]) +
245 +
247 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 248 ).decode("unicode_escape")) + 249 style = self.parse('''\ + 250 <xsl:stylesheet version="1.0" + 251 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 252 <xsl:output encoding="UTF-16" standalone="no"/> + 253 <xsl:template match="/"> + 254 <foo><xsl:value-of select="/a/b/text()" /></foo> + 255 </xsl:template> + 256 </xsl:stylesheet>''') + 257 + 258 st = etree.XSLT(style) + 259 res = st(tree) + 260 expected = _bytes('''\ + 261 <?xml version="1.0" standalone="no"?> + 262 <foo>\\uF8D2</foo> + 263 ''').decode("unicode_escape") + 264 self.assertEqual(expected, + 265 unicode(res)) +
266 +
267 - def test_xslt_input(self): +
268 style = self.parse('''\ + 269 <xsl:stylesheet version="1.0" + 270 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 271 <xsl:template match="*" /> + 272 <xsl:template match="/"> + 273 <foo><xsl:value-of select="/a/b/text()" /></foo> + 274 </xsl:template> + 275 </xsl:stylesheet>''') + 276 + 277 st = etree.XSLT(style) + 278 st = etree.XSLT(style.getroot()) +
279 +
280 - def test_xslt_input_partial_doc(self): +
281 style = self.parse('''\ + 282 <otherroot> + 283 <xsl:stylesheet version="1.0" + 284 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 285 <xsl:template match="*" /> + 286 <xsl:template match="/"> + 287 <foo><xsl:value-of select="/a/b/text()" /></foo> + 288 </xsl:template> + 289 </xsl:stylesheet> + 290 </otherroot>''') + 291 + 292 self.assertRaises(etree.XSLTParseError, etree.XSLT, style) + 293 root_node = style.getroot() + 294 self.assertRaises(etree.XSLTParseError, etree.XSLT, root_node) + 295 st = etree.XSLT(root_node[0]) +
296 +
297 - def test_xslt_broken(self): +
298 style = self.parse('''\ + 299 <xsl:stylesheet version="1.0" + 300 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 301 <xsl:foo /> + 302 </xsl:stylesheet>''') + 303 self.assertRaises(etree.XSLTParseError, + 304 etree.XSLT, style) +
305 +
306 - def test_xslt_parsing_error_log(self): +
307 tree = self.parse('<a/>') + 308 style = self.parse('''\ + 309 <xsl:stylesheet version="1.0" + 310 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 311 <xsl:foo /> + 312 </xsl:stylesheet>''') + 313 self.assertRaises(etree.XSLTParseError, + 314 etree.XSLT, style) + 315 exc = None + 316 try: + 317 etree.XSLT(style) + 318 except etree.XSLTParseError as e: + 319 exc = e + 320 else: + 321 self.assertFalse(True, "XSLT processing should have failed but didn't") + 322 self.assertTrue(exc is not None) + 323 self.assertTrue(len(exc.error_log)) + 324 for error in exc.error_log: + 325 self.assertTrue(':ERROR:XSLT:' in str(error)) +
326 +
327 - def test_xslt_apply_error_log(self): +
328 tree = self.parse('<a/>') + 329 style = self.parse('''\ + 330 <xsl:stylesheet version="1.0" + 331 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 332 <xsl:template match="a"> + 333 <xsl:copy> + 334 <xsl:message terminate="yes">FAIL</xsl:message> + 335 </xsl:copy> + 336 </xsl:template> + 337 </xsl:stylesheet>''') + 338 self.assertRaises(etree.XSLTApplyError, + 339 etree.XSLT(style), tree) + 340 + 341 transform = etree.XSLT(style) + 342 exc = None + 343 try: + 344 transform(tree) + 345 except etree.XSLTApplyError as e: + 346 exc = e + 347 else: + 348 self.assertFalse(True, "XSLT processing should have failed but didn't") + 349 + 350 self.assertTrue(exc is not None) + 351 self.assertTrue(len(exc.error_log)) + 352 self.assertEqual(len(transform.error_log), len(exc.error_log)) + 353 for error in exc.error_log: + 354 self.assertTrue(':ERROR:XSLT:' in str(error)) + 355 for error in transform.error_log: + 356 self.assertTrue(':ERROR:XSLT:' in str(error)) +
357 +
358 - def test_xslt_parameters(self): +
359 tree = self.parse('<a><b>B</b><c>C</c></a>') + 360 style = self.parse('''\ + 361 <xsl:stylesheet version="1.0" + 362 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 363 <xsl:template match="/"> + 364 <foo><xsl:value-of select="$bar" /></foo> + 365 </xsl:template> + 366 </xsl:stylesheet>''') + 367 + 368 st = etree.XSLT(style) + 369 res = st(tree, bar="'Bar'") + 370 self.assertEqual('''\ + 371 <?xml version="1.0"?> + 372 <foo>Bar</foo> + 373 ''', + 374 str(res)) +
375 +
376 - def test_xslt_string_parameters(self): +
377 tree = self.parse('<a><b>B</b><c>C</c></a>') + 378 style = self.parse('''\ + 379 <xsl:stylesheet version="1.0" + 380 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 381 <xsl:template match="/"> + 382 <foo><xsl:value-of select="$bar" /></foo> + 383 </xsl:template> + 384 </xsl:stylesheet>''') + 385 + 386 st = etree.XSLT(style) + 387 res = st(tree, bar=etree.XSLT.strparam('''it's me, "Bar"''')) + 388 self.assertEqual('''\ + 389 <?xml version="1.0"?> + 390 <foo>it's me, "Bar"</foo> + 391 ''', + 392 str(res)) +
393 +
394 - def test_xslt_parameter_invalid(self): +
395 tree = self.parse('<a><b>B</b><c>C</c></a>') + 396 style = self.parse('''\ + 397 <xsl:stylesheet version="1.0" + 398 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 399 <xsl:param name="bar"/> + 400 <xsl:template match="/"> + 401 <foo><xsl:value-of select="$bar" /></foo> + 402 </xsl:template> + 403 </xsl:stylesheet>''') + 404 + 405 st = etree.XSLT(style) + 406 res = self.assertRaises(etree.XSLTApplyError, + 407 st, tree, bar="<test/>") + 408 res = self.assertRaises(etree.XSLTApplyError, + 409 st, tree, bar="....") +
410 +
411 - def test_xslt_parameter_missing(self): +
412 # apply() without needed parameter will lead to XSLTApplyError + 413 tree = self.parse('<a><b>B</b><c>C</c></a>') + 414 style = self.parse('''\ + 415 <xsl:stylesheet version="1.0" + 416 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 417 <xsl:template match="/"> + 418 <foo><xsl:value-of select="$bar" /></foo> + 419 </xsl:template> + 420 </xsl:stylesheet>''') + 421 + 422 st = etree.XSLT(style) + 423 # at least libxslt 1.1.28 produces this error, earlier ones (e.g. 1.1.18) might not ... + 424 self.assertRaises(etree.XSLTApplyError, st.apply, tree) +
425 +
427 tree = self.parse('<a><b>B</b><c>C</c></a>') + 428 style = self.parse('''\ + 429 <xsl:stylesheet version="1.0" + 430 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 431 <xsl:template match="*" /> + 432 <xsl:template match="/"> + 433 <foo><xsl:value-of select="$bar" /></foo> + 434 <foo><xsl:value-of select="$baz" /></foo> + 435 </xsl:template> + 436 </xsl:stylesheet>''') + 437 + 438 st = etree.XSLT(style) + 439 res = st(tree, bar="'Bar'", baz="'Baz'") + 440 self.assertEqual('''\ + 441 <?xml version="1.0"?> + 442 <foo>Bar</foo><foo>Baz</foo> + 443 ''', + 444 str(res)) +
445 +
446 - def test_xslt_parameter_xpath(self): +
447 tree = self.parse('<a><b>B</b><c>C</c></a>') + 448 style = self.parse('''\ + 449 <xsl:stylesheet version="1.0" + 450 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 451 <xsl:template match="*" /> + 452 <xsl:template match="/"> + 453 <foo><xsl:value-of select="$bar" /></foo> + 454 </xsl:template> + 455 </xsl:stylesheet>''') + 456 + 457 st = etree.XSLT(style) + 458 res = st(tree, bar="/a/b/text()") + 459 self.assertEqual('''\ + 460 <?xml version="1.0"?> + 461 <foo>B</foo> + 462 ''', + 463 str(res)) +
464 +
466 tree = self.parse('<a><b>B</b><c>C</c></a>') + 467 style = self.parse('''\ + 468 <xsl:stylesheet version="1.0" + 469 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 470 <xsl:template match="*" /> + 471 <xsl:template match="/"> + 472 <foo><xsl:value-of select="$bar" /></foo> + 473 </xsl:template> + 474 </xsl:stylesheet>''') + 475 + 476 st = etree.XSLT(style) + 477 res = st(tree, bar=etree.XPath("/a/b/text()")) + 478 self.assertEqual('''\ + 479 <?xml version="1.0"?> + 480 <foo>B</foo> + 481 ''', + 482 str(res)) +
483 +
485 tree = self.parse('<a><b>B</b><c>C</c></a>') + 486 style = self.parse('''\ + 487 <xsl:stylesheet version="1.0" + 488 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 489 <xsl:param name="bar" select="'Default'" /> + 490 <xsl:template match="*" /> + 491 <xsl:template match="/"> + 492 <foo><xsl:value-of select="$bar" /></foo> + 493 </xsl:template> + 494 </xsl:stylesheet>''') + 495 + 496 st = etree.XSLT(style) + 497 res = st(tree, bar="'Bar'") + 498 self.assertEqual('''\ + 499 <?xml version="1.0"?> + 500 <foo>Bar</foo> + 501 ''', + 502 str(res)) + 503 res = st(tree) + 504 self.assertEqual('''\ + 505 <?xml version="1.0"?> + 506 <foo>Default</foo> + 507 ''', + 508 str(res)) +
509 +
510 - def test_xslt_html_output(self): +
511 tree = self.parse('<a><b>B</b><c>C</c></a>') + 512 style = self.parse('''\ + 513 <xsl:stylesheet version="1.0" + 514 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 515 <xsl:output method="html"/> + 516 <xsl:strip-space elements="*"/> + 517 <xsl:template match="/"> + 518 <html><body><xsl:value-of select="/a/b/text()" /></body></html> + 519 </xsl:template> + 520 </xsl:stylesheet>''') + 521 + 522 st = etree.XSLT(style) + 523 res = st(tree) + 524 self.assertEqual('<html><body>B</body></html>', + 525 str(res).strip()) +
526 +
527 - def test_xslt_include(self): +
528 tree = etree.parse(fileInTestDir('test1.xslt')) + 529 st = etree.XSLT(tree) +
530 +
532 f = open(fileInTestDir('test1.xslt'), 'rb') + 533 tree = etree.parse(f) + 534 f.close() + 535 st = etree.XSLT(tree) +
536 +
538 xml = '<a/>' + 539 xslt = '''\ + 540 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 541 <xsl:template match="/"> + 542 <response>Some text</response> + 543 </xsl:template> + 544 </xsl:stylesheet> + 545 ''' + 546 source = self.parse(xml) + 547 styledoc = self.parse(xslt) + 548 style = etree.XSLT(styledoc) + 549 result = style(source) + 550 + 551 etree.tostring(result.getroot()) + 552 + 553 source = self.parse(xml) + 554 styledoc = self.parse(xslt) + 555 style = etree.XSLT(styledoc) + 556 result = style(source) + 557 + 558 etree.tostring(result.getroot()) +
559 +
560 - def test_xslt_repeat_transform(self): +
561 xml = '<a/>' + 562 xslt = '''\ + 563 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 564 <xsl:template match="/"> + 565 <response>Some text</response> + 566 </xsl:template> + 567 </xsl:stylesheet> + 568 ''' + 569 source = self.parse(xml) + 570 styledoc = self.parse(xslt) + 571 transform = etree.XSLT(styledoc) + 572 result = transform(source) + 573 result = transform(source) + 574 etree.tostring(result.getroot()) + 575 result = transform(source) + 576 etree.tostring(result.getroot()) + 577 str(result) + 578 + 579 result1 = transform(source) + 580 result2 = transform(source) + 581 self.assertEqual(str(result1), str(result2)) + 582 result = transform(source) + 583 str(result) +
584 +
585 - def test_xslt_empty(self): +
586 # could segfault if result contains "empty document" + 587 xml = '<blah/>' + 588 xslt = ''' + 589 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 590 <xsl:template match="/" /> + 591 </xsl:stylesheet> + 592 ''' + 593 + 594 source = self.parse(xml) + 595 styledoc = self.parse(xslt) + 596 style = etree.XSLT(styledoc) + 597 result = style(source) + 598 self.assertEqual('', str(result)) +
599 +
600 - def test_xslt_message(self): +
601 xml = '<blah/>' + 602 xslt = ''' + 603 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 604 <xsl:template match="/"> + 605 <xsl:message>TEST TEST TEST</xsl:message> + 606 </xsl:template> + 607 </xsl:stylesheet> + 608 ''' + 609 + 610 source = self.parse(xml) + 611 styledoc = self.parse(xslt) + 612 style = etree.XSLT(styledoc) + 613 result = style(source) + 614 self.assertEqual('', str(result)) + 615 self.assertTrue("TEST TEST TEST" in [entry.message + 616 for entry in style.error_log]) +
617 +
618 - def test_xslt_message_terminate(self): +
619 xml = '<blah/>' + 620 xslt = ''' + 621 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 622 <xsl:template match="/"> + 623 <xsl:message terminate="yes">TEST TEST TEST</xsl:message> + 624 </xsl:template> + 625 </xsl:stylesheet> + 626 ''' + 627 + 628 source = self.parse(xml) + 629 styledoc = self.parse(xslt) + 630 style = etree.XSLT(styledoc) + 631 + 632 self.assertRaises(etree.XSLTApplyError, style, source) + 633 self.assertTrue("TEST TEST TEST" in [entry.message + 634 for entry in style.error_log]) +
635 +
636 - def test_xslt_shortcut(self): +
637 tree = self.parse('<a><b>B</b><c>C</c></a>') + 638 style = self.parse('''\ + 639 <xsl:stylesheet version="1.0" + 640 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 641 <xsl:template match="*" /> + 642 <xsl:template match="/"> + 643 <doc> + 644 <foo><xsl:value-of select="$bar" /></foo> + 645 <foo><xsl:value-of select="$baz" /></foo> + 646 </doc> + 647 </xsl:template> + 648 </xsl:stylesheet>''') + 649 + 650 result = tree.xslt(style, bar="'Bar'", baz="'Baz'") + 651 self.assertEqual( + 652 _bytes('<doc><foo>Bar</foo><foo>Baz</foo></doc>'), + 653 etree.tostring(result.getroot())) +
654 +
655 - def test_multiple_elementrees(self): +
656 tree = self.parse('<a><b>B</b><c>C</c></a>') + 657 style = self.parse('''\ + 658 <xsl:stylesheet version="1.0" + 659 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 660 <xsl:template match="a"><A><xsl:apply-templates/></A></xsl:template> + 661 <xsl:template match="b"><B><xsl:apply-templates/></B></xsl:template> + 662 <xsl:template match="c"><C><xsl:apply-templates/></C></xsl:template> + 663 </xsl:stylesheet>''') + 664 + 665 self.assertEqual(self._rootstring(tree), + 666 _bytes('<a><b>B</b><c>C</c></a>')) + 667 result = tree.xslt(style) + 668 self.assertEqual(self._rootstring(tree), + 669 _bytes('<a><b>B</b><c>C</c></a>')) + 670 self.assertEqual(self._rootstring(result), + 671 _bytes('<A><B>B</B><C>C</C></A>')) + 672 + 673 b_tree = etree.ElementTree(tree.getroot()[0]) + 674 self.assertEqual(self._rootstring(b_tree), + 675 _bytes('<b>B</b>')) + 676 result = b_tree.xslt(style) + 677 self.assertEqual(self._rootstring(tree), + 678 _bytes('<a><b>B</b><c>C</c></a>')) + 679 self.assertEqual(self._rootstring(result), + 680 _bytes('<B>B</B>')) + 681 + 682 c_tree = etree.ElementTree(tree.getroot()[1]) + 683 self.assertEqual(self._rootstring(c_tree), + 684 _bytes('<c>C</c>')) + 685 result = c_tree.xslt(style) + 686 self.assertEqual(self._rootstring(tree), + 687 _bytes('<a><b>B</b><c>C</c></a>')) + 688 self.assertEqual(self._rootstring(result), + 689 _bytes('<C>C</C>')) +
690 +
691 - def test_xslt_document_XML(self): +
692 # make sure document('') works from parsed strings + 693 xslt = etree.XSLT(etree.XML("""\ + 694 <xsl:stylesheet version="1.0" + 695 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 696 <xsl:template match="/"> + 697 <test>TEXT<xsl:copy-of select="document('')//test"/></test> + 698 </xsl:template> + 699 </xsl:stylesheet> + 700 """)) + 701 result = xslt(etree.XML('<a/>')) + 702 root = result.getroot() + 703 self.assertEqual(root.tag, + 704 'test') + 705 self.assertEqual(root[0].tag, + 706 'test') + 707 self.assertEqual(root[0].text, + 708 'TEXT') + 709 self.assertEqual(root[0][0].tag, + 710 '{http://www.w3.org/1999/XSL/Transform}copy-of') +
711 +
712 - def test_xslt_document_parse(self): +
713 # make sure document('') works from loaded files + 714 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt"))) + 715 result = xslt(etree.XML('<a/>')) + 716 root = result.getroot() + 717 self.assertEqual(root.tag, + 718 'test') + 719 self.assertEqual(root[0].tag, + 720 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
721 +
723 # make sure document('') works from loaded files + 724 xslt = etree.XSLT(etree.ElementTree(file=fileInTestDir("test-document.xslt"))) + 725 result = xslt(etree.XML('<a/>')) + 726 root = result.getroot() + 727 self.assertEqual(root.tag, + 728 'test') + 729 self.assertEqual(root[0].tag, + 730 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
731 +
732 - def test_xslt_document_error(self): +
733 xslt = etree.XSLT(etree.XML("""\ + 734 <xsl:stylesheet version="1.0" + 735 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 736 <xsl:template match="/"> + 737 <test>TEXT<xsl:copy-of select="document('uri:__junkfood__is__evil__')//test"/></test> + 738 </xsl:template> + 739 </xsl:stylesheet> + 740 """)) + 741 + 742 errors = None + 743 try: + 744 xslt(etree.XML('<a/>')) + 745 except etree.XSLTApplyError as exc: + 746 errors = exc.error_log + 747 else: + 748 self.assertFalse(True, "XSLT processing should have failed but didn't") + 749 + 750 self.assertTrue(len(errors)) + 751 for error in errors: + 752 if ':ERROR:XSLT:' in str(error): + 753 break + 754 else: + 755 self.assertFalse(True, 'No XSLT errors found in error log:\n%s' % errors) +
756 +
758 # make sure document('') works when custom resolvers are in use + 759 assertEqual = self.assertEqual + 760 called = {'count' : 0} + 761 class TestResolver(etree.Resolver): + 762 def resolve(self, url, id, context): + 763 assertEqual(url, 'file://ANYTHING') + 764 called['count'] += 1 + 765 return self.resolve_string('<CALLED/>', context) +
766 + 767 parser = etree.XMLParser() + 768 parser.resolvers.add(TestResolver()) + 769 + 770 xslt = etree.XSLT(etree.XML(_bytes("""\ + 771 <xsl:stylesheet version="1.0" + 772 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 773 xmlns:l="local"> + 774 <xsl:template match="/"> + 775 <test> + 776 <xsl:for-each select="document('')//l:data/l:entry"> + 777 <xsl:copy-of select="document('file://ANYTHING')"/> + 778 <xsl:copy> + 779 <xsl:attribute name="value"> + 780 <xsl:value-of select="."/> + 781 </xsl:attribute> + 782 </xsl:copy> + 783 </xsl:for-each> + 784 </test> + 785 </xsl:template> + 786 <l:data> + 787 <l:entry>A</l:entry> + 788 <l:entry>B</l:entry> + 789 </l:data> + 790 </xsl:stylesheet> + 791 """), parser)) + 792 + 793 self.assertEqual(called['count'], 0) + 794 result = xslt(etree.XML('<a/>')) + 795 self.assertEqual(called['count'], 1) + 796 + 797 root = result.getroot() + 798 self.assertEqual(root.tag, + 799 'test') + 800 self.assertEqual(len(root), 4) + 801 + 802 self.assertEqual(root[0].tag, + 803 'CALLED') + 804 self.assertEqual(root[1].tag, + 805 '{local}entry') + 806 self.assertEqual(root[1].text, + 807 None) + 808 self.assertEqual(root[1].get("value"), + 809 'A') + 810 self.assertEqual(root[2].tag, + 811 'CALLED') + 812 self.assertEqual(root[3].tag, + 813 '{local}entry') + 814 self.assertEqual(root[3].text, + 815 None) + 816 self.assertEqual(root[3].get("value"), + 817 'B') + 818 +
820 assertEqual = self.assertEqual + 821 called = {'count' : 0} + 822 expected_url = None + 823 class TestResolver(etree.Resolver): + 824 def resolve(self, url, id, context): + 825 assertEqual(url, expected_url) + 826 called['count'] += 1 + 827 return self.resolve_string('<CALLED/>', context) +
828 + 829 stylesheet_xml = _bytes("""\ + 830 <xsl:stylesheet version="1.0" + 831 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 832 xmlns:l="local"> + 833 <xsl:template match="/"> + 834 <xsl:copy-of select="document('test.xml')"/> + 835 </xsl:template> + 836 </xsl:stylesheet> + 837 """) + 838 + 839 parser = etree.XMLParser() + 840 parser.resolvers.add(TestResolver()) + 841 + 842 # test without base_url => relative path only + 843 expected_url = 'test.xml' + 844 xslt = etree.XSLT(etree.XML(stylesheet_xml, parser)) + 845 + 846 self.assertEqual(called['count'], 0) + 847 result = xslt(etree.XML('<a/>')) + 848 self.assertEqual(called['count'], 1) + 849 + 850 # now the same thing with a stylesheet base URL on the filesystem + 851 called['count'] = 0 + 852 expected_url = 'MY/BASE/test.xml' # seems to be the same on Windows + 853 xslt = etree.XSLT(etree.XML( + 854 stylesheet_xml, parser, + 855 base_url=os.path.join('MY', 'BASE', 'FILE'))) + 856 + 857 self.assertEqual(called['count'], 0) + 858 result = xslt(etree.XML('<a/>')) + 859 self.assertEqual(called['count'], 1) + 860 + 861 # now the same thing with a stylesheet base URL + 862 called['count'] = 0 + 863 expected_url = 'http://server.com/BASE/DIR/test.xml' + 864 xslt = etree.XSLT(etree.XML( + 865 stylesheet_xml, parser, + 866 base_url='http://server.com/BASE/DIR/FILE')) + 867 + 868 self.assertEqual(called['count'], 0) + 869 result = xslt(etree.XML('<a/>')) + 870 self.assertEqual(called['count'], 1) + 871 + 872 # now the same thing with a stylesheet base file:// URL + 873 called['count'] = 0 + 874 expected_url = 'file://BASE/DIR/test.xml' + 875 xslt = etree.XSLT(etree.XML( + 876 stylesheet_xml, parser, + 877 base_url='file://BASE/DIR/FILE')) + 878 + 879 self.assertEqual(called['count'], 0) + 880 result = xslt(etree.XML('<a/>')) + 881 self.assertEqual(called['count'], 1) + 882 +
884 access_control = etree.XSLTAccessControl(read_file=True) + 885 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 886 access_control=access_control) + 887 result = xslt(etree.XML('<a/>')) + 888 root = result.getroot() + 889 self.assertEqual(root.tag, + 890 'test') + 891 self.assertEqual(root[0].tag, + 892 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
893 +
895 access_control = etree.XSLTAccessControl(read_file=False) + 896 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 897 access_control=access_control) + 898 self.assertRaises(etree.XSLTApplyError, xslt, etree.XML('<a/>')) +
899 +
901 access_control = etree.XSLTAccessControl.DENY_ALL + 902 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 903 access_control=access_control) + 904 self.assertRaises(etree.XSLTApplyError, xslt, etree.XML('<a/>')) +
905 +
907 access_control = etree.XSLTAccessControl.DENY_ALL + 908 self.assertTrue(repr(access_control).startswith(type(access_control).__name__)) + 909 self.assertEqual(repr(access_control), repr(access_control)) + 910 self.assertNotEqual(repr(etree.XSLTAccessControl.DENY_ALL), + 911 repr(etree.XSLTAccessControl.DENY_WRITE)) + 912 self.assertNotEqual(repr(etree.XSLTAccessControl.DENY_ALL), + 913 repr(etree.XSLTAccessControl())) +
914 +
915 - def test_xslt_move_result(self): +
916 root = etree.XML(_bytes('''\ + 917 <transform> + 918 <widget displayType="fieldset"/> + 919 </transform>''')) + 920 + 921 xslt = etree.XSLT(etree.XML(_bytes('''\ + 922 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 923 <xsl:output method="html" indent="no"/> + 924 <xsl:template match="/"> + 925 <html> + 926 <xsl:apply-templates/> + 927 </html> + 928 </xsl:template> + 929 + 930 <xsl:template match="widget"> + 931 <xsl:element name="{@displayType}"/> + 932 </xsl:template> + 933 + 934 </xsl:stylesheet>'''))) + 935 + 936 result = xslt(root[0]) + 937 root[:] = result.getroot()[:] + 938 del root # segfaulted before +
939 +
940 - def test_xslt_pi(self): +
941 tree = self.parse('''\ + 942 <?xml version="1.0"?> + 943 <?xml-stylesheet type="text/xsl" href="%s"?> + 944 <a> + 945 <b>B</b> + 946 <c>C</c> + 947 </a>''' % fileInTestDir("test1.xslt")) + 948 + 949 style_root = tree.getroot().getprevious().parseXSL().getroot() + 950 self.assertEqual("{http://www.w3.org/1999/XSL/Transform}stylesheet", + 951 style_root.tag) +
952 +
953 - def test_xslt_pi_embedded_xmlid(self): +
954 # test xml:id dictionary lookup mechanism + 955 tree = self.parse('''\ + 956 <?xml version="1.0"?> + 957 <?xml-stylesheet type="text/xsl" href="#style"?> + 958 <a> + 959 <b>B</b> + 960 <c>C</c> + 961 <xsl:stylesheet version="1.0" xml:id="style" + 962 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 963 <xsl:template match="*" /> + 964 <xsl:template match="/"> + 965 <foo><xsl:value-of select="/a/b/text()" /></foo> + 966 </xsl:template> + 967 </xsl:stylesheet> + 968 </a>''') + 969 + 970 style_root = tree.getroot().getprevious().parseXSL().getroot() + 971 self.assertEqual("{http://www.w3.org/1999/XSL/Transform}stylesheet", + 972 style_root.tag) + 973 + 974 st = etree.XSLT(style_root) + 975 res = st(tree) + 976 self.assertEqual('''\ + 977 <?xml version="1.0"?> + 978 <foo>B</foo> + 979 ''', + 980 str(res)) +
981 +
982 - def test_xslt_pi_embedded_id(self): +
983 # test XPath lookup mechanism + 984 tree = self.parse('''\ + 985 <?xml version="1.0"?> + 986 <?xml-stylesheet type="text/xsl" href="#style"?> + 987 <a> + 988 <b>B</b> + 989 <c>C</c> + 990 </a>''') + 991 + 992 style = self.parse('''\ + 993 <xsl:stylesheet version="1.0" xml:id="style" + 994 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 995 <xsl:template match="*" /> + 996 <xsl:template match="/"> + 997 <foo><xsl:value-of select="/a/b/text()" /></foo> + 998 </xsl:template> + 999 </xsl:stylesheet> +1000 ''') +1001 +1002 tree.getroot().append(style.getroot()) +1003 +1004 style_root = tree.getroot().getprevious().parseXSL().getroot() +1005 self.assertEqual("{http://www.w3.org/1999/XSL/Transform}stylesheet", +1006 style_root.tag) +1007 +1008 st = etree.XSLT(style_root) +1009 res = st(tree) +1010 self.assertEqual('''\ +1011 <?xml version="1.0"?> +1012 <foo>B</foo> +1013 ''', +1014 str(res)) +
1015 +
1016 - def test_xslt_pi_get(self): +
1017 tree = self.parse('''\ +1018 <?xml version="1.0"?> +1019 <?xml-stylesheet type="text/xsl" href="TEST"?> +1020 <a> +1021 <b>B</b> +1022 <c>C</c> +1023 </a>''') +1024 +1025 pi = tree.getroot().getprevious() +1026 self.assertEqual("TEST", pi.get("href")) +
1027 +
1028 - def test_xslt_pi_get_all(self): +
1029 tree = self.parse('''\ +1030 <?xml version="1.0"?> +1031 <?xml-stylesheet type="text/xsl" href="TEST"?> +1032 <a> +1033 <b>B</b> +1034 <c>C</c> +1035 </a>''') +1036 +1037 pi = tree.getroot().getprevious() +1038 self.assertEqual("TEST", pi.get("href")) +1039 self.assertEqual("text/xsl", pi.get("type")) +1040 self.assertEqual(None, pi.get("motz")) +
1041 +
1043 tree = self.parse('''\ +1044 <?xml version="1.0"?> +1045 <?xml-stylesheet href="TEST" type="text/xsl"?> +1046 <a> +1047 <b>B</b> +1048 <c>C</c> +1049 </a>''') +1050 +1051 pi = tree.getroot().getprevious() +1052 self.assertEqual("TEST", pi.get("href")) +1053 self.assertEqual("text/xsl", pi.get("type")) +1054 self.assertEqual(None, pi.get("motz")) +
1055 +
1056 - def test_xslt_pi_get_unknown(self): +
1057 tree = self.parse('''\ +1058 <?xml version="1.0"?> +1059 <?xml-stylesheet type="text/xsl" href="TEST"?> +1060 <a> +1061 <b>B</b> +1062 <c>C</c> +1063 </a>''') +1064 +1065 pi = tree.getroot().getprevious() +1066 self.assertEqual(None, pi.get("unknownattribute")) +
1067 +
1068 - def test_xslt_pi_set_replace(self): +
1069 tree = self.parse('''\ +1070 <?xml version="1.0"?> +1071 <?xml-stylesheet type="text/xsl" href="TEST"?> +1072 <a> +1073 <b>B</b> +1074 <c>C</c> +1075 </a>''') +1076 +1077 pi = tree.getroot().getprevious() +1078 self.assertEqual("TEST", pi.get("href")) +1079 +1080 pi.set("href", "TEST123") +1081 self.assertEqual("TEST123", pi.get("href")) +
1082 +
1083 - def test_xslt_pi_set_new(self): +
1084 tree = self.parse('''\ +1085 <?xml version="1.0"?> +1086 <?xml-stylesheet type="text/xsl"?> +1087 <a> +1088 <b>B</b> +1089 <c>C</c> +1090 </a>''') +1091 +1092 pi = tree.getroot().getprevious() +1093 self.assertEqual(None, pi.get("href")) +1094 +1095 pi.set("href", "TEST") +1096 self.assertEqual("TEST", pi.get("href")) +
1097 +
1098 -class ETreeEXSLTTestCase(HelperTestCase): +
1099 """EXSLT tests""" +1100 +
1101 - def test_exslt_str(self): +
1102 tree = self.parse('<a><b>B</b><c>C</c></a>') +1103 style = self.parse('''\ +1104 <xsl:stylesheet version="1.0" +1105 xmlns:str="http://exslt.org/strings" +1106 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1107 exclude-result-prefixes="str xsl"> +1108 <xsl:template match="text()"> +1109 <xsl:value-of select="str:align(string(.), '***', 'center')" /> +1110 </xsl:template> +1111 <xsl:template match="*"> +1112 <xsl:copy> +1113 <xsl:apply-templates/> +1114 </xsl:copy> +1115 </xsl:template> +1116 </xsl:stylesheet>''') +1117 +1118 st = etree.XSLT(style) +1119 res = st(tree) +1120 self.assertEqual('''\ +1121 <?xml version="1.0"?> +1122 <a><b>*B*</b><c>*C*</c></a> +1123 ''', +1124 str(res)) +
1125 +
1127 tree = self.parse('<a><b>B</b><c>C</c></a>') +1128 style = self.parse('''\ +1129 <xsl:stylesheet version = "1.0" +1130 xmlns:xsl='http://www.w3.org/1999/XSL/Transform' +1131 xmlns:str="http://exslt.org/strings" +1132 extension-element-prefixes="str"> +1133 +1134 <xsl:template match="/"> +1135 <h1 class="{str:replace('abc', 'b', 'x')}">test</h1> +1136 </xsl:template> +1137 +1138 </xsl:stylesheet>''') +1139 +1140 st = etree.XSLT(style) +1141 res = st(tree) +1142 self.assertEqual(str(res), '''\ +1143 <?xml version="1.0"?> +1144 <h1 class="axc">test</h1> +1145 ''') +
1146 +
1147 - def test_exslt_math(self): +
1148 tree = self.parse('<a><b>B</b><c>C</c></a>') +1149 style = self.parse('''\ +1150 <xsl:stylesheet version="1.0" +1151 xmlns:math="http://exslt.org/math" +1152 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1153 exclude-result-prefixes="math xsl"> +1154 <xsl:template match="*"> +1155 <xsl:copy> +1156 <xsl:attribute name="pi"> +1157 <xsl:value-of select="math:constant('PI', count(*)+2)"/> +1158 </xsl:attribute> +1159 <xsl:apply-templates/> +1160 </xsl:copy> +1161 </xsl:template> +1162 </xsl:stylesheet>''') +1163 +1164 st = etree.XSLT(style) +1165 res = st(tree) +1166 self.assertEqual('''\ +1167 <?xml version="1.0"?> +1168 <a pi="3.14"><b pi="3">B</b><c pi="3">C</c></a> +1169 ''', +1170 str(res)) +
1171 +
1172 - def test_exslt_regexp_test(self): +
1173 xslt = etree.XSLT(etree.XML(_bytes("""\ +1174 <xsl:stylesheet version="1.0" +1175 xmlns:regexp="http://exslt.org/regular-expressions" +1176 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1177 <xsl:template match="*"> +1178 <test><xsl:copy-of select="*[regexp:test(string(.), '8.')]"/></test> +1179 </xsl:template> +1180 </xsl:stylesheet> +1181 """))) +1182 result = xslt(etree.XML(_bytes('<a><b>123</b><b>098</b><b>987</b></a>'))) +1183 root = result.getroot() +1184 self.assertEqual(root.tag, +1185 'test') +1186 self.assertEqual(len(root), 1) +1187 self.assertEqual(root[0].tag, +1188 'b') +1189 self.assertEqual(root[0].text, +1190 '987') +
1191 +
1192 - def test_exslt_regexp_replace(self): +
1193 xslt = etree.XSLT(etree.XML("""\ +1194 <xsl:stylesheet version="1.0" +1195 xmlns:regexp="http://exslt.org/regular-expressions" +1196 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1197 <xsl:template match="*"> +1198 <test> +1199 <xsl:copy-of select="regexp:replace(string(.), 'd.', '', 'XX')"/> +1200 <xsl:text>-</xsl:text> +1201 <xsl:copy-of select="regexp:replace(string(.), 'd.', 'gi', 'XX')"/> +1202 </test> +1203 </xsl:template> +1204 </xsl:stylesheet> +1205 """)) +1206 result = xslt(etree.XML(_bytes('<a>abdCdEeDed</a>'))) +1207 root = result.getroot() +1208 self.assertEqual(root.tag, +1209 'test') +1210 self.assertEqual(len(root), 0) +1211 self.assertEqual(root.text, 'abXXdEeDed-abXXXXeXXd') +
1212 +
1213 - def test_exslt_regexp_match(self): +
1214 xslt = etree.XSLT(etree.XML("""\ +1215 <xsl:stylesheet version="1.0" +1216 xmlns:regexp="http://exslt.org/regular-expressions" +1217 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1218 <xsl:template match="*"> +1219 <test> +1220 <test1><xsl:copy-of select="regexp:match(string(.), 'd.')"/></test1> +1221 <test2><xsl:copy-of select="regexp:match(string(.), 'd.', 'g')"/></test2> +1222 <test2i><xsl:copy-of select="regexp:match(string(.), 'd.', 'gi')"/></test2i> +1223 </test> +1224 </xsl:template> +1225 </xsl:stylesheet> +1226 """)) +1227 result = xslt(etree.XML(_bytes('<a>abdCdEeDed</a>'))) +1228 root = result.getroot() +1229 self.assertEqual(root.tag, 'test') +1230 self.assertEqual(len(root), 3) +1231 +1232 self.assertEqual(len(root[0]), 1) +1233 self.assertEqual(root[0][0].tag, 'match') +1234 self.assertEqual(root[0][0].text, 'dC') +1235 +1236 self.assertEqual(len(root[1]), 2) +1237 self.assertEqual(root[1][0].tag, 'match') +1238 self.assertEqual(root[1][0].text, 'dC') +1239 self.assertEqual(root[1][1].tag, 'match') +1240 self.assertEqual(root[1][1].text, 'dE') +1241 +1242 self.assertEqual(len(root[2]), 3) +1243 self.assertEqual(root[2][0].tag, 'match') +1244 self.assertEqual(root[2][0].text, 'dC') +1245 self.assertEqual(root[2][1].tag, 'match') +1246 self.assertEqual(root[2][1].text, 'dE') +1247 self.assertEqual(root[2][2].tag, 'match') +1248 self.assertEqual(root[2][2].text, 'De') +
1249 +
1251 xslt = etree.XSLT(etree.XML(_bytes("""\ +1252 <xsl:stylesheet version="1.0" +1253 xmlns:regexp="http://exslt.org/regular-expressions" +1254 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1255 <xsl:template match="/"> +1256 <test> +1257 <xsl:for-each select="regexp:match( +1258 '123abc567', '([0-9]+)([a-z]+)([0-9]+)' )"> +1259 <test1><xsl:value-of select="."/></test1> +1260 </xsl:for-each> +1261 </test> +1262 </xsl:template> +1263 </xsl:stylesheet> +1264 """))) +1265 result = xslt(etree.XML(_bytes('<a/>'))) +1266 root = result.getroot() +1267 self.assertEqual(root.tag, 'test') +1268 self.assertEqual(len(root), 4) +1269 +1270 self.assertEqual(root[0].text, "123abc567") +1271 self.assertEqual(root[1].text, "123") +1272 self.assertEqual(root[2].text, "abc") +1273 self.assertEqual(root[3].text, "567") +
1274 +
1275 - def test_exslt_regexp_match1(self): +
1276 # taken from http://www.exslt.org/regexp/functions/match/index.html +1277 xslt = etree.XSLT(etree.XML(_bytes("""\ +1278 <xsl:stylesheet version="1.0" +1279 xmlns:regexp="http://exslt.org/regular-expressions" +1280 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1281 <xsl:template match="/"> +1282 <test> +1283 <xsl:for-each select="regexp:match( +1284 'http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml', +1285 '(\\w+):\\/\\/([^/:]+)(:\\d*)?([^# ]*)')"> +1286 <test1><xsl:value-of select="."/></test1> +1287 </xsl:for-each> +1288 </test> +1289 </xsl:template> +1290 </xsl:stylesheet> +1291 """))) +1292 result = xslt(etree.XML(_bytes('<a/>'))) +1293 root = result.getroot() +1294 self.assertEqual(root.tag, 'test') +1295 self.assertEqual(len(root), 5) +1296 +1297 self.assertEqual( +1298 root[0].text, +1299 "http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml") +1300 self.assertEqual( +1301 root[1].text, +1302 "http") +1303 self.assertEqual( +1304 root[2].text, +1305 "www.bayes.co.uk") +1306 self.assertFalse(root[3].text) +1307 self.assertEqual( +1308 root[4].text, +1309 "/xml/index.xml?/xml/utils/rechecker.xml") +
1310 +
1311 - def test_exslt_regexp_match2(self): +
1312 # taken from http://www.exslt.org/regexp/functions/match/index.html +1313 xslt = etree.XSLT(self.parse("""\ +1314 <xsl:stylesheet version="1.0" +1315 xmlns:regexp="http://exslt.org/regular-expressions" +1316 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1317 <xsl:template match="/"> +1318 <test> +1319 <xsl:for-each select="regexp:match( +1320 'This is a test string', '(\\w+)', 'g')"> +1321 <test1><xsl:value-of select="."/></test1> +1322 </xsl:for-each> +1323 </test> +1324 </xsl:template> +1325 </xsl:stylesheet> +1326 """)) +1327 result = xslt(etree.XML(_bytes('<a/>'))) +1328 root = result.getroot() +1329 self.assertEqual(root.tag, 'test') +1330 self.assertEqual(len(root), 5) +1331 +1332 self.assertEqual(root[0].text, "This") +1333 self.assertEqual(root[1].text, "is") +1334 self.assertEqual(root[2].text, "a") +1335 self.assertEqual(root[3].text, "test") +1336 self.assertEqual(root[4].text, "string") +
1337 +
1338 - def _test_exslt_regexp_match3(self): +
1339 # taken from http://www.exslt.org/regexp/functions/match/index.html +1340 # THIS IS NOT SUPPORTED! +1341 xslt = etree.XSLT(etree.XML(_bytes("""\ +1342 <xsl:stylesheet version="1.0" +1343 xmlns:regexp="http://exslt.org/regular-expressions" +1344 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1345 <xsl:template match="/"> +1346 <test> +1347 <xsl:for-each select="regexp:match( +1348 'This is a test string', '([a-z])+ ', 'g')"> +1349 <test1><xsl:value-of select="."/></test1> +1350 </xsl:for-each> +1351 </test> +1352 </xsl:template> +1353 </xsl:stylesheet> +1354 """))) +1355 result = xslt(etree.XML(_bytes('<a/>'))) +1356 root = result.getroot() +1357 self.assertEqual(root.tag, 'test') +1358 self.assertEqual(len(root), 4) +1359 +1360 self.assertEqual(root[0].text, "his") +1361 self.assertEqual(root[1].text, "is") +1362 self.assertEqual(root[2].text, "a") +1363 self.assertEqual(root[3].text, "test") +
1364 +
1365 - def _test_exslt_regexp_match4(self): +
1366 # taken from http://www.exslt.org/regexp/functions/match/index.html +1367 # THIS IS NOT SUPPORTED! +1368 xslt = etree.XSLT(etree.XML(_bytes("""\ +1369 <xsl:stylesheet version="1.0" +1370 xmlns:regexp="http://exslt.org/regular-expressions" +1371 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1372 <xsl:template match="/"> +1373 <test> +1374 <xsl:for-each select="regexp:match( +1375 'This is a test string', '([a-z])+ ', 'gi')"> +1376 <test1><xsl:value-of select="."/></test1> +1377 </xsl:for-each> +1378 </test> +1379 </xsl:template> +1380 </xsl:stylesheet> +1381 """))) +1382 result = xslt(etree.XML(_bytes('<a/>'))) +1383 root = result.getroot() +1384 self.assertEqual(root.tag, 'test') +1385 self.assertEqual(len(root), 4) +1386 +1387 self.assertEqual(root[0].text, "This") +1388 self.assertEqual(root[1].text, "is") +1389 self.assertEqual(root[2].text, "a") +1390 self.assertEqual(root[3].text, "test") +
1391 +
1392 +1393 -class ETreeXSLTExtFuncTestCase(HelperTestCase): +
1394 """Tests for XPath extension functions in XSLT.""" +1395 +
1396 - def test_extensions1(self): +
1397 tree = self.parse('<a><b>B</b></a>') +1398 style = self.parse('''\ +1399 <xsl:stylesheet version="1.0" +1400 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1401 xmlns:myns="testns" +1402 exclude-result-prefixes="myns"> +1403 <xsl:template match="a"><A><xsl:value-of select="myns:mytext(b)"/></A></xsl:template> +1404 </xsl:stylesheet>''') +1405 +1406 def mytext(ctxt, values): +1407 return 'X' * len(values) +
1408 +1409 result = tree.xslt(style, {('testns', 'mytext') : mytext}) +1410 self.assertEqual(self._rootstring(result), +1411 _bytes('<A>X</A>')) +
1412 +
1413 - def test_extensions2(self): +
1414 tree = self.parse('<a><b>B</b></a>') +1415 style = self.parse('''\ +1416 <xsl:stylesheet version="1.0" +1417 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1418 xmlns:myns="testns" +1419 exclude-result-prefixes="myns"> +1420 <xsl:template match="a"><A><xsl:value-of select="myns:mytext(b)"/></A></xsl:template> +1421 </xsl:stylesheet>''') +1422 +1423 def mytext(ctxt, values): +1424 return 'X' * len(values) +
1425 +1426 namespace = etree.FunctionNamespace('testns') +1427 namespace['mytext'] = mytext +1428 +1429 result = tree.xslt(style) +1430 self.assertEqual(self._rootstring(result), +1431 _bytes('<A>X</A>')) +1432 +
1434 tree = self.parse('<a><b>B</b><b/></a>') +1435 style = self.parse('''\ +1436 <xsl:stylesheet version="1.0" +1437 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1438 xmlns:myns="testns" +1439 exclude-result-prefixes="myns"> +1440 <xsl:template match="a"> +1441 <xsl:variable name="content"> +1442 <xsl:apply-templates/> +1443 </xsl:variable> +1444 <A><xsl:value-of select="myns:mytext($content)"/></A> +1445 </xsl:template> +1446 <xsl:template match="b"><xsl:copy>BBB</xsl:copy></xsl:template> +1447 </xsl:stylesheet>''') +1448 +1449 def mytext(ctxt, values): +1450 for value in values: +1451 self.assertTrue(hasattr(value, 'tag'), +1452 "%s is not an Element" % type(value)) +1453 self.assertEqual(value.tag, 'b') +1454 self.assertEqual(value.text, 'BBB') +1455 return 'X'.join([el.tag for el in values]) +
1456 +1457 namespace = etree.FunctionNamespace('testns') +1458 namespace['mytext'] = mytext +1459 +1460 result = tree.xslt(style) +1461 self.assertEqual(self._rootstring(result), +1462 _bytes('<A>bXb</A>')) +1463 +
1464 - def test_xpath_on_context_node(self): +
1465 tree = self.parse('<a><b>B<c/>C</b><b/></a>') +1466 style = self.parse('''\ +1467 <xsl:stylesheet version="1.0" +1468 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1469 xmlns:myns="testns" +1470 exclude-result-prefixes="myns"> +1471 <xsl:template match="b"> +1472 <A><xsl:value-of select="myns:myext()"/></A> +1473 </xsl:template> +1474 </xsl:stylesheet>''') +1475 +1476 def extfunc(ctxt): +1477 text_content = ctxt.context_node.xpath('text()') +1478 return 'x'.join(text_content) +
1479 +1480 namespace = etree.FunctionNamespace('testns') +1481 namespace['myext'] = extfunc +1482 +1483 result = tree.xslt(style) +1484 self.assertEqual(self._rootstring(result), +1485 _bytes('<A>BxC</A>')) +1486 +
1488 # LP ticket 1354652 +1489 class Resolver(etree.Resolver): +1490 def resolve(self, system_url, public_id, context): +1491 assert system_url == 'extdoc.xml' +1492 return self.resolve_string(b'<a><b>B<c/>C</b><b/></a>', context) +
1493 +1494 parser = etree.XMLParser() +1495 parser.resolvers.add(Resolver()) +1496 +1497 tree = self.parse(b'<a><b/><b/></a>') +1498 transform = etree.XSLT(self.parse(b'''\ +1499 <xsl:stylesheet version="1.0" +1500 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1501 xmlns:mypre="testns" +1502 exclude-result-prefixes="mypre"> +1503 <xsl:template match="b"> +1504 <B><xsl:value-of select="mypre:myext()"/></B> +1505 </xsl:template> +1506 <xsl:template match="a"> +1507 <A><xsl:apply-templates select="document('extdoc.xml')//b" /></A> +1508 </xsl:template> +1509 </xsl:stylesheet>''', parser=parser)) +1510 +1511 def extfunc(ctxt): +1512 text_content = ctxt.context_node.xpath('text()') +1513 return 'x'.join(text_content) +1514 +1515 namespace = etree.FunctionNamespace('testns') +1516 namespace['myext'] = extfunc +1517 +1518 result = transform(tree) +1519 self.assertEqual(self._rootstring(result), +1520 _bytes('<A><B>BxC</B><B/></A>')) +1521 +
1522 +1523 -class ETreeXSLTExtElementTestCase(HelperTestCase): +
1524 """Tests for extension elements in XSLT.""" +1525 +
1526 - def test_extension_element(self): +
1527 tree = self.parse('<a><b>B</b></a>') +1528 style = self.parse('''\ +1529 <xsl:stylesheet version="1.0" +1530 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1531 xmlns:myns="testns" +1532 extension-element-prefixes="myns" +1533 exclude-result-prefixes="myns"> +1534 <xsl:template match="a"> +1535 <A><myns:myext>b</myns:myext></A> +1536 </xsl:template> +1537 </xsl:stylesheet>''') +1538 +1539 class MyExt(etree.XSLTExtension): +1540 def execute(self, context, self_node, input_node, output_parent): +1541 child = etree.Element(self_node.text) +1542 child.text = 'X' +1543 output_parent.append(child) +
1544 +1545 extensions = { ('testns', 'myext') : MyExt() } +1546 +1547 result = tree.xslt(style, extensions=extensions) +1548 self.assertEqual(self._rootstring(result), +1549 _bytes('<A><b>X</b></A>')) +1550 +
1552 tree = self.parse('<a><b>B</b></a>') +1553 style = self.parse('''\ +1554 <xsl:stylesheet version="1.0" +1555 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1556 xmlns:myns="testns" +1557 extension-element-prefixes="myns" +1558 exclude-result-prefixes="myns"> +1559 <xsl:template match="/"> +1560 <A><myns:myext>b</myns:myext></A> +1561 </xsl:template> +1562 </xsl:stylesheet>''') +1563 +1564 tags = [] +1565 +1566 class MyExt(etree.XSLTExtension): +1567 def execute(self, context, self_node, input_node, output_parent): +1568 tags.append(input_node.tag) +
1569 +1570 extensions = { ('testns', 'myext') : MyExt() } +1571 +1572 result = tree.xslt(style, extensions=extensions) +1573 self.assertEqual(tags, ['a']) +1574 +
1576 tree = self.parse('<?test toast?><a><!--a comment--><?another pi?></a>') +1577 style = self.parse('''\ +1578 <xsl:stylesheet version="1.0" +1579 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1580 xmlns:myns="testns" +1581 extension-element-prefixes="myns" +1582 exclude-result-prefixes="myns"> +1583 <xsl:template match="/"> +1584 <ROOT><xsl:apply-templates /></ROOT> +1585 </xsl:template> +1586 <xsl:template match="comment()"> +1587 <A><myns:myext>b</myns:myext></A> +1588 </xsl:template> +1589 <xsl:template match="processing-instruction()"> +1590 <A><myns:myext>b</myns:myext></A> +1591 </xsl:template> +1592 </xsl:stylesheet>''') +1593 +1594 text = [] +1595 +1596 class MyExt(etree.XSLTExtension): +1597 def execute(self, context, self_node, input_node, output_parent): +1598 text.append(input_node.text) +
1599 +1600 extensions = { ('testns', 'myext') : MyExt() } +1601 +1602 result = tree.xslt(style, extensions=extensions) +1603 self.assertEqual(text, ['toast', 'a comment', 'pi']) +1604 +
1606 # currently not supported +1607 tree = self.parse('<a test="A"><b attr="B"/></a>') +1608 style = self.parse('''\ +1609 <xsl:stylesheet version="1.0" +1610 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1611 xmlns:myns="testns" +1612 extension-element-prefixes="myns" +1613 exclude-result-prefixes="myns"> +1614 <xsl:template match="@test"> +1615 <A><myns:myext>b</myns:myext></A> +1616 </xsl:template> +1617 <xsl:template match="@attr"> +1618 <A><myns:myext>b</myns:myext></A> +1619 </xsl:template> +1620 </xsl:stylesheet>''') +1621 +1622 text = [] +1623 +1624 class MyExt(etree.XSLTExtension): +1625 def execute(self, context, self_node, attr_value, output_parent): +1626 text.append(attr_value) +
1627 +1628 extensions = { ('testns', 'myext') : MyExt() } +1629 +1630 result = tree.xslt(style, extensions=extensions) +1631 self.assertEqual(text, ['A', 'B']) +1632 +
1634 tree = self.parse('<a><b>B</b></a>') +1635 style = self.parse('''\ +1636 <xsl:stylesheet version="1.0" +1637 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1638 xmlns:myns="testns" +1639 extension-element-prefixes="myns"> +1640 <xsl:template match="a"> +1641 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> +1642 </xsl:template> +1643 </xsl:stylesheet>''') +1644 +1645 class MyExt(etree.XSLTExtension): +1646 def execute(self, context, self_node, input_node, output_parent): +1647 output_parent.extend(list(self_node)[1:]) +
1648 +1649 extensions = { ('testns', 'myext') : MyExt() } +1650 +1651 result = tree.xslt(style, extensions=extensions) +1652 self.assertEqual(self._rootstring(result), +1653 _bytes('<A><y>Y</y><z/></A>')) +1654 +
1656 tree = self.parse('<a><b>B</b></a>') +1657 style = self.parse('''\ +1658 <xsl:stylesheet version="1.0" +1659 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1660 xmlns:myns="testns" +1661 extension-element-prefixes="myns"> +1662 <xsl:template match="a"> +1663 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> +1664 </xsl:template> +1665 <xsl:template match="x" /> +1666 <xsl:template match="z">XYZ</xsl:template> +1667 </xsl:stylesheet>''') +1668 +1669 class MyExt(etree.XSLTExtension): +1670 def execute(self, context, self_node, input_node, output_parent): +1671 for child in self_node: +1672 for result in self.apply_templates(context, child): +1673 if isinstance(result, basestring): +1674 el = etree.Element("T") +1675 el.text = result +1676 else: +1677 el = result +1678 output_parent.append(el) +
1679 +1680 extensions = { ('testns', 'myext') : MyExt() } +1681 +1682 result = tree.xslt(style, extensions=extensions) +1683 self.assertEqual(self._rootstring(result), +1684 _bytes('<A><T>Y</T><T>XYZ</T></A>')) +1685 +
1687 tree = self.parse('<a><b>B</b></a>') +1688 style = self.parse('''\ +1689 <xsl:stylesheet version="1.0" +1690 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1691 xmlns:myns="testns" +1692 extension-element-prefixes="myns"> +1693 <xsl:template match="a"> +1694 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> +1695 </xsl:template> +1696 <xsl:template match="x"><X/></xsl:template> +1697 <xsl:template match="z">XYZ</xsl:template> +1698 </xsl:stylesheet>''') +1699 +1700 class MyExt(etree.XSLTExtension): +1701 def execute(self, context, self_node, input_node, output_parent): +1702 for child in self_node: +1703 for result in self.apply_templates(context, child, +1704 elements_only=True): +1705 assert not isinstance(result, basestring) +1706 output_parent.append(result) +
1707 +1708 extensions = { ('testns', 'myext') : MyExt() } +1709 +1710 result = tree.xslt(style, extensions=extensions) +1711 self.assertEqual(self._rootstring(result), +1712 _bytes('<A><X/></A>')) +1713 +
1715 tree = self.parse('<a><b>B</b></a>') +1716 style = self.parse('''\ +1717 <xsl:stylesheet version="1.0" +1718 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1719 xmlns:myns="testns" +1720 extension-element-prefixes="myns"> +1721 <xsl:template match="a"> +1722 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> +1723 </xsl:template> +1724 <xsl:template match="x"><X/></xsl:template> +1725 <xsl:template match="y"><xsl:text> </xsl:text></xsl:template> +1726 <xsl:template match="z">XYZ</xsl:template> +1727 </xsl:stylesheet>''') +1728 +1729 class MyExt(etree.XSLTExtension): +1730 def execute(self, context, self_node, input_node, output_parent): +1731 for child in self_node: +1732 for result in self.apply_templates(context, child, +1733 remove_blank_text=True): +1734 if isinstance(result, basestring): +1735 assert result.strip() +1736 el = etree.Element("T") +1737 el.text = result +1738 else: +1739 el = result +1740 output_parent.append(el) +
1741 +1742 extensions = { ('testns', 'myext') : MyExt() } +1743 +1744 result = tree.xslt(style, extensions=extensions) +1745 self.assertEqual(self._rootstring(result), +1746 _bytes('<A><X/><T>XYZ</T></A>')) +1747 +
1749 tree = self.parse('<a><b>B</b></a>') +1750 style = self.parse('''\ +1751 <xsl:stylesheet version="1.0" +1752 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1753 xmlns:myns="testns" +1754 extension-element-prefixes="myns"> +1755 <xsl:template match="a"> +1756 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> +1757 </xsl:template> +1758 <xsl:template match="x" /> +1759 <xsl:template match="z">XYZ</xsl:template> +1760 </xsl:stylesheet>''') +1761 +1762 class MyExt(etree.XSLTExtension): +1763 def execute(self, context, self_node, input_node, output_parent): +1764 for child in self_node: +1765 self.apply_templates(context, child, output_parent) +
1766 +1767 extensions = { ('testns', 'myext') : MyExt() } +1768 +1769 result = tree.xslt(style, extensions=extensions) +1770 self.assertEqual(self._rootstring(result), +1771 _bytes('<A>YXYZ</A>')) +1772 +
1774 tree = self.parse('<a><b>B</b></a>') +1775 style = self.parse('''\ +1776 <xsl:stylesheet version="1.0" +1777 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1778 xmlns:myns="testns" +1779 extension-element-prefixes="myns"> +1780 <xsl:template match="a"> +1781 <myns:myext><x>X</x><y>Y</y><z/></myns:myext> +1782 </xsl:template> +1783 <xsl:template match="x"><xsl:processing-instruction name="test">TEST</xsl:processing-instruction></xsl:template> +1784 <xsl:template match="y"><Y>XYZ</Y></xsl:template> +1785 <xsl:template match="z"><xsl:comment>TEST</xsl:comment></xsl:template> +1786 </xsl:stylesheet>''') +1787 +1788 class MyExt(etree.XSLTExtension): +1789 def execute(self, context, self_node, input_node, output_parent): +1790 for child in self_node: +1791 self.apply_templates(context, child, output_parent) +
1792 +1793 extensions = { ('testns', 'myext') : MyExt() } +1794 +1795 result = tree.xslt(style, extensions=extensions) +1796 self.assertEqual(etree.tostring(result), +1797 _bytes('<?test TEST?><Y>XYZ</Y><!--TEST-->')) +1798 +
1800 tree = self.parse('<a><b>E</b></a>') +1801 style = self.parse('''\ +1802 <xsl:stylesheet version="1.0" +1803 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1804 xmlns:myns="testns" +1805 extension-element-prefixes="myns"> +1806 <xsl:template match="a"> +1807 <xsl:variable name="testvar">yo</xsl:variable> +1808 <A> +1809 <myns:myext> +1810 <xsl:attribute name="attr"> +1811 <xsl:value-of select="$testvar" /> +1812 </xsl:attribute> +1813 <B> +1814 <xsl:choose> +1815 <xsl:when test="1 = 2"><C/></xsl:when> +1816 <xsl:otherwise><D><xsl:value-of select="b/text()" /></D></xsl:otherwise> +1817 </xsl:choose> +1818 </B> +1819 </myns:myext> +1820 </A> +1821 </xsl:template> +1822 </xsl:stylesheet>''') +1823 +1824 class MyExt(etree.XSLTExtension): +1825 def execute(self, context, self_node, input_node, output_parent): +1826 el = etree.Element('MY') +1827 self.process_children(context, el) +1828 output_parent.append(el) +
1829 +1830 extensions = { ('testns', 'myext') : MyExt() } +1831 +1832 result = tree.xslt(style, extensions=extensions) +1833 self.assertEqual(self._rootstring(result), +1834 _bytes('<A><MYattr="yo"><B><D>E</D></B></MY></A>')) +1835 +
1837 tree = self.parse('<a/>') +1838 style = self.parse('''\ +1839 <xsl:stylesheet version="1.0" +1840 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1841 xmlns:myns="testns" +1842 extension-element-prefixes="myns"> +1843 <xsl:template match="a"> +1844 <myns:myext> +1845 <A/> +1846 </myns:myext> +1847 </xsl:template> +1848 </xsl:stylesheet>''') +1849 +1850 class MyExt(etree.XSLTExtension): +1851 def execute(self, context, self_node, input_node, output_parent): +1852 self.process_children(context, output_parent) +
1853 +1854 extensions = { ('testns', 'myext') : MyExt() } +1855 +1856 result = tree.xslt(style, extensions=extensions) +1857 self.assertEqual(self._rootstring(result), +1858 _bytes('<A/>')) +1859 +
1861 tree = self.parse('<a/>') +1862 style = self.parse('''\ +1863 <xsl:stylesheet version="1.0" +1864 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1865 xmlns:myns="testns" +1866 extension-element-prefixes="myns"> +1867 <xsl:template match="a"> +1868 <myns:myext> +1869 <A/> +1870 </myns:myext> +1871 </xsl:template> +1872 </xsl:stylesheet>''') +1873 +1874 class MyExt(etree.XSLTExtension): +1875 def execute(self, context, self_node, input_node, output_parent): +1876 self.process_children(context, self_node) +
1877 +1878 extensions = { ('testns', 'myext') : MyExt() } +1879 +1880 self.assertRaises(TypeError, tree.xslt, style, extensions=extensions) +1881 +
1883 tree = self.parse('<a/>') +1884 style = self.parse('''\ +1885 <xsl:stylesheet version="1.0" +1886 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1887 xmlns:myns="testns" +1888 extension-element-prefixes="myns"> +1889 <xsl:template match="a"> +1890 <myns:myext> +1891 <A><myns:myext><B/></myns:myext></A> +1892 </myns:myext> +1893 </xsl:template> +1894 </xsl:stylesheet>''') +1895 +1896 class MyExt(etree.XSLTExtension): +1897 callback_call_counter = 0 +1898 def execute(self, context, self_node, input_node, output_parent): +1899 self.callback_call_counter += 1 +1900 el = etree.Element('MY', n=str(self.callback_call_counter)) +1901 self.process_children(context, el) +1902 output_parent.append(el) +
1903 +1904 extensions = { ('testns', 'myext') : MyExt() } +1905 +1906 result = tree.xslt(style, extensions=extensions) +1907 self.assertEqual(self._rootstring(result), +1908 _bytes('<MYn="1"><A><MYn="2"><B/></MY></A></MY>')) +1909 +
1911 tree = self.parse('<a><b>B</b></a>') +1912 style = self.parse('''\ +1913 <xsl:stylesheet version="1.0" +1914 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +1915 xmlns:myns="testns" +1916 extension-element-prefixes="myns" +1917 exclude-result-prefixes="myns"> +1918 <xsl:template match="a"> +1919 <A><myns:myext>b</myns:myext></A> +1920 </xsl:template> +1921 </xsl:stylesheet>''') +1922 +1923 class MyError(Exception): +1924 pass +
1925 +1926 class MyExt(etree.XSLTExtension): +1927 def execute(self, context, self_node, input_node, output_parent): +1928 raise MyError("expected!") +1929 +1930 extensions = { ('testns', 'myext') : MyExt() } +1931 self.assertRaises(MyError, tree.xslt, style, extensions=extensions) +1932 +1933 # FIXME: DISABLED - implementation seems to be broken +1934 # if someone cares enough about this feature, I take pull requests that fix it. +
1936 tree = self.parse("""\ +1937 <text> +1938 <par>This is <format>arbitrary</format> text in a paragraph</par> +1939 </text>""") +1940 style = self.parse("""\ +1941 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="my" extension-element-prefixes="my" version="1.0"> +1942 <xsl:template match="par"> +1943 <my:par><xsl:apply-templates /></my:par> +1944 </xsl:template> +1945 <xsl:template match="format"> +1946 <my:format><xsl:apply-templates /></my:format> +1947 </xsl:template> +1948 </xsl:stylesheet> +1949 """) +1950 test = self +1951 calls = [] +1952 +1953 class ExtMyPar(etree.XSLTExtension): +1954 def execute(self, context, self_node, input_node, output_parent): +1955 calls.append('par') +1956 p = etree.Element("p") +1957 p.attrib["style"] = "color:red" +1958 self.process_children(context, p) +1959 output_parent.append(p) +
1960 +1961 class ExtMyFormat(etree.XSLTExtension): +1962 def execute(self, context, self_node, input_node, output_parent): +1963 calls.append('format') +1964 content = self.process_children(context) +1965 test.assertEqual(1, len(content)) +1966 test.assertEqual('arbitrary', content[0]) +1967 test.assertEqual('This is ', output_parent.text) +1968 output_parent.text += '*-%s-*' % content[0] +1969 +1970 extensions = {("my", "par"): ExtMyPar(), ("my", "format"): ExtMyFormat()} +1971 transform = etree.XSLT(style, extensions=extensions) +1972 result = transform(tree) +1973 self.assertEqual(['par', 'format'], calls) +1974 self.assertEqual( +1975 b'<p style="color:red">This is *-arbitrary-* text in a paragraph</p>\n', +1976 etree.tostring(result)) +1977 +
1978 - def test_extensions_nsmap(self): +
1979 tree = self.parse("""\ +1980 <root> +1981 <inner xmlns:sha256="http://www.w3.org/2001/04/xmlenc#sha256"> +1982 <data>test</data> +1983 </inner> +1984 </root> +1985 """) +1986 style = self.parse("""\ +1987 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="extns" extension-element-prefixes="my" version="1.0"> +1988 <xsl:template match="node()|@*"> +1989 <xsl:copy> +1990 <xsl:apply-templates select="node()|@*"/> +1991 </xsl:copy> +1992 </xsl:template> +1993 +1994 <xsl:template match="data"> +1995 <my:show-nsmap/> +1996 </xsl:template> +1997 </xsl:stylesheet> +1998 """) +1999 class MyExt(etree.XSLTExtension): +2000 def execute(self, context, self_node, input_node, output_parent): +2001 output_parent.text = str(input_node.nsmap) +
2002 +2003 extensions = {('extns', 'show-nsmap'): MyExt()} +2004 +2005 result = tree.xslt(style, extensions=extensions) +2006 self.assertEqual(etree.tostring(result, pretty_print=True), b"""\ +2007 <root> +2008 <inner xmlns:sha256="http://www.w3.org/2001/04/xmlenc#sha256">{'sha256': 'http://www.w3.org/2001/04/xmlenc#sha256'} +2009 </inner> +2010 </root> +2011 """) +2012 +
2013 +2014 +2015 -class Py3XSLTTestCase(HelperTestCase): +
2016 """XSLT tests for etree under Python 3""" +2017 +2018 pytestmark = skipif('sys.version_info < (3,0)') +2019 +
2020 - def test_xslt_result_bytes(self): +
2021 tree = self.parse('<a><b>B</b><c>C</c></a>') +2022 style = self.parse('''\ +2023 <xsl:stylesheet version="1.0" +2024 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +2025 <xsl:template match="*" /> +2026 <xsl:template match="/"> +2027 <foo><xsl:value-of select="/a/b/text()" /></foo> +2028 </xsl:template> +2029 </xsl:stylesheet>''') +2030 +2031 st = etree.XSLT(style) +2032 res = st(tree) +2033 self.assertEqual(_bytes('''\ +2034 <?xml version="1.0"?> +2035 <foo>B</foo> +2036 '''), +2037 bytes(res)) +
2038 +
2039 - def test_xslt_result_bytearray(self): +
2040 tree = self.parse('<a><b>B</b><c>C</c></a>') +2041 style = self.parse('''\ +2042 <xsl:stylesheet version="1.0" +2043 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +2044 <xsl:template match="*" /> +2045 <xsl:template match="/"> +2046 <foo><xsl:value-of select="/a/b/text()" /></foo> +2047 </xsl:template> +2048 </xsl:stylesheet>''') +2049 +2050 st = etree.XSLT(style) +2051 res = st(tree) +2052 self.assertEqual(_bytes('''\ +2053 <?xml version="1.0"?> +2054 <foo>B</foo> +2055 '''), +2056 bytearray(res)) +
2057 +
2058 - def test_xslt_result_memoryview(self): +
2059 tree = self.parse('<a><b>B</b><c>C</c></a>') +2060 style = self.parse('''\ +2061 <xsl:stylesheet version="1.0" +2062 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +2063 <xsl:template match="*" /> +2064 <xsl:template match="/"> +2065 <foo><xsl:value-of select="/a/b/text()" /></foo> +2066 </xsl:template> +2067 </xsl:stylesheet>''') +2068 +2069 st = etree.XSLT(style) +2070 res = st(tree) +2071 self.assertEqual(_bytes('''\ +2072 <?xml version="1.0"?> +2073 <foo>B</foo> +2074 '''), +2075 bytes(memoryview(res))) +
2076 +
2077 +2078 -def test_suite(): +
2079 suite = unittest.TestSuite() +2080 suite.addTests([unittest.makeSuite(ETreeXSLTTestCase)]) +2081 suite.addTests([unittest.makeSuite(ETreeEXSLTTestCase)]) +2082 suite.addTests([unittest.makeSuite(ETreeXSLTExtFuncTestCase)]) +2083 suite.addTests([unittest.makeSuite(ETreeXSLTExtElementTestCase)]) +2084 if is_python3: +2085 suite.addTests([unittest.makeSuite(Py3XSLTTestCase)]) +2086 suite.addTests( +2087 [make_doctest('../../../doc/extensions.txt')]) +2088 suite.addTests( +2089 [make_doctest('../../../doc/xpathxslt.txt')]) +2090 return suite +
2091 +2092 if __name__ == '__main__': +2093 print('to test use test.py %s' % __file__) +2094 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html b/doc/html/api/lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html new file mode 100644 index 00000000..06ca6239 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html @@ -0,0 +1,523 @@ + + + + + lxml.tests.test_xslt.ETreeEXSLTTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt :: + Class ETreeEXSLTTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeEXSLTTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeEXSLTTestCase
+
+ +
+EXSLT tests + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_exslt_str(self) + source code + +
+ +
+   + + + + + + +
test_exslt_str_attribute_replace(self) + source code + +
+ +
+   + + + + + + +
test_exslt_math(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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html new file mode 100644 index 00000000..e888bb44 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html @@ -0,0 +1,619 @@ + + + + + lxml.tests.test_xslt.ETreeXSLTExtElementTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt :: + Class ETreeXSLTExtElementTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXSLTExtElementTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXSLTExtElementTestCase
+
+ +
+Tests for extension elements in XSLT. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_extension_element(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_doc_context(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_comment_pi_context(self) + source code + +
+ +
+   + + + + + + +
_test_extension_element_attribute_context(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_content(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates_elements_only(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates_remove_blank_text(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates_target_node(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates_target_node_doc(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_process_children(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_process_children_to_append_only(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_process_children_to_read_only_raise(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_process_children_with_subextension_element(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_raise(self) + source code + +
+ +
+   + + + + + + +
_test_multiple_extension_elements_with_output_parent(self) + source code + +
+ +
+   + + + + + + +
test_extensions_nsmap(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html new file mode 100644 index 00000000..53af1ed1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html @@ -0,0 +1,427 @@ + + + + + lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt :: + Class ETreeXSLTExtFuncTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXSLTExtFuncTestCase

source code

+
+               object --+        
+                        |        
+   unittest.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXSLTExtFuncTestCase
+
+ +
+Tests for XPath extension functions in XSLT. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_extensions1(self) + source code + +
+ +
+   + + + + + + +
test_extensions2(self) + source code + +
+ +
+   + + + + + + +
test_variable_result_tree_fragment(self) + source code + +
+ +
+   + + + + + + +
test_xpath_on_context_node(self) + source code + +
+ +
+   + + + + + + +
test_xpath_on_foreign_context_node(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..7a3818a2 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTTestCase-class.html @@ -0,0 +1,1367 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXSLTTestCase
+
+ +
+XSLT tests etree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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 + +
+ +
+   + + + + + + +
_xslt_setup(*args, + **kwds) + source code + +
+ +
+   + + + + + + +
test_xslt_utf8(self) + source code + +
+ +
+   + + + + + + +
test_xslt_encoding(self) + source code + +
+ +
+   + + + + + + +
test_xslt_encoding_override(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_bytesio(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_failure(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_file(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_file_path(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_file_path_urlescaped(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_file_path_urlescaped_plus(self) + source code + +
+ +
+   + + + + + + +
test_xslt_write_output_file_oserror(self) + source code + +
+ +
+   + + + + + + +
test_xslt_unicode(self) + source code + +
+ +
+   + + + + + + +
test_xslt_unicode_standalone(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_parsing_error_log(self) + source code + +
+ +
+   + + + + + + +
test_xslt_apply_error_log(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_parameter_xpath_object(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_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_access_control_repr(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 + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

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

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

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

Inherited from object: + __class__ +

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

_xslt_setup(*args, + **kwds) +

+
source code  +
+ + +
+
Decorators:
+
    +
  • @contextlib.contextmanager
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 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 00000000..6ce4e80b --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.Py3XSLTTestCase-class.html @@ -0,0 +1,402 @@ + + + + + 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.case.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               Py3XSLTTestCase
+
+ +
+XSLT tests for etree under Python 3 + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.case.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.case.TestCase: + __call__, + __eq__, + __hash__, + __init__, + __ne__, + __repr__, + __str__, + addCleanup, + addTypeEqualityFunc, + assertAlmostEqual, + assertAlmostEquals, + assertDictContainsSubset, + assertDictEqual, + assertEqual, + assertEquals, + assertFalse, + assertGreater, + assertGreaterEqual, + assertIn, + assertIs, + assertIsInstance, + assertIsNone, + assertIsNot, + assertIsNotNone, + assertItemsEqual, + assertLess, + assertLessEqual, + assertListEqual, + assertMultiLineEqual, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertNotIn, + assertNotIsInstance, + assertNotRegexpMatches, + assertRaises, + assertRaisesRegexp, + assertRegexpMatches, + assertSequenceEqual, + assertSetEqual, + assertTrue, + assertTupleEqual, + assert_, + countTestCases, + debug, + defaultTestResult, + doCleanups, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription, + skipTest +

+

Inherited from unittest.case.TestCase (private): + _addSkip, + _baseAssertEqual, + _deprecate, + _formatMessage, + _getAssertEqualityFunc, + _truncateMessage +

+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+

Inherited from unittest.case.TestCase: + setUpClass, + tearDownClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + pytestmark = <lxml.tests.common_imports.skipif object> +
+

Inherited from unittest.case.TestCase: + longMessage, + maxDiff +

+

Inherited from unittest.case.TestCase (private): + _classSetupFailed, + _diffThreshold +

+
+ + + + + + + + + +
+ + + + + +
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 00000000..1153e48a --- /dev/null +++ b/doc/html/api/lxml.usedoctest-module.html @@ -0,0 +1,123 @@ + + + + + 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 00000000..0bb2f6c0 --- /dev/null +++ b/doc/html/api/lxml.usedoctest-pysrc.html @@ -0,0 +1,135 @@ + + + + + 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/mimetools.Message-class.html b/doc/html/api/mimetools.Message-class.html new file mode 100644 index 00000000..4da45b72 --- /dev/null +++ b/doc/html/api/mimetools.Message-class.html @@ -0,0 +1,386 @@ + + + + + mimetools.Message + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + mimetools :: + Message :: + Class Message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Message

+
+rfc822.Message --+
+                 |
+                Message
+
+ +
+A derived class of rfc822.Message that knows about MIME headers and +contains some hooks for decoding encoded and multipart messages. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + fp, + seekable=1)
+ Initialize the class instance and read the headers.
+ + +
+ +
+   + + + + + + +
getencoding(self) + + +
+ +
+   + + + + + + +
getmaintype(self) + + +
+ +
+   + + + + + + +
getparam(self, + name) + + +
+ +
+   + + + + + + +
getparamnames(self) + + +
+ +
+   + + + + + + +
getplist(self) + + +
+ +
+   + + + + + + +
getsubtype(self) + + +
+ +
+   + + + + + + +
gettype(self) + + +
+ +
+   + + + + + + +
parseplist(self) + + +
+ +
+   + + + + + + +
parsetype(self) + + +
+ +
+

Inherited from rfc822.Message: + __contains__, + __delitem__, + __getitem__, + __iter__, + __len__, + __setitem__, + __str__, + get, + getaddr, + getaddrlist, + getallmatchingheaders, + getdate, + getdate_tz, + getfirstmatchingheader, + getheader, + getheaders, + getrawheader, + has_key, + iscomment, + isheader, + islast, + items, + keys, + readheaders, + rewindbody, + setdefault, + values +

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

__init__(self, + fp, + seekable=1) +
(Constructor) +

+
  +
+ + Initialize the class instance and read the headers. +
+
Overrides: + rfc822.Message.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/module-tree.html b/doc/html/api/module-tree.html new file mode 100644 index 00000000..26589b56 --- /dev/null +++ b/doc/html/api/module-tree.html @@ -0,0 +1,182 @@ + + + + + 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 00000000..7b06c680 --- /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 00000000..0f96f0bd --- /dev/null +++ b/doc/html/api/str-class.html @@ -0,0 +1,1651 @@ + + + + + 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
+ + +
+ +
+ string + + + + + + +
__format__(S, + format_spec)
+ Return a formatted version of S as described by format_spec.
+ + +
+ +
+   + + + + + + +
__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
+ + +
+ +
+ size of S in memory, in bytes + + + + + + +
__sizeof__(S)
+ size of object in memory, in bytes
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+   + + + + + + +
_formatter_field_name_split(...) + + +
+ +
+   + + + + + + +
_formatter_parser(...) + + +
+ +
+ 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. Padding is +done using the specified fill character (default is a space)
+ + +
+ +
+ int + + + + + + +
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.
+ + +
+ +
+ object + + + + + + +
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 registered with codecs.register_error that is +able to handle UnicodeDecodeErrors.
+ + +
+ +
+ 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.
+ + +
+ +
+ bool + + + + + + +
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.
+ + +
+ +
+ string + + + + + + +
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.
+ + +
+ +
+ 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]. Optional +arguments start and end are interpreted as in slice notation.
+ + +
+ +
+ string + + + + + + +
format(S, + *args, + **kwargs)
+ Return a formatted version of S, using substitutions from args and kwargs. +The substitutions are identified by braces ('{' and '}').
+ + +
+ +
+ 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. uppercase characters may only follow uncased +characters and lowercase characters only cased ones. Return False +otherwise.
+ + +
+ +
+ 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, + iterable)
+ Return a string which is the concatenation of the strings in the +iterable. The separator between elements is S.
+ + +
+ +
+ 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).
+ + +
+ +
+ 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. +If chars is given and not None, remove characters in chars instead. +If chars is unicode, S will be converted to unicode before stripping
+ + +
+ +
+ (head, sep, tail) + + + + + + +
partition(S, + sep)
+ Search for the separator sep in S, and return the part before it, +the separator itself, and the part after it. If the separator is not +found, return S and two empty strings.
+ + +
+ +
+ string + + + + + + +
replace(S, + old, + new, + count=...)
+ 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.
+ + +
+ +
+ 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]. Optional +arguments start and end are interpreted as in slice notation.
+ + +
+ +
+ 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. Padding is +done using the specified fill character (default is a space)
+ + +
+ +
+ (head, sep, tail) + + + + + + +
rpartition(S, + sep)
+ Search for the separator sep in S, starting at the end of S, and return +the part before it, the separator itself, and the part after it. If the +separator is not found, return two empty strings and S.
+ + +
+ +
+ 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. If maxsplit is given, at most maxsplit splits are +done. If sep is not specified or is None, any whitespace string +is a separator.
+ + +
+ +
+ string or unicode + + + + + + +
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
+ + +
+ +
+ list of strings + + + + + + +
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 and empty strings are removed +from the result.
+ + +
+ +
+ list of strings + + + + + + +
splitlines(S, + keepends=False)
+ 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.
+ + +
+ +
+ bool + + + + + + +
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.
+ + +
+ +
+ string or unicode + + + + + + +
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
+ + +
+ +
+ 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. words start with uppercase +characters, all remaining cased characters have lowercase.
+ + +
+ +
+ 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 or None. +If the table argument is None, no translation is applied and +the operation simply removes the characters in deletechars.
+ + +
+ +
+ 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. The string S is never truncated.
+ + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__format__(S, + format_spec) +

+
  +
+ + Return a formatted version of S as described by format_spec. +
+
Returns: string
+
Overrides: + object.__format__ +
+
+
+
+ +
+ +
+ + +
+

__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__ +
+
+
+
+ +
+ +
+ + +
+

__sizeof__(S) +

+
  +
+ + size of object in memory, in bytes +
+
Returns: size of S in memory, in bytes
+
Overrides: + object.__sizeof__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

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
+
+
+
+ +
+ +
+ + +
+

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
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/toc-everything.html b/doc/html/api/toc-everything.html new file mode 100644 index 00000000..14b59e3d --- /dev/null +++ b/doc/html/api/toc-everything.html @@ -0,0 +1,1378 @@ + + + + + Everything + + + + + +

Everything

+
+

All Classes

+ abc.ABCMeta
cssselect.parser.SelectorError
cssselect.parser.SelectorSyntaxError
cssselect.xpath.ExpressionError
cssselect.xpath.XPathExpr
exceptions.AssertionError
lxml.ElementInclude.FatalIncludeError
lxml.ElementInclude.LimitedRecursiveIncludeError
lxml.builder.ElementMaker
lxml.cssselect.CSSSelector
+ lxml.cssselect.LxmlHTMLTranslator
+
+ lxml.cssselect.LxmlTranslator
+ lxml.doctestcompare.LHTMLOutputChecker
lxml.doctestcompare.LXMLOutputChecker
+ lxml.doctestcompare._RestoreChecker
+
+ lxml.etree.AncestorsIterator
+ lxml.etree.AttributeBasedElementClassLookup
lxml.etree.C14NError
lxml.etree.C14NWriterTarget
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.HTMLPullParser
+ 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.XMLPullParser
+ 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._Attrib
+
+ lxml.etree._BaseErrorLog
+
+ lxml.etree._Comment
+
+ lxml.etree._Document
+
+ lxml.etree._DomainErrorLog
+
+ lxml.etree._Element
+
+ lxml.etree._ElementIterator
+
+ lxml.etree._ElementMatchIterator
+
+ lxml.etree._ElementStringResult
+
+ lxml.etree._ElementTagMatcher
+
+ lxml.etree._ElementTree
+
+ lxml.etree._ElementUnicodeResult
+
+ lxml.etree._Entity
+
+ lxml.etree._ErrorLog
+
+ lxml.etree._FeedParser
+
+ lxml.etree._IDDict
+
+ lxml.etree._ListErrorLog
+
+ lxml.etree._LogEntry
+
+ lxml.etree._ProcessingInstruction
+
+ lxml.etree._RotatingErrorLog
+
+ lxml.etree._SaxParserTarget
+
+ lxml.etree._TargetParserResult
+
+ lxml.etree._Validator
+
+ lxml.etree._XPathEvaluatorBase
+
+ lxml.etree._XSLTProcessingInstruction
+
+ lxml.etree._XSLTResultTree
+
+ lxml.etree.htmlfile
+ lxml.etree.iterparse
lxml.etree.iterwalk
+ lxml.etree.xmlfile
+
+ lxml.html.CheckboxGroup
+
+ lxml.html.CheckboxValues
+
+ lxml.html.Classes
+
+ lxml.html.FieldsDict
+
+ lxml.html.FormElement
+
+ lxml.html.HTMLParser
+
+ lxml.html.HtmlComment
+
+ lxml.html.HtmlElement
+
+ lxml.html.HtmlElementClassLookup
+
+ lxml.html.HtmlEntity
+
+ lxml.html.HtmlMixin
+
+ lxml.html.HtmlProcessingInstruction
+
+ lxml.html.InputElement
+
+ lxml.html.InputGetter
+
+ lxml.html.InputMixin
+
+ lxml.html.LabelElement
+
+ lxml.html.MultipleSelectOptions
+
+ lxml.html.RadioGroup
+
+ lxml.html.SelectElement
+
+ lxml.html.TextareaElement
+
+ lxml.html.XHTMLParser
+
+ lxml.html._MethodFunc
+ lxml.html.clean.Cleaner
+ lxml.html.diff.DEL_END
+
+ lxml.html.diff.DEL_START
+
+ lxml.html.diff.InsensitiveSequenceMatcher
+
+ lxml.html.diff.NoDeletes
+
+ lxml.html.diff.href_token
+
+ lxml.html.diff.tag_token
+
+ lxml.html.diff.token
+ lxml.html.formfill.DefaultErrorCreator
lxml.html.formfill.FormNotFound
lxml.html.html5parser.HTMLParser
lxml.html.html5parser.XHTMLParser
+ lxml.html.soupparser._PseudoTag
+ lxml.isoschematron.Schematron
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.common_imports.skipif
lxml.tests.dummy_http_server.HTTPRequestCollector
lxml.tests.dummy_http_server.WebServer
+ lxml.tests.dummy_http_server._RequestHandler
+ lxml.tests.test_builder.BuilderTestCase
lxml.tests.test_classlookup.ClassLookupTestCase
lxml.tests.test_classlookup.ProxyTestCase
lxml.tests.test_css.CSSTestCase
lxml.tests.test_doctestcompare.DoctestCompareTest
lxml.tests.test_doctestcompare.DummyInput
lxml.tests.test_dtd.ETreeDtdTestCase
lxml.tests.test_elementpath.EtreeElementPathTestCase
lxml.tests.test_elementtree.CElementTreeElementSlicingTest
lxml.tests.test_elementtree.CElementTreeTestCase
lxml.tests.test_elementtree.ETreeC14N2TostringTest
lxml.tests.test_elementtree.ETreeC14N2WriteTest
lxml.tests.test_elementtree.ETreeC14NTest
lxml.tests.test_elementtree.ETreeElementSlicingTest
lxml.tests.test_elementtree.ETreePullTestCase
lxml.tests.test_elementtree.ETreeTestCase
lxml.tests.test_elementtree.ElementTreeElementSlicingTest
lxml.tests.test_elementtree.ElementTreeTestCase
+ lxml.tests.test_elementtree._C14NTest
+
+ lxml.tests.test_elementtree._ETreeTestCaseBase
+
+ lxml.tests.test_elementtree._ElementSlicingTest
+
+ lxml.tests.test_elementtree._XMLPullParserTest
+ 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.XMLPullParserTest
+ lxml.tests.test_etree._XIncludeTestCase
+ lxml.tests.test_external_document.ExternalDocumentTestCase
lxml.tests.test_htmlparser.HtmlParserTestCase
lxml.tests.test_http_io.HttpIOTestCase
lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase
lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase
lxml.tests.test_incremental_xmlfile.HtmlFileTestCase
lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase
lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike
lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase
lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase
+ lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase
+ lxml.tests.test_io.ETreeIOTestCase
lxml.tests.test_io.ElementTreeIOTestCase
+ lxml.tests.test_io._IOTestCaseBase
+ lxml.tests.test_isoschematron.ETreeISOSchematronTestCase
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_relaxng.RelaxNGCompactTestCase
lxml.tests.test_sax.ETreeSaxTestCase
lxml.tests.test_sax.NSPrefixSaxTestCase
lxml.tests.test_sax.SimpleContentHandler
lxml.tests.test_schematron.ETreeSchematronTestCase
lxml.tests.test_threading.ThreadPipelineTestCase
lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker
lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker
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.Validate
lxml.tests.test_threading.ThreadPipelineTestCase.Worker
lxml.tests.test_threading.ThreadingTestCase
lxml.tests.test_unicode.EncodingsTestCase
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.ETreeXPathExsltTestCase
lxml.tests.test_xpathevaluator.ETreeXPathTestCase
lxml.tests.test_xslt.ETreeEXSLTTestCase
lxml.tests.test_xslt.ETreeXSLTExtElementTestCase
lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase
lxml.tests.test_xslt.ETreeXSLTTestCase
lxml.tests.test_xslt.Py3XSLTTestCase
mimetools.Message
str
xml.etree.ElementTree.Element
xml.etree.ElementTree.ElementTree
xml.etree.ElementTree.ParseError
xml.etree.ElementTree.QName
xml.etree.ElementTree.TreeBuilder
xml.etree.ElementTree.XMLParser
xml.etree.ElementTree._IterParseIterator
xml.etree.ElementTree._SimpleElementPath

All Functions

+
+ lxml.ElementInclude._include
+
+ lxml.ElementInclude._lxml_default_loader
+
+ lxml.ElementInclude._wrap_et_loader
+ lxml.ElementInclude.default_loader
lxml.ElementInclude.include
+ lxml.builder.__pyx_unpickle_ElementMaker
+ lxml.builder.__reduce_cython__
lxml.builder.__setstate_cython__
+ lxml.cssselect._make_lower_case
+
+ lxml.doctestcompare._find_doctest_frame
+
+ lxml.doctestcompare.html_fromstring
+ lxml.doctestcompare.install
+ lxml.doctestcompare.norm_whitespace
+
+ lxml.doctestcompare.strip
+ 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.adopt_external_document
+ lxml.etree.canonicalize
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.register_namespace
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.get_include
lxml.html.ElementSoup.parse
lxml.html.builder.CLASS
lxml.html.builder.FOR
+ lxml.html.clean._break_text
+
+ lxml.html.clean._insert_break
+
+ lxml.html.clean._is_image_dataurl
+
+ lxml.html.clean._is_javascript_scheme
+
+ lxml.html.clean._is_possibly_malicious_scheme
+
+ lxml.html.clean._link_text
+
+ lxml.html.clean._substitute_whitespace
+ lxml.html.clean.autolink
lxml.html.clean.autolink_html
lxml.html.clean.clean_html
+ lxml.html.clean.unichr
+ lxml.html.clean.word_break
lxml.html.clean.word_break_html
+ lxml.html.diff._contains_block_level_tag
+
+ lxml.html.diff._fixup_ins_del_tags
+
+ lxml.html.diff._merge_element_contents
+
+ lxml.html.diff._move_el_inside_block
+
+ lxml.html.diff.cleanup_delete
+
+ lxml.html.diff.cleanup_html
+
+ lxml.html.diff.compress_merge_back
+
+ lxml.html.diff.compress_tokens
+
+ lxml.html.diff.copy_annotations
+
+ lxml.html.diff.default_markup
+
+ lxml.html.diff.end_tag
+
+ lxml.html.diff.expand_tokens
+
+ lxml.html.diff.fixup_chunks
+
+ lxml.html.diff.fixup_ins_del_tags
+
+ lxml.html.diff.flatten_el
+ lxml.html.diff.html_annotate
+ lxml.html.diff.html_annotate_merge_annotations
+ lxml.html.diff.htmldiff
+ lxml.html.diff.htmldiff_tokens
+
+ lxml.html.diff.is_end_tag
+
+ lxml.html.diff.is_start_tag
+
+ lxml.html.diff.is_word
+
+ lxml.html.diff.locate_unbalanced_end
+
+ lxml.html.diff.locate_unbalanced_start
+
+ lxml.html.diff.markup_serialize_tokens
+
+ lxml.html.diff.merge_delete
+
+ lxml.html.diff.merge_insert
+
+ lxml.html.diff.parse_html
+
+ lxml.html.diff.serialize_html_fragment
+
+ lxml.html.diff.split_delete
+
+ lxml.html.diff.split_trailing_whitespace
+
+ lxml.html.diff.split_unbalanced
+
+ lxml.html.diff.split_words
+
+ lxml.html.diff.start_tag
+
+ lxml.html.diff.tokenize
+
+ lxml.html.diff.tokenize_annotated
+
+ lxml.html.formfill._add_class
+
+ lxml.html.formfill._check
+
+ lxml.html.formfill._fill_form
+
+ lxml.html.formfill._fill_multiple
+
+ lxml.html.formfill._fill_single
+
+ lxml.html.formfill._find_elements_for_name
+
+ lxml.html.formfill._find_form
+
+ lxml.html.formfill._find_form_ids
+
+ lxml.html.formfill._insert_error
+
+ lxml.html.formfill._select
+
+ lxml.html.formfill._takes_multiple
+ lxml.html.formfill.fill_form
lxml.html.formfill.fill_form_html
lxml.html.formfill.insert_errors
lxml.html.formfill.insert_errors_html
+ lxml.html.html5parser._find_tag
+
+ lxml.html.html5parser._looks_like_url
+ 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.soupparser._convert_tree
+
+ lxml.html.soupparser._init_node_converters
+
+ lxml.html.soupparser._parse
+
+ lxml.html.soupparser._parse_doctype_declaration
+ lxml.html.soupparser.convert_tree
lxml.html.soupparser.fromstring
+ lxml.html.soupparser.handle_entities
+ lxml.html.soupparser.parse
+ lxml.html.soupparser.unescape
+
+ lxml.isoschematron._stylesheet_param_dict
+ lxml.isoschematron.stylesheet_params
lxml.objectify.DataElement
lxml.objectify.Element
lxml.objectify.XML
+ lxml.objectify.__checkBool
+
+ lxml.objectify.__lower_bool
+
+ lxml.objectify.__parseBool
+
+ lxml.objectify.__unpickleElementTree
+ 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.__pyx_unpickle_ElementTreeProducer
+ lxml.sax.__reduce_cython__
lxml.sax.__setstate_cython__
+ lxml.sax._getNsTag
+ lxml.sax.saxify
+ lxml.tests.common_imports._bytes
+
+ lxml.tests.common_imports._fix_bytes
+
+ lxml.tests.common_imports._fix_exceptions
+
+ lxml.tests.common_imports._fix_traceback
+
+ lxml.tests.common_imports._get_caller_relative_path
+
+ lxml.tests.common_imports._str
+ lxml.tests.common_imports.canonicalize
lxml.tests.common_imports.fileInTestDir
lxml.tests.common_imports.fileUrlInTestDir
lxml.tests.common_imports.filter_by_version
lxml.tests.common_imports.make_doctest
lxml.tests.common_imports.make_version_tuple
lxml.tests.common_imports.path2url
lxml.tests.common_imports.readFileInTestDir
lxml.tests.common_imports.read_file
lxml.tests.common_imports.tmpfile
lxml.tests.common_imports.write_to_file
lxml.tests.dummy_http_server.build_web_server
lxml.tests.dummy_http_server.webserver
lxml.tests.selftest.bad_find
lxml.tests.selftest.bug_xmltoolkit25
lxml.tests.selftest.bug_xmltoolkit28
lxml.tests.selftest.check_element
lxml.tests.selftest.check_element_tree
lxml.tests.selftest.check_mapping
lxml.tests.selftest.check_string
lxml.tests.selftest.check_string_or_none
lxml.tests.selftest.encoding
lxml.tests.selftest.find
lxml.tests.selftest.fix_compatibility
lxml.tests.selftest.interface
lxml.tests.selftest.iterators
lxml.tests.selftest.iterparse
lxml.tests.selftest.namespace
lxml.tests.selftest.normalize_crlf
lxml.tests.selftest.parsefile
lxml.tests.selftest.parseliteral
lxml.tests.selftest.qname
lxml.tests.selftest.serialize
lxml.tests.selftest.simpleops
lxml.tests.selftest.stdout
lxml.tests.selftest.summarize
lxml.tests.selftest.summarize_list
lxml.tests.selftest.writefile
lxml.tests.selftest.writestring
lxml.tests.selftest.xinclude
lxml.tests.selftest.xinclude_default
lxml.tests.selftest.xinclude_loader
lxml.tests.selftest.xpath_tokenizer
lxml.tests.selftest2.attrib
lxml.tests.selftest2.cdata
lxml.tests.selftest2.check_element
lxml.tests.selftest2.check_element_tree
lxml.tests.selftest2.check_mapping
lxml.tests.selftest2.check_string
lxml.tests.selftest2.copy
lxml.tests.selftest2.element
lxml.tests.selftest2.encoding
lxml.tests.selftest2.find
lxml.tests.selftest2.makeelement
lxml.tests.selftest2.parsefile
lxml.tests.selftest2.qname
lxml.tests.selftest2.serialize
lxml.tests.selftest2.stdout
lxml.tests.selftest2.summarize
lxml.tests.selftest2.summarize_list
lxml.tests.selftest2.unserialize
lxml.tests.selftest2.writefile
lxml.tests.test_builder.test_suite
lxml.tests.test_classlookup.test_suite
lxml.tests.test_css.test_suite
lxml.tests.test_doctestcompare.indent
lxml.tests.test_doctestcompare.test_suite
lxml.tests.test_dtd.test_suite
lxml.tests.test_elementpath.normalize_crlf
lxml.tests.test_elementpath.summarize
lxml.tests.test_elementpath.summarize_list
lxml.tests.test_elementpath.test_suite
lxml.tests.test_elementtree.et_needs_pyversion
lxml.tests.test_elementtree.test_suite
lxml.tests.test_errors.test_suite
lxml.tests.test_etree.test_suite
lxml.tests.test_external_document.test_suite
lxml.tests.test_htmlparser.test_suite
lxml.tests.test_http_io.test_suite
lxml.tests.test_incremental_xmlfile.test_suite
lxml.tests.test_io.test_suite
lxml.tests.test_isoschematron.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.stringListTest
lxml.tests.test_xpathevaluator.stringTest
lxml.tests.test_xpathevaluator.tag
lxml.tests.test_xpathevaluator.tag_or_value
lxml.tests.test_xpathevaluator.test_suite
lxml.tests.test_xpathevaluator.xpath
lxml.tests.test_xslt.test_suite

All Variables

+ lxml.ElementInclude.DEFAULT_MAX_INCLUSION_DEPTH
lxml.ElementInclude.XINCLUDE
lxml.ElementInclude.XINCLUDE_FALLBACK
lxml.ElementInclude.XINCLUDE_INCLUDE
lxml.ElementInclude.XINCLUDE_ITER_TAG
lxml.ElementInclude.__package__
lxml.__package__
lxml.builder.E
lxml.builder.__package__
lxml.builder.__pyx_capi__
lxml.builder.__test__
+ lxml.cssselect.__package__
+
+ lxml.cssselect.ns
+ lxml.doctestcompare.NOPARSE_MARKUP
lxml.doctestcompare.PARSE_HTML
lxml.doctestcompare.PARSE_XML
+ lxml.doctestcompare._IS_PYTHON_3
+
+ lxml.doctestcompare.__package__
+
+ lxml.doctestcompare.__test__
+
+ lxml.doctestcompare._html_parser
+
+ lxml.doctestcompare._norm_whitespace_re
+
+ lxml.doctestcompare._repr_re
+ 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.__package__
+
+ lxml.etree.__pyx_capi__
+
+ lxml.etree.__test__
+
+ lxml.etree.memory_debugger
+
+ lxml.html.ElementSoup.__doc__
+
+ lxml.html.ElementSoup.__package__
+
+ lxml.html.XHTML_NAMESPACE
+
+ lxml.html.__package__
+
+ lxml.html._archive_re
+
+ lxml.html._class_xpath
+
+ lxml.html._collect_string_content
+
+ lxml.html._forms_xpath
+
+ lxml.html._id_xpath
+
+ lxml.html._label_xpath
+
+ lxml.html._options_xpath
+
+ lxml.html._rel_links_xpath
+ 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.builder.__package__
+ lxml.html.clean.__package__
+
+ lxml.html.clean.__test__
+
+ lxml.html.clean._avoid_classes
+
+ lxml.html.clean._avoid_elements
+
+ lxml.html.clean._avoid_hosts
+
+ lxml.html.clean._avoid_word_break_classes
+
+ lxml.html.clean._avoid_word_break_elements
+
+ lxml.html.clean._break_prefer_re
+
+ lxml.html.clean._conditional_comment_re
+
+ lxml.html.clean._css_import_re
+
+ lxml.html.clean._css_javascript_re
+
+ lxml.html.clean._find_external_links
+
+ lxml.html.clean._find_styled_elements
+
+ lxml.html.clean._link_regexes
+
+ lxml.html.clean.basestring
+ lxml.html.clean.clean
lxml.html.defs.__package__
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.html5_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.diff.__package__
+
+ lxml.html.diff.__test__
+
+ lxml.html.diff._body_re
+
+ lxml.html.diff._end_body_re
+
+ lxml.html.diff._ins_del_re
+
+ lxml.html.diff.block_level_container_tags
+
+ lxml.html.diff.block_level_tags
+
+ lxml.html.diff.empty_tags
+
+ lxml.html.diff.end_whitespace_re
+
+ lxml.html.diff.split_words_re
+
+ lxml.html.diff.start_whitespace_re
+ lxml.html.find_class
lxml.html.find_rel_links
+ lxml.html.formfill.__package__
+
+ lxml.html.formfill._form_name_xpath
+
+ lxml.html.formfill._input_xpath
+
+ lxml.html.formfill._label_for_xpath
+
+ lxml.html.formfill._name_xpath
+
+ lxml.html.formfill._tag
+
+ lxml.html.formfill.default_error_creator
+ lxml.html.html5parser.__package__
lxml.html.html5parser.html_parser
lxml.html.html5parser.xhtml_parser
+ lxml.html.html_parser
+ lxml.html.iterlinks
lxml.html.make_links_absolute
lxml.html.resolve_base_href
lxml.html.rewrite_links
+ lxml.html.soupparser._DECLARATION_OR_DOCTYPE
+
+ lxml.html.soupparser.__package__
+
+ lxml.html.xhtml_parser
+ lxml.includes.__package__
+ lxml.isoschematron.RELAXNG_NS
+
+ lxml.isoschematron.SCHEMATRON_NS
+
+ lxml.isoschematron.SVRL_NS
+
+ lxml.isoschematron.XML_SCHEMA_NS
+
+ lxml.isoschematron.__package__
+
+ lxml.isoschematron._resources_dir
+
+ lxml.isoschematron._schematron_root
+
+ lxml.isoschematron._xml_schema_root
+ lxml.isoschematron.extract_rng
lxml.isoschematron.extract_xsd
lxml.isoschematron.iso_abstract_expand
lxml.isoschematron.iso_dsdl_include
lxml.isoschematron.iso_svrl_for_xslt1
lxml.isoschematron.schematron_schema_valid
lxml.isoschematron.svrl_validation_errors
lxml.objectify.E
lxml.objectify.PYTYPE_ATTRIBUTE
+ lxml.objectify.__package__
+
+ lxml.objectify.__test__
+ lxml.pyclasslookup.__package__
lxml.sax.__package__
lxml.sax.__pyx_capi__
lxml.sax.__test__
lxml.tests.__package__
lxml.tests.common_imports.CET_VERSION
lxml.tests.common_imports.ET_VERSION
lxml.tests.common_imports.IS_PYPY
lxml.tests.common_imports.IS_PYTHON2
lxml.tests.common_imports.IS_PYTHON3
lxml.tests.common_imports.__package__
+ lxml.tests.common_imports._fix_unicode
+ lxml.tests.common_imports.doctest_parser
lxml.tests.common_imports.unichr_escape
lxml.tests.dummy_http_server.__package__
lxml.tests.selftest.ENTITY_XML
lxml.tests.selftest.SAMPLE_XML
lxml.tests.selftest.XINCLUDE
lxml.tests.selftest.__package__
lxml.tests.selftest2.ENTITY_XML
lxml.tests.selftest2.SAMPLE_XML
lxml.tests.selftest2.SAMPLE_XML_NS
lxml.tests.selftest2.__package__
lxml.tests.test_builder.__package__
lxml.tests.test_builder.this_dir
lxml.tests.test_classlookup.__package__
lxml.tests.test_classlookup.this_dir
lxml.tests.test_classlookup.xml_str
lxml.tests.test_css.HTML
lxml.tests.test_css.__package__
lxml.tests.test_doctestcompare.__package__
lxml.tests.test_dtd.__package__
lxml.tests.test_dtd.this_dir
lxml.tests.test_elementpath.__package__
lxml.tests.test_elementtree.ElementTreeC14NTest
lxml.tests.test_elementtree.ElementTreePullTestCase
lxml.tests.test_elementtree.__package__
lxml.tests.test_elementtree.cElementTree
lxml.tests.test_elementtree.this_dir
lxml.tests.test_errors.__package__
lxml.tests.test_errors.this_dir
lxml.tests.test_etree.__package__
lxml.tests.test_external_document.DESTRUCTOR_NAME
lxml.tests.test_external_document.DOC_NAME
lxml.tests.test_external_document.__package__
lxml.tests.test_htmlparser.__package__
lxml.tests.test_htmlparser.this_dir
lxml.tests.test_http_io.__package__
lxml.tests.test_http_io.this_dir
lxml.tests.test_incremental_xmlfile.__package__
lxml.tests.test_incremental_xmlfile.this_dir
lxml.tests.test_io.__package__
lxml.tests.test_isoschematron.__package__
lxml.tests.test_isoschematron.this_dir
lxml.tests.test_nsclasses.__package__
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.__package__
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.__package__
lxml.tests.test_pyclasslookup.this_dir
lxml.tests.test_pyclasslookup.xml_str
lxml.tests.test_relaxng.__package__
lxml.tests.test_relaxng.rnc2rng
lxml.tests.test_relaxng.this_dir
lxml.tests.test_sax.__package__
lxml.tests.test_sax.this_dir
lxml.tests.test_schematron.__package__
lxml.tests.test_schematron.this_dir
lxml.tests.test_threading.__package__
lxml.tests.test_threading.this_dir
lxml.tests.test_unicode.__package__
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.__package__
lxml.tests.test_xmlschema.this_dir
lxml.tests.test_xpathevaluator.SAMPLE_XML
lxml.tests.test_xpathevaluator.__package__
lxml.tests.test_xpathevaluator.extension
lxml.tests.test_xpathevaluator.this_dir
lxml.tests.test_xpathevaluator.uri
lxml.tests.test_xslt.__package__
lxml.tests.test_xslt.is_python3
lxml.tests.test_xslt.this_dir
xml.etree.ElementTree.HTML_EMPTY
xml.etree.ElementTree.VERSION
xml.etree.ElementTree.__package__
xml.etree.ElementTree._namespace_map
xml.etree.ElementTree._sentinel
xml.etree.ElementTree._serialize

+[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 00000000..3c341473 --- /dev/null +++ b/doc/html/api/toc-lxml-module.html @@ -0,0 +1,33 @@ + + + + + lxml + + + + + +

Module lxml

+
+

Functions

+ get_include

Variables

+ __package__

+[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 00000000..c74850d3 --- /dev/null +++ b/doc/html/api/toc-lxml.ElementInclude-module.html @@ -0,0 +1,51 @@ + + + + + ElementInclude + + + + + +

Module ElementInclude

+
+

Classes

+ FatalIncludeError
LimitedRecursiveIncludeError

Functions

+
+ _include
+
+ _lxml_default_loader
+
+ _wrap_et_loader
+ default_loader
include

Variables

+ DEFAULT_MAX_INCLUSION_DEPTH
XINCLUDE
XINCLUDE_FALLBACK
XINCLUDE_INCLUDE
XINCLUDE_ITER_TAG
__package__

+[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 00000000..e2b93285 --- /dev/null +++ b/doc/html/api/toc-lxml.builder-module.html @@ -0,0 +1,44 @@ + + + + + builder + + + + + +

Module builder

+
+

Classes

+ ElementMaker
basestring
unicode

Functions

+
+ __pyx_unpickle_ElementMaker
+ __reduce_cython__
__setstate_cython__

Variables

+ E
__package__
__pyx_capi__
__test__

+[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 00000000..bbfaec1f --- /dev/null +++ b/doc/html/api/toc-lxml.cssselect-module.html @@ -0,0 +1,51 @@ + + + + + cssselect + + + + + +

Module cssselect

+
+

Classes

+ CSSSelector
ExpressionError
+ LxmlHTMLTranslator
+
+ LxmlTranslator
+ SelectorError
SelectorSyntaxError

Functions

+
+ _make_lower_case
+

Variables

+
+ __package__
+
+ 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 00000000..79b9a7e1 --- /dev/null +++ b/doc/html/api/toc-lxml.doctestcompare-module.html @@ -0,0 +1,72 @@ + + + + + doctestcompare + + + + + +

Module doctestcompare

+
+

Classes

+ LHTMLOutputChecker
LXMLOutputChecker
+ _RestoreChecker
+

Functions

+
+ _find_doctest_frame
+
+ html_fromstring
+ install
+ norm_whitespace
+
+ strip
+ temp_install

Variables

+ NOPARSE_MARKUP
PARSE_HTML
PARSE_XML
+ _IS_PYTHON_3
+
+ __package__
+
+ __test__
+
+ _html_parser
+
+ _norm_whitespace_re
+
+ _repr_re
+
+[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 00000000..561eea8e --- /dev/null +++ b/doc/html/api/toc-lxml.etree-module.html @@ -0,0 +1,271 @@ + + + + + etree + + + + + +

Module etree

+
+

Classes

+
+ AncestorsIterator
+ AttributeBasedElementClassLookup
C14NError
C14NWriterTarget
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
+ HTMLPullParser
+ 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
+ XMLPullParser
+ XMLSchema
XMLSchemaError
XMLSchemaParseError
XMLSchemaValidateError
XMLSyntaxError
XMLTreeBuilder
XPath
XPathDocumentEvaluator
+ XPathElementEvaluator
+ XPathError
XPathEvalError
XPathFunctionError
XPathResultError
XPathSyntaxError
XSLT
XSLTAccessControl
XSLTApplyError
XSLTError
XSLTExtension
XSLTExtensionError
XSLTParseError
XSLTSaveError
+ _Attrib
+
+ _BaseErrorLog
+
+ _Comment
+
+ _Document
+
+ _DomainErrorLog
+
+ _Element
+
+ _ElementIterator
+
+ _ElementMatchIterator
+
+ _ElementStringResult
+
+ _ElementTagMatcher
+
+ _ElementTree
+
+ _ElementUnicodeResult
+
+ _Entity
+
+ _ErrorLog
+
+ _FeedParser
+
+ _IDDict
+
+ _ListErrorLog
+
+ _LogEntry
+
+ _ProcessingInstruction
+
+ _RotatingErrorLog
+
+ _SaxParserTarget
+
+ _TargetParserResult
+
+ _Validator
+
+ _XPathEvaluatorBase
+
+ _XSLTProcessingInstruction
+
+ _XSLTResultTree
+
+ htmlfile
+ iterparse
iterwalk
+ xmlfile
+

Functions

+ Comment
Element
ElementTree
Entity
Extension
FunctionNamespace
HTML
PI
ProcessingInstruction
SubElement
XML
XMLDTDID
XMLID
XPathEvaluator
+ adopt_external_document
+ canonicalize
cleanup_namespaces
clear_error_log
dump
fromstring
fromstringlist
get_default_parser
iselement
parse
parseid
register_namespace
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
+ __package__
+
+ __pyx_capi__
+
+ __test__
+
+ memory_debugger
+
+[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 00000000..a5bfc471 --- /dev/null +++ b/doc/html/api/toc-lxml.html-module.html @@ -0,0 +1,197 @@ + + + + + html + + + + + +

Module html

+
+

Classes

+
+ CheckboxGroup
+
+ CheckboxValues
+
+ Classes
+
+ FieldsDict
+
+ FormElement
+
+ HTMLParser
+
+ HtmlComment
+
+ HtmlElement
+
+ HtmlElementClassLookup
+
+ HtmlEntity
+
+ HtmlMixin
+
+ HtmlProcessingInstruction
+
+ InputElement
+
+ InputGetter
+
+ InputMixin
+
+ LabelElement
+
+ MultipleSelectOptions
+
+ RadioGroup
+
+ SelectElement
+
+ TextareaElement
+
+ XHTMLParser
+
+ _MethodFunc
+

Functions

+ Element
+ __bytes_replace_meta_content_type
+
+ __fix_docstring
+
+ __str_replace_meta_content_type
+
+ _contains_block_level_tag
+
+ _element_name
+
+ _iter_css_imports
+
+ _iter_css_urls
+
+ _looks_like_full_html_bytes
+
+ _looks_like_full_html_unicode
+
+ _nons
+
+ _parse_meta_refresh_url
+
+ _transform_result
+
+ _unquote_match
+ document_fromstring
fragment_fromstring
fragments_fromstring
fromstring
+ html_to_xhtml
+
+ open_http_urllib
+ open_in_browser
parse
submit_form
tostring
+ xhtml_to_html
+

Variables

+
+ XHTML_NAMESPACE
+
+ __package__
+
+ _archive_re
+
+ _class_xpath
+
+ _collect_string_content
+
+ _forms_xpath
+
+ _id_xpath
+
+ _label_xpath
+
+ _options_xpath
+
+ _rel_links_xpath
+ find_class
find_rel_links
+ html_parser
+ iterlinks
make_links_absolute
resolve_base_href
rewrite_links
+ xhtml_parser
+
+[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 00000000..1a7167a7 --- /dev/null +++ b/doc/html/api/toc-lxml.html.ElementSoup-module.html @@ -0,0 +1,39 @@ + + + + + ElementSoup + + + + + +

Module ElementSoup

+
+

Functions

+ convert_tree
parse

Variables

+
+ __doc__
+
+ __package__
+
+[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 00000000..05a4e98f --- /dev/null +++ b/doc/html/api/toc-lxml.html.builder-module.html @@ -0,0 +1,126 @@ + + + + + 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
__package__

+[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 00000000..70ea2dfe --- /dev/null +++ b/doc/html/api/toc-lxml.html.clean-module.html @@ -0,0 +1,111 @@ + + + + + clean + + + + + +

Module clean

+
+

Classes

+ Cleaner
+ unicode
+

Functions

+
+ _break_text
+
+ _insert_break
+
+ _is_image_dataurl
+
+ _is_javascript_scheme
+
+ _is_possibly_malicious_scheme
+
+ _link_text
+
+ _substitute_whitespace
+ autolink
autolink_html
clean_html
+ unichr
+ word_break
word_break_html

Variables

+
+ __package__
+
+ __test__
+
+ _avoid_classes
+
+ _avoid_elements
+
+ _avoid_hosts
+
+ _avoid_word_break_classes
+
+ _avoid_word_break_elements
+
+ _break_prefer_re
+
+ _conditional_comment_re
+
+ _css_import_re
+
+ _css_javascript_re
+
+ _find_external_links
+
+ _find_styled_elements
+
+ _link_regexes
+
+ basestring
+ 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 00000000..2dfcfc17 --- /dev/null +++ b/doc/html/api/toc-lxml.html.defs-module.html @@ -0,0 +1,50 @@ + + + + + defs + + + + + +

Module defs

+
+

Variables

+ __package__
block_tags
deprecated_tags
empty_tags
event_attrs
font_style_tags
form_tags
frame_tags
general_block_tags
head_tags
html5_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 00000000..71b779ea --- /dev/null +++ b/doc/html/api/toc-lxml.html.diff-module.html @@ -0,0 +1,193 @@ + + + + + diff + + + + + +

Module diff

+
+

Classes

+
+ DEL_END
+
+ DEL_START
+
+ InsensitiveSequenceMatcher
+
+ NoDeletes
+
+ basestring
+
+ href_token
+
+ tag_token
+
+ token
+

Functions

+
+ _contains_block_level_tag
+
+ _fixup_ins_del_tags
+
+ _merge_element_contents
+
+ _move_el_inside_block
+
+ cleanup_delete
+
+ cleanup_html
+
+ compress_merge_back
+
+ compress_tokens
+
+ copy_annotations
+
+ default_markup
+
+ end_tag
+
+ expand_tokens
+
+ fixup_chunks
+
+ fixup_ins_del_tags
+
+ flatten_el
+ html_annotate
+ html_annotate_merge_annotations
+ htmldiff
+ htmldiff_tokens
+
+ is_end_tag
+
+ is_start_tag
+
+ is_word
+
+ locate_unbalanced_end
+
+ locate_unbalanced_start
+
+ markup_serialize_tokens
+
+ merge_delete
+
+ merge_insert
+
+ parse_html
+
+ serialize_html_fragment
+
+ split_delete
+
+ split_trailing_whitespace
+
+ split_unbalanced
+
+ split_words
+
+ start_tag
+
+ tokenize
+
+ tokenize_annotated
+

Variables

+
+ __package__
+
+ __test__
+
+ _body_re
+
+ _end_body_re
+
+ _ins_del_re
+
+ block_level_container_tags
+
+ block_level_tags
+
+ empty_tags
+
+ end_whitespace_re
+
+ split_words_re
+
+ start_whitespace_re
+
+[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 00000000..66748497 --- /dev/null +++ b/doc/html/api/toc-lxml.html.formfill-module.html @@ -0,0 +1,95 @@ + + + + + formfill + + + + + +

Module formfill

+
+

Classes

+ DefaultErrorCreator
FormNotFound
+ basestring
+

Functions

+
+ _add_class
+
+ _check
+
+ _fill_form
+
+ _fill_multiple
+
+ _fill_single
+
+ _find_elements_for_name
+
+ _find_form
+
+ _find_form_ids
+
+ _insert_error
+
+ _select
+
+ _takes_multiple
+ fill_form
fill_form_html
insert_errors
insert_errors_html

Variables

+
+ __package__
+
+ _form_name_xpath
+
+ _input_xpath
+
+ _label_for_xpath
+
+ _name_xpath
+
+ _tag
+
+ default_error_creator
+
+[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 00000000..1200a413 --- /dev/null +++ b/doc/html/api/toc-lxml.html.html5parser-module.html @@ -0,0 +1,48 @@ + + + + + html5parser + + + + + +

Module html5parser

+
+

Classes

+ HTMLParser
XHTMLParser

Functions

+
+ _find_tag
+
+ _looks_like_url
+ document_fromstring
fragment_fromstring
fragments_fromstring
fromstring
parse

Variables

+ __package__
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 00000000..fff1b4f1 --- /dev/null +++ b/doc/html/api/toc-lxml.html.soupparser-module.html @@ -0,0 +1,65 @@ + + + + + soupparser + + + + + +

Module soupparser

+
+

Classes

+
+ _PseudoTag
+

Functions

+
+ _convert_tree
+
+ _init_node_converters
+
+ _parse
+
+ _parse_doctype_declaration
+ convert_tree
fromstring
+ handle_entities
+ parse
+ unescape
+
+ unichr
+

Variables

+
+ _DECLARATION_OR_DOCTYPE
+
+ __package__
+
+[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 00000000..ee5971fe --- /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.includes-module.html b/doc/html/api/toc-lxml.includes-module.html new file mode 100644 index 00000000..1bed2a82 --- /dev/null +++ b/doc/html/api/toc-lxml.includes-module.html @@ -0,0 +1,31 @@ + + + + + includes + + + + + +

Module includes

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.isoschematron-module.html b/doc/html/api/toc-lxml.isoschematron-module.html new file mode 100644 index 00000000..b9828e42 --- /dev/null +++ b/doc/html/api/toc-lxml.isoschematron-module.html @@ -0,0 +1,74 @@ + + + + + isoschematron + + + + + +

Module isoschematron

+
+

Classes

+ Schematron
+ basestring
+
+ unicode
+

Functions

+
+ _stylesheet_param_dict
+ stylesheet_params

Variables

+
+ RELAXNG_NS
+
+ SCHEMATRON_NS
+
+ SVRL_NS
+
+ XML_SCHEMA_NS
+
+ __package__
+
+ _resources_dir
+
+ _schematron_root
+
+ _xml_schema_root
+ extract_rng
extract_xsd
iso_abstract_expand
iso_dsdl_include
iso_svrl_for_xslt1
schematron_schema_valid
svrl_validation_errors

+[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 00000000..66c92d53 --- /dev/null +++ b/doc/html/api/toc-lxml.objectify-module.html @@ -0,0 +1,82 @@ + + + + + objectify + + + + + +

Module objectify

+
+

Classes

+ BoolElement
ElementMaker
FloatElement
IntElement
LongElement
NoneElement
NumberElement
ObjectPath
ObjectifiedDataElement
ObjectifiedElement
ObjectifyElementClassLookup
PyType
StringElement

Functions

+ DataElement
Element
SubElement
XML
+ __checkBool
+
+ __lower_bool
+
+ __parseBool
+
+ __unpickleElementTree
+ annotate
deannotate
dump
enable_recursive_str
fromstring
getRegisteredTypes
makeparser
parse
pyannotate
pytypename
set_default_parser
set_pytype_attribute_tag
xsiannotate

Variables

+ E
PYTYPE_ATTRIBUTE
+ __package__
+
+ __test__
+
+[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 00000000..fbbebb29 --- /dev/null +++ b/doc/html/api/toc-lxml.pyclasslookup-module.html @@ -0,0 +1,31 @@ + + + + + pyclasslookup + + + + + +

Module pyclasslookup

+
+

Variables

+ __package__

+[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 00000000..03b3d508 --- /dev/null +++ b/doc/html/api/toc-lxml.sax-module.html @@ -0,0 +1,47 @@ + + + + + sax + + + + + +

Module sax

+
+

Classes

+ ElementTreeContentHandler
ElementTreeProducer
SaxError

Functions

+
+ __pyx_unpickle_ElementTreeProducer
+ __reduce_cython__
__setstate_cython__
+ _getNsTag
+ saxify

Variables

+ __package__
__pyx_capi__
__test__

+[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 00000000..d21a924e --- /dev/null +++ b/doc/html/api/toc-lxml.tests-module.html @@ -0,0 +1,31 @@ + + + + + tests + + + + + +

Module tests

+
+

Variables

+ __package__

+[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 00000000..7d82bf2c --- /dev/null +++ b/doc/html/api/toc-lxml.tests.common_imports-module.html @@ -0,0 +1,77 @@ + + + + + common_imports + + + + + +

Module common_imports

+
+

Classes

+ HelperTestCase
LargeFileLike
LargeFileLikeUnicode
SillyFileLike
skipif

Functions

+
+ _bytes
+
+ _fix_bytes
+
+ _fix_exceptions
+
+ _fix_traceback
+
+ _get_caller_relative_path
+
+ _str
+ canonicalize
fileInTestDir
fileUrlInTestDir
filter_by_version
make_doctest
make_version_tuple
path2url
readFileInTestDir
read_file
tmpfile
write_to_file

Variables

+ CET_VERSION
ET_VERSION
IS_PYPY
IS_PYTHON2
IS_PYTHON3
__package__
+ _fix_unicode
+ doctest_parser
unichr_escape

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.dummy_http_server-module.html b/doc/html/api/toc-lxml.tests.dummy_http_server-module.html new file mode 100644 index 00000000..2fdeef0e --- /dev/null +++ b/doc/html/api/toc-lxml.tests.dummy_http_server-module.html @@ -0,0 +1,40 @@ + + + + + dummy_http_server + + + + + +

Module dummy_http_server

+
+

Classes

+ HTTPRequestCollector
WebServer
+ _RequestHandler
+

Functions

+ build_web_server
webserver

Variables

+ __package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.selftest-module.html b/doc/html/api/toc-lxml.tests.selftest-module.html new file mode 100644 index 00000000..b0bdf61b --- /dev/null +++ b/doc/html/api/toc-lxml.tests.selftest-module.html @@ -0,0 +1,65 @@ + + + + + selftest + + + + + +

Module selftest

+
+

Functions

+ bad_find
bug_xmltoolkit25
bug_xmltoolkit28
check_element
check_element_tree
check_mapping
check_string
check_string_or_none
encoding
find
fix_compatibility
interface
iterators
iterparse
namespace
normalize_crlf
parsefile
parseliteral
qname
serialize
simpleops
stdout
summarize
summarize_list
writefile
writestring
xinclude
xinclude_default
xinclude_loader
xpath_tokenizer

Variables

+ ENTITY_XML
SAMPLE_XML
XINCLUDE
__package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.selftest2-module.html b/doc/html/api/toc-lxml.tests.selftest2-module.html new file mode 100644 index 00000000..69adb51f --- /dev/null +++ b/doc/html/api/toc-lxml.tests.selftest2-module.html @@ -0,0 +1,54 @@ + + + + + selftest2 + + + + + +

Module selftest2

+
+

Functions

+ attrib
cdata
check_element
check_element_tree
check_mapping
check_string
copy
element
encoding
find
makeelement
parsefile
qname
serialize
stdout
summarize
summarize_list
unserialize
writefile

Variables

+ ENTITY_XML
SAMPLE_XML
SAMPLE_XML_NS
__package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_builder-module.html b/doc/html/api/toc-lxml.tests.test_builder-module.html new file mode 100644 index 00000000..c2f5a102 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_builder-module.html @@ -0,0 +1,36 @@ + + + + + test_builder + + + + + +

Module test_builder

+
+

Classes

+ BuilderTestCase

Functions

+ test_suite

Variables

+ __package__
this_dir

+[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 00000000..db47ad0a --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_classlookup-module.html @@ -0,0 +1,38 @@ + + + + + test_classlookup + + + + + +

Module test_classlookup

+
+

Classes

+ ClassLookupTestCase
ProxyTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..05606f2f --- /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

Variables

+ HTML
__package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_doctestcompare-module.html b/doc/html/api/toc-lxml.tests.test_doctestcompare-module.html new file mode 100644 index 00000000..d74b9efb --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_doctestcompare-module.html @@ -0,0 +1,37 @@ + + + + + test_doctestcompare + + + + + +

Module test_doctestcompare

+
+

Classes

+ DoctestCompareTest
DummyInput

Functions

+ indent
test_suite

Variables

+ __package__

+[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 00000000..e7a946f1 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_dtd-module.html @@ -0,0 +1,36 @@ + + + + + test_dtd + + + + + +

Module test_dtd

+
+

Classes

+ ETreeDtdTestCase

Functions

+ test_suite

Variables

+ __package__
this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_elementpath-module.html b/doc/html/api/toc-lxml.tests.test_elementpath-module.html new file mode 100644 index 00000000..ea87fc9c --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_elementpath-module.html @@ -0,0 +1,38 @@ + + + + + test_elementpath + + + + + +

Module test_elementpath

+
+

Classes

+ EtreeElementPathTestCase

Functions

+ normalize_crlf
summarize
summarize_list
test_suite

Variables

+ __package__

+[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 00000000..75fda50b --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_elementtree-module.html @@ -0,0 +1,61 @@ + + + + + test_elementtree + + + + + +

Module test_elementtree

+
+

Classes

+ CElementTreeElementSlicingTest
CElementTreeTestCase
ETreeC14N2TostringTest
ETreeC14N2WriteTest
ETreeC14NTest
ETreeElementSlicingTest
ETreePullTestCase
ETreeTestCase
ElementTreeElementSlicingTest
ElementTreeTestCase
+ _C14NTest
+
+ _ETreeTestCaseBase
+
+ _ElementSlicingTest
+
+ _XMLPullParserTest
+

Functions

+ et_needs_pyversion
test_suite

Variables

+ ElementTreeC14NTest
ElementTreePullTestCase
__package__
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 00000000..53d0dfb5 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_errors-module.html @@ -0,0 +1,36 @@ + + + + + test_errors + + + + + +

Module test_errors

+
+

Classes

+ ErrorTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..36403c10 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_etree-module.html @@ -0,0 +1,44 @@ + + + + + test_etree + + + + + +

Module test_etree

+
+

Classes

+ ETreeC14NTestCase
ETreeErrorLogTest
ETreeOnlyTestCase
ETreeWriteTestCase
ETreeXIncludeTestCase
ElementIncludeTestCase
XMLPullParserTest
+ _XIncludeTestCase
+

Functions

+ test_suite

Variables

+ __package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_external_document-module.html b/doc/html/api/toc-lxml.tests.test_external_document-module.html new file mode 100644 index 00000000..84259481 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_external_document-module.html @@ -0,0 +1,37 @@ + + + + + test_external_document + + + + + +

Module test_external_document

+
+

Classes

+ ExternalDocumentTestCase

Functions

+ test_suite

Variables

+ DESTRUCTOR_NAME
DOC_NAME
__package__

+[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 00000000..cd47cb4f --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_htmlparser-module.html @@ -0,0 +1,37 @@ + + + + + test_htmlparser + + + + + +

Module test_htmlparser

+
+

Classes

+ HtmlParserTestCase
unicode

Functions

+ test_suite

Variables

+ __package__
this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_http_io-module.html b/doc/html/api/toc-lxml.tests.test_http_io-module.html new file mode 100644 index 00000000..67e9c043 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_http_io-module.html @@ -0,0 +1,36 @@ + + + + + test_http_io + + + + + +

Module test_http_io

+
+

Classes

+ HttpIOTestCase

Functions

+ test_suite

Variables

+ __package__
this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_incremental_xmlfile-module.html b/doc/html/api/toc-lxml.tests.test_incremental_xmlfile-module.html new file mode 100644 index 00000000..8a23b765 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_incremental_xmlfile-module.html @@ -0,0 +1,44 @@ + + + + + test_incremental_xmlfile + + + + + +

Module test_incremental_xmlfile

+
+

Classes

+ AsyncXmlFileTestCase
BytesIOXmlFileTestCase
HtmlFileTestCase
SimpleFileLikeXmlFileTestCase
TempPathXmlFileTestCase
TempXmlFileTestCase
+ _XmlFileTestCaseBase
+

Functions

+ test_suite

Variables

+ __package__
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 00000000..fc177275 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_io-module.html @@ -0,0 +1,39 @@ + + + + + test_io + + + + + +

Module test_io

+
+

Classes

+ ETreeIOTestCase
ElementTreeIOTestCase
+ _IOTestCaseBase
+

Functions

+ test_suite

Variables

+ __package__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_isoschematron-module.html b/doc/html/api/toc-lxml.tests.test_isoschematron-module.html new file mode 100644 index 00000000..b82c7fa1 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_isoschematron-module.html @@ -0,0 +1,36 @@ + + + + + test_isoschematron + + + + + +

Module test_isoschematron

+
+

Classes

+ ETreeISOSchematronTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..733c6e7e --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_nsclasses-module.html @@ -0,0 +1,36 @@ + + + + + test_nsclasses + + + + + +

Module test_nsclasses

+
+

Classes

+ ETreeNamespaceClassesTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..014216c7 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_objectify-module.html @@ -0,0 +1,49 @@ + + + + + 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
__package__
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 00000000..9841ca02 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_pyclasslookup-module.html @@ -0,0 +1,37 @@ + + + + + test_pyclasslookup + + + + + +

Module test_pyclasslookup

+
+

Classes

+ PyClassLookupTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..39b755ee --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_relaxng-module.html @@ -0,0 +1,38 @@ + + + + + test_relaxng + + + + + +

Module test_relaxng

+
+

Classes

+ ETreeRelaxNGTestCase
RelaxNGCompactTestCase

Functions

+ test_suite

Variables

+ __package__
rnc2rng
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 00000000..44992113 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_sax-module.html @@ -0,0 +1,38 @@ + + + + + test_sax + + + + + +

Module test_sax

+
+

Classes

+ ETreeSaxTestCase
NSPrefixSaxTestCase
SimpleContentHandler

Functions

+ test_suite

Variables

+ __package__
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 00000000..a51a892e --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_schematron-module.html @@ -0,0 +1,36 @@ + + + + + test_schematron + + + + + +

Module test_schematron

+
+

Classes

+ ETreeSchematronTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..710e1c78 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_threading-module.html @@ -0,0 +1,37 @@ + + + + + test_threading + + + + + +

Module test_threading

+
+

Classes

+ ThreadPipelineTestCase
ThreadingTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..e38efa89 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_unicode-module.html @@ -0,0 +1,43 @@ + + + + + test_unicode + + + + + +

Module test_unicode

+
+

Classes

+ EncodingsTestCase
UnicodeTestCase
unicode

Functions

+ test_suite

Variables

+ __package__
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 00000000..cdc9c517 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xmlschema-module.html @@ -0,0 +1,37 @@ + + + + + test_xmlschema + + + + + +

Module test_xmlschema

+
+

Classes

+ ETreeXMLSchemaResolversTestCase
ETreeXMLSchemaTestCase

Functions

+ test_suite

Variables

+ __package__
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 00000000..7753fef5 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xpathevaluator-module.html @@ -0,0 +1,55 @@ + + + + + test_xpathevaluator + + + + + +

Module test_xpathevaluator

+
+

Classes

+ ETreeETXPathClassTestCase
ETreeXPathClassTestCase
ETreeXPathExsltTestCase
ETreeXPathTestCase

Functions

+ argsTest1
argsTest2
booleanTest
floatTest
resultTypesTest
resultTypesTest2
setTest
setTest2
stringListTest
stringTest
tag
tag_or_value
test_suite
xpath

Variables

+ SAMPLE_XML
__package__
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 00000000..5c40e735 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xslt-module.html @@ -0,0 +1,43 @@ + + + + + test_xslt + + + + + +

Module test_xslt

+
+

Classes

+ ETreeEXSLTTestCase
ETreeXSLTExtElementTestCase
ETreeXSLTExtFuncTestCase
ETreeXSLTTestCase
Py3XSLTTestCase
basestring
unicode

Functions

+ test_suite

Variables

+ __package__
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 00000000..ee5971fe --- /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-xml.etree.ElementTree-module.html b/doc/html/api/toc-xml.etree.ElementTree-module.html new file mode 100644 index 00000000..47225cea --- /dev/null +++ b/doc/html/api/toc-xml.etree.ElementTree-module.html @@ -0,0 +1,73 @@ + + + + + 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
__package__
_namespace_map
_sentinel
_serialize

+[hide private] + + + + diff --git a/doc/html/api/toc.html b/doc/html/api/toc.html new file mode 100644 index 00000000..abb29a06 --- /dev/null +++ b/doc/html/api/toc.html @@ -0,0 +1,86 @@ + + + + + Table of Contents + + + + + +

Table of Contents

+
+ Everything +
+

Modules

+ 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.includes
lxml.isoschematron
lxml.objectify
lxml.pyclasslookup
lxml.sax
lxml.tests
lxml.tests.common_imports
lxml.tests.dummy_http_server
lxml.tests.selftest
lxml.tests.selftest2
lxml.tests.test_builder
lxml.tests.test_classlookup
lxml.tests.test_css
lxml.tests.test_doctestcompare
lxml.tests.test_dtd
lxml.tests.test_elementpath
lxml.tests.test_elementtree
lxml.tests.test_errors
lxml.tests.test_etree
lxml.tests.test_external_document
lxml.tests.test_htmlparser
lxml.tests.test_http_io
lxml.tests.test_incremental_xmlfile
lxml.tests.test_io
lxml.tests.test_isoschematron
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
xml.etree.ElementTree

+ [hide private] + + + + diff --git a/doc/html/api/xml.etree.ElementTree-module.html b/doc/html/api/xml.etree.ElementTree-module.html new file mode 100644 index 00000000..227dc420 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree-module.html @@ -0,0 +1,813 @@ + + + + + xml.etree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package xml :: + Package etree :: + Module ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ElementTree

source code

+hash(x) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
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, + method=None) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + HTML_EMPTY = set(['area', 'base', 'basefont', 'br', 'col', 'fr... +
+   + + VERSION = '1.3.0' +
+   + + __package__ = 'xml.etree' +
+   + + _namespace_map = {'http://purl.org/dc/elements/1.1/': 'dc', 'h... +
+   + + _sentinel = ['sentinel'] +
+   + + _serialize = {'html': <__builtin__.function object>, 'text': <... +
+ + + + + + +
+ + + + + +
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'}
+
+
+
+
+
+ +
+ +
+

_serialize

+ +
+
+
+
Value:
+
+{'html': <__builtin__.function object>,
+ 'text': <__builtin__.function object>,
+ 'xml': <__builtin__.function object>}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree-pysrc.html b/doc/html/api/xml.etree.ElementTree-pysrc.html new file mode 100644 index 00000000..57336f72 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree-pysrc.html @@ -0,0 +1,3246 @@ + + + + + xml.etree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package xml :: + Package etree :: + Module ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module xml.etree.ElementTree

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

Class Element

source code

+
+object --+
+         |
+        Element
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(self, + index) + source code + +
+ +
+   + + + + + + +
__getitem__(self, + index) + source code + +
+ +
+   + + + + + + +
__init__(self, + tag, + attrib={}, + **extra)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__len__(self) + source code + +
+ +
+   + + + + + + +
__nonzero__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
__setitem__(self, + index, + element) + source code + +
+ +
+   + + + + + + +
append(self, + element) + source code + +
+ +
+   + + + + + + +
clear(self) + source code + +
+ +
+   + + + + + + +
copy(self) + source code + +
+ +
+   + + + + + + +
extend(self, + elements) + source code + +
+ +
+   + + + + + + +
find(self, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
findall(self, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None, + namespaces=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 + +
+ +
+   + + + + + + +
iterfind(self, + path, + namespaces=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__, + __format__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + attrib = None
+ hash(x) +
+   + + tag = None
+ hash(x) +
+   + + tail = None
+ hash(x) +
+   + + text = None
+ hash(x) +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

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

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

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) 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/xml.etree.ElementTree.ElementTree-class.html b/doc/html/api/xml.etree.ElementTree.ElementTree-class.html new file mode 100644 index 00000000..efd14dbd --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree.ElementTree-class.html @@ -0,0 +1,446 @@ + + + + + xml.etree.ElementTree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + 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 help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
_setroot(self, + element) + source code + +
+ +
+   + + + + + + +
find(self, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
findall(self, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None, + namespaces=None) + source code + +
+ +
+   + + + + + + +
getiterator(self, + tag=None) + source code + +
+ +
+   + + + + + + +
getroot(self) + source code + +
+ +
+   + + + + + + +
iter(self, + tag=None) + source code + +
+ +
+   + + + + + + +
iterfind(self, + path, + namespaces=None) + source code + +
+ +
+   + + + + + + +
parse(self, + source, + parser=None) + source code + +
+ +
+   + + + + + + +
write(self, + file_or_filename, + encoding=None, + xml_declaration=None, + default_namespace=None, + method=None) + source code + +
+ +
+   + + + + + + +
write_c14n(self, + file) + source code + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree.ParseError-class.html b/doc/html/api/xml.etree.ElementTree.ParseError-class.html new file mode 100644 index 00000000..527dc597 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree.ParseError-class.html @@ -0,0 +1,215 @@ + + + + + xml.etree.ElementTree.ParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + 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__, + __unicode__ +

+

Inherited from object: + __format__, + __hash__, + __reduce_ex__, + __sizeof__, + __subclasshook__ +

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

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

+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree.QName-class.html b/doc/html/api/xml.etree.ElementTree.QName-class.html new file mode 100644 index 00000000..69086d64 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree.QName-class.html @@ -0,0 +1,347 @@ + + + + + xml.etree.ElementTree.QName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + 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 help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
__str__(self)
+ str(x)
+ source code + +
+ +
+

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

+
+ + + + + + + + + +
+ + + + + +
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 help(type(x)) 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/xml.etree.ElementTree.TreeBuilder-class.html b/doc/html/api/xml.etree.ElementTree.TreeBuilder-class.html new file mode 100644 index 00000000..5502089e --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree.TreeBuilder-class.html @@ -0,0 +1,332 @@ + + + + + xml.etree.ElementTree.TreeBuilder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + 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 help(type(x)) 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__, + __format__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

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

Inherited from object: + __class__ +

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

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

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree.XMLParser-class.html b/doc/html/api/xml.etree.ElementTree.XMLParser-class.html new file mode 100644 index 00000000..acfd3080 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree.XMLParser-class.html @@ -0,0 +1,498 @@ + + + + + xml.etree.ElementTree.XMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + ElementTree :: + XMLParser :: + Class XMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLParser

source code

+
+object --+
+         |
+        XMLParser
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__doctype(self, + name, + pubid, + system)
+ This method of XMLParser is deprecated.
+ source code + +
+ +
+   + + + + + + +
__init__(self, + html=['sentinel'], + target=None, + encoding=None)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+   + + + + + + +
_comment(self, + data) + 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 + +
+ +
+   + + + + + + +
_pi(self, + target, + data) + 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 + +
+ +
+   + + + + + + +
doctype(self, + name, + pubid, + system)
+ This method of XMLParser is deprecated.
+ source code + +
+ +
+   + + + + + + +
feed(self, + data) + source code + +
+ +
+

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

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

Inherited from object: + __class__ +

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

__init__(self, + html=['sentinel'], + target=None, + encoding=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree._IterParseIterator-class.html b/doc/html/api/xml.etree.ElementTree._IterParseIterator-class.html new file mode 100644 index 00000000..4a2adfda --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree._IterParseIterator-class.html @@ -0,0 +1,286 @@ + + + + + xml.etree.ElementTree._IterParseIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + ElementTree :: + _IterParseIterator :: + Class _IterParseIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _IterParseIterator

source code

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

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

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

Inherited from object: + __class__ +

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

__init__(self, + source, + events, + parser, + close_source=False) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see help(type(x)) for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/xml.etree.ElementTree._SimpleElementPath-class.html b/doc/html/api/xml.etree.ElementTree._SimpleElementPath-class.html new file mode 100644 index 00000000..9d230b27 --- /dev/null +++ b/doc/html/api/xml.etree.ElementTree._SimpleElementPath-class.html @@ -0,0 +1,264 @@ + + + + + xml.etree.ElementTree._SimpleElementPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + xml :: + etree :: + ElementTree :: + _SimpleElementPath :: + Class _SimpleElementPath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _SimpleElementPath

source code

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

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

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

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/build.html b/doc/html/build.html new file mode 100644 index 00000000..f39c25e3 --- /dev/null +++ b/doc/html/build.html @@ -0,0 +1,324 @@ + + + + + +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.

+ +
+

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 checkout of the +developer sources (e.g. to test a bug fix that has not been release +yet) or if you want to be an lxml developer, then you do need a +working Cython installation. You can use pip to install it:

+
+pip install -r requirements.txt
+
+

https://github.com/lxml/lxml/blob/master/requirements.txt

+

lxml currently requires at least Cython 0.26.1, later release versions +should work as well. For Python 3.7 support, at least Cython 0.29 is +required.

+
+
+

Github, git and hg

+

The lxml package is developed in a repository on Github using +Mercurial and the hg-git plugin. You can retrieve the current +developer version using:

+
+hg clone git+ssh://git@github.com/lxml/lxml.git lxml
+
+

Or, using git:

+
+git clone ssh://git@github.com/lxml/lxml.git lxml
+
+

This will create a directory lxml and download the source into it, +including the complete development history. Don't be afraid, the +repository download is fairly quick. You can also browse the +lxml repository through the web or download a ZIP archive with the +latest master branch.

+
+
+

Building the sources

+

Clone the source repository as described above (or download +the source tar-ball and unpack it) and then type:

+
+python setup.py build
+
+

or:

+
+python setup.py bdist_egg     # requires 'setuptools' or 'distribute'
+
+

To (re-)build the C sources with Cython, you must additionally pass the +option --with-cython:

+
+python setup.py build --with-cython
+
+

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 --with-cython
+
+

or, in Unix-like environments:

+
+make inplace
+
+

To speed up the build in test environments (e.g. on a continuous +integration server), set the CFLAGS environment variable to +disable C compiler optimisations (e.g. "-O0" for gcc, that's +minus-oh-zero), for example:

+
+CFLAGS="-O0"  make inplace
+
+

If you get errors about missing header files (e.g. Python.h or +libxml/xmlversion.h) then you need to make sure the development +packages of Python, libxml2 and libxslt are properly installed. On +Linux distributions, they are usually called something like +libxml2-dev or libxslt-devel. If these packages were +installed in non-standard places, 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
+
+

There are also env vars to allow overriding the config tool:

+
+env XML2_CONFIG=/path/to/xml2-config python build
+
+

You may also use pkg-config as the tools:

+
+env XSLT_CONFIG="pkg-config libxslt" python setup.py build
+
+

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.7.2
+Type "help", "copyright", "credits" or "license" for more information.
+>>> from lxml import etree
+>>>
+
+

To make sure everything gets recompiled cleanly after changes, you can +run make clean or delete the file src/lxml/etree.c.

+
+
+

Running the tests and reporting errors

+

The source distribution (tgz) and the source 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-X, ...).

+
+
+

Building an egg or wheel

+

This is the procedure to make an lxml egg or wheel for your platform. +It assumes that you have setuptools or distribute installed, as well +as the wheel package.

+

First, download the lxml-x.y.tar.gz release. This contains the pregenerated +C files so that you can be sure you build exactly from the release sources. +Unpack them and cd into the resulting directory. Then, to build a wheel, +simply run the command

+
+python setup.py bdist_wheel
+
+

or, to build a statically linked wheel with all of libxml2, libxslt and +friends compiled in, run

+
+python setup.py bdist_wheel --static-deps
+

The resulting .whl file will be written into the dist directory.

+

To build an egg file, run

+
+python setup.py build_egg
+
+

If you are on a Unix-like platform, you can first build the extension modules +using

+
+python setup.py build
+
+

and then cd into the directory build/lib.your.platform to call +strip on any .so file you find there. This reduces the size of +the binary distribution considerably. Then, from the package root directory, +call

+
+python setup.py bdist_egg
+
+

This will quickly package the pre-built packages into an egg file and +drop it 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 used to be too old +to even build lxml for a long time.

+

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.9.1 \
+       --libxslt-version=1.1.28 \
+
+sudo python setup.py install
+
+

Instead of build, you can use any target, like bdist_egg +if you want to use setuptools to build an installable egg, or +bdist_wheel for a wheel package.

+

Note that this also works with pip. Since you can't pass +command line options in this case, you have to use an environment +variable instead:

+
+STATIC_DEPS=true pip install lxml
+
+

To install the package into the system Python package directory, +run the installation with "sudo":

+
+STATIC_DEPS=true sudo pip install lxml
+
+

The STATICBUILD environment variable is handled equivalently to +the STATIC_DEPS variable, but is used by some other extension +packages, too.

+

If you decide to do a non-static build, you may also have to install +the command line tools in addition to the XCode build environment. +They are available as a restricted download from here:

+

https://developer.apple.com/downloads/index.action?=command%20line%20tools#

+

Without them, the compiler may not find the necessary header files of +the XML libraries, according to the second comment in this ticket:

+

https://bugs.launchpad.net/lxml/+bug/1244094

+
+
+

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. To work around +the limits of this platform, lxml's installation can download pre-built +packages of the dependencies and build statically against them. Assuming +you have a proper C compiler setup to build Python extensions, this should +work:

+
+python setup.py bdist_wininst --static-deps
+
+

It should 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 dependencies 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 00000000..1dd94023 --- /dev/null +++ b/doc/html/capi.html @@ -0,0 +1,134 @@ + + + + + +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.

+ +
+

Passing generated trees through Python

+

This is the most simple way to integrate with lxml. It does not require +any C-level integration but uses a Python function to wrap an externally +generated libxml2 document in lxml.

+

The external module that creates the libxml2 tree must pack the document +pointer into a PyCapsule +object. This can then be passed into lxml with the function +lxml.etree.adopt_external_document(). It also takes an optional lxml +parser instance to associate with the document, in order to configure the +Element class lookup, relative URL lookups, etc.

+

See the API reference +for further details.

+

The same functionality is available as part of the public C-API in form +of the C function adoptExternalDocument().

+
+
+

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-4.4.3.html b/doc/html/changes-4.4.3.html new file mode 100644 index 00000000..9297a579 --- /dev/null +++ b/doc/html/changes-4.4.3.html @@ -0,0 +1,3598 @@ + + + + + + +lxml changelog + + + +
+

lxml changelog

+ +
+

4.4.3 (2020-01-28)

+
+

Bugs fixed

+
    +
  • LP#1844674: itertext() was missing tail text of comments and PIs since 4.4.0.
  • +
+
+
+
+

4.4.2 (2019-11-25)

+
+

Bugs fixed

+
    +
  • LP#1835708: ElementInclude incorrectly rejected repeated non-recursive +includes as recursive. +Patch by Rainer Hausdorf.
  • +
+
+
+
+

4.4.1 (2019-08-11)

+
+

Bugs fixed

+
    +
  • LP#1838252: The order of an OrderedDict was lost in 4.4.0 when passing it as +attrib mapping during element creation.
  • +
  • LP#1838521: The package metadata now lists the supported Python versions.
  • +
+
+
+
+

4.4.0 (2019-07-27)

+
+

Features added

+
    +
  • Element.clear() accepts a new keyword argument keep_tail=True to clear +everything but the tail text. This is helpful in some document-style use cases +and for clearing the current element in iterparse() and pull parsing.
  • +
  • When creating attributes or namespaces from a dict in Python 3.6+, lxml now +preserves the original insertion order of that dict, instead of always sorting +the items by name. A similar change was made for ElementTree in CPython 3.8. +See https://bugs.python.org/issue34160
  • +
  • Integer elements in lxml.objectify implement the __index__() special method.
  • +
  • GH#269: Read-only elements in XSLT were missing the nsmap property. +Original patch by Jan Pazdziora.
  • +
  • ElementInclude can now restrict the maximum inclusion depth via a max_depth +argument to prevent content explosion. It is limited to 6 by default.
  • +
  • The target object of the XMLParser can have start_ns() and end_ns() +callback methods to listen to namespace declarations.
  • +
  • The TreeBuilder has new arguments comment_factory and pi_factory to +pass factories for creating comments and processing instructions, as well as +flag arguments insert_comments and insert_pis to discard them from the +tree when set to false.
  • +
  • A C14N 2.0 implementation was added as +etree.canonicalize(), a corresponding C14NWriterTarget class, and +a c14n2 serialisation method.
  • +
+
+
+

Bugs fixed

+
    +
  • When writing to file paths that contain the URL escape character '%', the file +path could wrongly be mangled by URL unescaping and thus write to a different +file or directory. Code that writes to file paths that are provided by untrusted +sources, but that must work with previous versions of lxml, should best either +reject paths that contain '%' characters, or otherwise make sure that the path +does not contain maliciously injected '%XX' URL hex escapes for paths like '../'.
  • +
  • Assigning to Element child slices with negative step could insert the slice at +the wrong position, starting too far on the left.
  • +
  • Assigning to Element child slices with overly large step size could take very +long, regardless of the length of the actual slice.
  • +
  • Assigning to Element child slices of the wrong size could sometimes fail to +raise a ValueError (like a list assignment would) and instead assign outside +of the original slice bounds or leave parts of it unreplaced.
  • +
  • The comment and pi events in iterwalk() were never triggered, and +instead, comments and processing instructions in the tree were reported as +start elements. Also, when walking an ElementTree (as opposed to its root +element), comments and PIs outside of the root element are now reported.
  • +
  • LP#1827833: The RelaxNG compact syntax support was broken with recent versions +of rnc2rng.
  • +
  • LP#1758553: The HTML elements source and track were added to the list +of empty tags in lxml.html.defs.
  • +
  • Registering a prefix other than "xml" for the XML namespace is now rejected.
  • +
  • Failing to write XSLT output to a file could raise a misleading exception. +It now raises IOError.
  • +
+
+
+

Other changes

+
    +
  • Support for Python 3.4 was removed.
  • +
  • When using Element.find*() with prefix-namespace mappings, the empty string +is now accepted to define a default namespace, in addition to the previously +supported None prefix. Empty strings are more convenient since they keep +all prefix keys in a namespace dict strings, which simplifies sorting etc.
  • +
  • The ElementTree.write_c14n() method has been deprecated in favour of the +long preferred ElementTree.write(f, method="c14n"). It will be removed +in a future release.
  • +
+
+
+
+

4.3.5 (2019-07-27)

+
    +
  • Rebuilt with Cython 0.29.13 to support Python 3.8.
  • +
+
+
+

4.3.4 (2019-06-10)

+
    +
  • Rebuilt with Cython 0.29.10 to support Python 3.8.
  • +
+
+
+

4.3.3 (2019-03-26)

+
+

Bugs fixed

+
    +
  • Fix leak of output buffer and unclosed files in _XSLTResultTree.write_output().
  • +
+
+
+
+

4.3.2 (2019-02-29)

+
+

Bugs fixed

+
    +
  • Crash in 4.3.1 when appending a child subtree with certain text nodes.
  • +
+
+
+

Other changes

+
    +
  • Built with Cython 0.29.6.
  • +
+
+
+
+

4.3.1 (2019-02-08)

+
+

Bugs fixed

+
    +
  • LP#1814522: Crash when appending a child subtree that contains unsubstituted +entity references.
  • +
+
+
+

Other changes

+
    +
  • Built with Cython 0.29.5.
  • +
+
+
+
+

4.3.0 (2019-01-04)

+
+

Features added

+
    +
  • The module lxml.sax is compiled using Cython in order to speed it up.
  • +
  • GH#267: lxml.sax.ElementTreeProducer now preserves the namespace prefixes. +If two prefixes point to the same URI, the first prefix in alphabetical order +is used. Patch by Lennart Regebro.
  • +
  • Updated ISO-Schematron implementation to 2013 version (now MIT licensed) +and the corresponding schema to the 2016 version (with optional "properties").
  • +
+
+
+

Other changes

+
    +
  • GH#270, GH#271: Support for Python 2.6 and 3.3 was removed. +Patch by hugovk.
  • +
  • The minimum dependency versions were raised to libxml2 2.9.2 and libxslt 1.1.27, +which were released in 2014 and 2012 respectively.
  • +
  • Built with Cython 0.29.2.
  • +
+
+
+
+

4.2.6 (2019-01-02)

+
+

Bugs fixed

+
    +
  • LP#1799755: Fix a DeprecationWarning in Py3.7+.
  • +
  • Import warnings in Python 3.6+ were resolved.
  • +
+
+
+
+

4.2.5 (2018-09-09)

+
+

Bugs fixed

+
    +
  • Javascript URLs that used URL escaping were not removed by the HTML cleaner. +Security problem found by Omar Eissa. (CVE-2018-19787)
  • +
+
+
+
+

4.2.4 (2018-08-03)

+
+

Features added

+
    +
  • GH#259: Allow using pkg-config for build configuration. +Patch by Patrick Griffis.
  • +
+
+
+

Bugs fixed

+
    +
  • LP#1773749, GH#268: Crash when moving an element to another document with +Element.insert(). +Patch by Alexander Weggerle.
  • +
+
+
+
+

4.2.3 (2018-06-27)

+
+

Bugs fixed

+
    +
  • Reverted GH#265: lxml links against zlib as a shared library again.
  • +
+
+
+
+

4.2.2 (2018-06-22)

+
+

Bugs fixed

+
    +
  • GH#266: Fix sporadic crash during GC when parse-time schema validation is used +and the parser participates in a reference cycle. +Original patch by Julien Greard.
  • +
  • GH#265: lxml no longer links against zlib as a shared library, only on static builds. +Patch by Nehal J Wani.
  • +
+
+
+
+

4.2.1 (2018-03-21)

+
+

Bugs fixed

+
    +
  • LP#1755825: iterwalk() failed to return the 'start' event for the initial +element if a tag selector is used.
  • +
  • LP#1756314: Failure to import 4.2.0 into PyPy due to a missing library symbol.
  • +
  • LP#1727864, GH#258: Add "-isysroot" linker option on MacOS as needed by XCode 9.
  • +
+
+
+
+

4.2.0 (2018-03-13)

+
+

Features added

+
    +
  • GH#255: SelectElement.value returns more standard-compliant and +browser-like defaults for non-multi-selects. If no option is selected, the +value of the first option is returned (instead of None). If multiple options +are selected, the value of the last one is returned (instead of that of the +first one). If no options are present (not standard-compliant) +SelectElement.value still returns None.
  • +
  • GH#261: The HTMLParser() now supports the huge_tree option. +Patch by stranac.
  • +
+
+
+

Bugs fixed

+
    +
  • LP#1551797: Some XSLT messages were not captured by the transform error log.
  • +
  • LP#1737825: Crash at shutdown after an interrupted iterparse run with XMLSchema +validation.
  • +
+
+
+

Other changes

+
+
+
+

4.1.1 (2017-11-04)

+
    +
  • Rebuild with Cython 0.27.3 to improve support for Py3.7.
  • +
+
+
+

4.1.0 (2017-10-13)

+
+

Features added

+
    +
  • ElementPath supports text predicates for current node, like "[.='text']".
  • +
  • ElementPath allows spaces in predicates.
  • +
  • Custom Element classes and XPath functions can now be registered with a +decorator rather than explicit dict assignments.
  • +
  • Static Linux wheels are now built with link time optimisation (LTO) enabled. +This should have a beneficial impact on the overall performance by providing +a tighter compiler integration between lxml and libxml2/libxslt.
  • +
+
+
+

Bugs fixed

+
    +
  • LP#1722776: Requesting non-Element objects like comments from a document with +PythonElementClassLookup could fail with a TypeError.
  • +
+
+
+
+

4.0.0 (2017-09-17)

+
+

Features added

+
    +
  • The ElementPath implementation is now compiled using Cython, +which speeds up the .find*() methods quite significantly.
  • +
  • The modules lxml.builder, lxml.html.diff and lxml.html.clean +are also compiled using Cython in order to speed them up.
  • +
  • xmlfile() supports async coroutines using async with and await.
  • +
  • iterwalk() has a new method skip_subtree() that prevents walking into +the descendants of the current element.
  • +
  • RelaxNG.from_rnc_string() accepts a base_url argument to +allow relative resource lookups.
  • +
  • The XSLT result object has a new method .write_output(file) that serialises +output data into a file according to the <xsl:output> configuration.
  • +
+
+
+

Bugs fixed

+
    +
  • GH#251: HTML comments were handled incorrectly by the soupparser. +Patch by mozbugbox.

    +
  • +
  • LP#1654544: The html5parser no longer passes the useChardet option +if the input is a Unicode string, unless explicitly requested. When parsing +files, the default is to enable it when a URL or file path is passed (because +the file is then opened in binary mode), and to disable it when reading from +a file(-like) object.

    +

    Note: This is a backwards incompatible change of the default configuration. +If your code parses byte strings/streams and depends on character detection, +please pass the option guess_charset=True explicitly, which already worked +in older lxml versions.

    +
  • +
  • LP#1703810: etree.fromstring() failed to parse UTF-32 data with BOM.

    +
  • +
  • LP#1526522: Some RelaxNG errors were not reported in the error log.

    +
  • +
  • LP#1567526: Empty and plain text input raised a TypeError in soupparser.

    +
  • +
  • LP#1710429: Uninitialised variable usage in HTML diff.

    +
  • +
  • LP#1415643: The closing tags context manager in xmlfile() could continue +to output end tags even after writing failed with an exception.

    +
  • +
  • LP#1465357: xmlfile.write() now accepts and ignores None as input argument.

    +
  • +
  • Compilation under Py3.7-pre failed due to a modified function signature.

    +
  • +
+
+
+

Other changes

+
    +
  • The main module source files were renamed from lxml.*.pyx to plain +*.pyx (e.g. etree.pyx) to simplify their handling in the build +process. Care was taken to keep the old header files as fallbacks for +code that compiles against the public C-API of lxml, but it might still +be worth validating that third-party code does not notice this change.
  • +
+
+
+
+

3.8.0 (2017-06-03)

+
+

Features added

+
    +
  • ElementTree.write() has a new option doctype that writes out a +doctype string before the serialisation, in the same way as tostring().
  • +
  • GH#220: xmlfile allows switching output methods at an element level. +Patch by Burak Arslan.
  • +
  • LP#1595781, GH#240: added a PyCapsule Python API and C-level API for +passing externally generated libxml2 documents into lxml.
  • +
  • GH#244: error log entries have a new property path with an XPath +expression (if known, None otherwise) that points to the tree element +responsible for the error. Patch by Bob Kline.
  • +
  • The namespace prefix mapping that can be used in ElementPath now injects +a default namespace when passing a None prefix.
  • +
+
+
+

Bugs fixed

+
    +
  • GH#238: Character escapes were not hex-encoded in the xmlfile serialiser. +Patch by matejcik.
  • +
  • GH#229: fix for externally created XML documents. Patch by Theodore Dubois.
  • +
  • LP#1665241, GH#228: Form data handling in lxml.html no longer strips the +option values specified in form attributes but only the text values. +Patch by Ashish Kulkarni.
  • +
  • LP#1551797: revert previous fix for XSLT error logging as it breaks +multi-threaded XSLT processing.
  • +
  • LP#1673355, GH#233: fromstring() html5parser failed to parse byte strings.
  • +
+
+
+

Other changes

+
    +
  • The previously undocumented docstring option in ElementTree.write() +produces a deprecation warning and will eventually be removed.
  • +
+
+
+
+

3.7.4 (2017-??-??)

+
+

Bugs fixed

+
    +
  • LP#1551797: revert previous fix for XSLT error logging as it breaks +multi-threaded XSLT processing.
  • +
  • LP#1673355, GH#233: fromstring() html5parser failed to parse byte strings.
  • +
+
+
+
+

3.7.3 (2017-02-18)

+
+

Bugs fixed

+
    +
  • GH#218 was ineffective in Python 3.
  • +
  • GH#222: lxml.html.submit_form() failed in Python 3. +Patch by Jakub Wilk.
  • +
+
+
+
+

3.7.2 (2017-01-08)

+
    +
  • GH#220: xmlfile allows switching output methods at an element level. +Patch by Burak Arslan.
  • +
+
+

Bugs fixed

+
    +
  • Work around installation problems in recent Python 2.7 versions +due to FTP download failures.
  • +
  • GH#219: xmlfile.element() was not properly quoting attribute values. +Patch by Burak Arslan.
  • +
  • GH#218: xmlfile.element() was not properly escaping text content of +script/style tags. Patch by Burak Arslan.
  • +
+
+
+
+

3.7.1 (2016-12-23)

+
    +
  • No source changes, issued only to solve problems with the +binary packages released for 3.7.0.
  • +
+
+
+

3.7.0 (2016-12-10)

+
+

Features added

+
    +
  • GH#217: XMLSyntaxError now behaves more like its SyntaxError +baseclass. Patch by Philipp A.
  • +
  • GH#216: HTMLParser() now supports the same collect_ids parameter +as XMLParser(). Patch by Burak Arslan.
  • +
  • GH#210: Allow specifying a serialisation method in xmlfile.write(). +Patch by Burak Arslan.
  • +
  • GH#203: New option default_doctype in HTMLParser that allows +disabling the automatic doctype creation. Patch by Shadab Zafar.
  • +
  • GH#201: Calling the method .set('attrname') without value argument +(or None) on HTML elements creates an attribute without value that +serialises like <div attrname></div>. Patch by Daniel Holth.
  • +
  • GH#197: Ignore form input fields in form_values() when they are +marked as disabled in HTML. Patch by Kristian Klemon.
  • +
+
+
+

Bugs fixed

+
    +
  • GH#206: File name and line number were missing from XSLT error messages. +Patch by Marcus Brinkmann.
  • +
+
+
+

Other changes

+
    +
  • Log entries no longer allow anything but plain string objects as message text +and file name.
  • +
  • zlib is included in the list of statically built libraries.
  • +
+
+
+
+

3.6.4 (2016-08-20)

+ +
+
+

3.6.3 (2016-08-18)

+
    +
  • LP#1614603: change linker flags to build multi-linux wheels
  • +
+
+
+

3.6.2 (2016-08-18)

+
    +
  • LP#1614603: release without source changes to provide cleanly built Linux wheels
  • +
+
+
+

3.6.1 (2016-07-24)

+
+

Features added

+
    +
  • GH#180: Separate option inline_style for Cleaner that only removes style +attributes instead of all styles. Patch by Christian Pedersen.
  • +
  • GH#196: Windows build support for Python 3.5. Contribution by Maximilian Hils.
  • +
+
+
+

Bugs fixed

+
    +
  • GH#199: Exclude file fields from FormElement.form_values (as browsers do). +Patch by Tomas Divis.
  • +
  • GH#198, LP#1568167: Try to provide base URL from Resolver.resolve_string(). +Patch by Michael van Tellingen.
  • +
  • GH#191: More accurate float serialisation in objectify.FloatElement. +Patch by Holger Joukl.
  • +
  • LP#1551797: Repair XSLT error logging. Patch by Marcus Brinkmann.
  • +
+
+
+
+

3.6.0 (2016-03-17)

+
+

Features added

+
    +
  • GH#187: Now supports (only) version 5.x and later of PyPy. +Patch by Armin Rigo.
  • +
  • GH#181: Direct support for .rnc files in RelaxNG() if rnc2rng +is installed. Patch by Dirkjan Ochtman.
  • +
+
+
+

Bugs fixed

+
    +
  • GH#189: Static builds honour FTP proxy configurations when downloading +the external libs. Patch by Youhei Sakurai.
  • +
  • GH#186: Soupparser failed to process entities in Python 3.x. +Patch by Duncan Morris.
  • +
  • GH#185: Rare encoding related TypeError on import was fixed. +Patch by Petr Demin.
  • +
+
+
+
+

3.5.0 (2015-11-13)

+
+

Bugs fixed

+
    +
  • Unicode string results failed XPath queries in PyPy.
  • +
  • LP#1497051: HTML target parser failed to terminate on exceptions +and continued parsing instead.
  • +
  • Deprecated API usage in doctestcompare.
  • +
+
+
+
+

3.5.0b1 (2015-09-18)

+
+

Features added

+
    +
  • cleanup_namespaces() accepts a new argument keep_ns_prefixes +that does not remove definitions of the provided prefix-namespace +mapping from the tree.
  • +
  • cleanup_namespaces() accepts a new argument top_nsmap that +moves definitions of the provided prefix-namespace mapping to the +top of the tree.
  • +
  • LP#1490451: Element objects gained a cssselect() method as +known from lxml.html. Patch by Simon Sapin.
  • +
  • API functions and methods behave and look more like Python functions, +which allows introspection on them etc. One side effect to be aware of +is that the functions now bind as methods when assigned to a class +variable. A quick fix is to wrap them in staticmethod() (as for +normal Python functions).
  • +
  • ISO-Schematron support gained an option error_finder that allows +passing a filter function for picking validation errors from reports.
  • +
  • LP#1243600: Elements in lxml.html gained a classes property +that provides a set-like interface to the class attribute. +Original patch by masklinn.
  • +
  • LP#1341964: The soupparser now handles DOCTYPE declarations, comments +and processing instructions outside of the root element. +Patch by Olli Pottonen.
  • +
  • LP#1421512: The docinfo of a tree was made editable to allow +setting and removing the public ID and system ID of the DOCTYPE. +Patch by Olli Pottonen.
  • +
  • LP#1442427: More work-arounds for quirks and bugs in pypy and pypy3.
  • +
  • lxml.html.soupparser now uses BeautifulSoup version 4 instead +of version 3 if available.
  • +
+
+
+

Bugs fixed

+
    +
  • Memory errors that occur during tree adaptations (e.g. moving subtrees +to foreign documents) could leave the tree in a crash prone state.
  • +
  • Calling process_children() in an XSLT extension element without +an output_parent argument failed with a TypeError. +Fix by Jens Tröger.
  • +
  • GH#162: Image data in HTML data URLs is considered safe and +no longer removed by lxml.html.clean JavaScript cleaner.
  • +
  • GH#166: Static build could link libraries in wrong order.
  • +
  • GH#172: Rely a bit more on libxml2 for encoding detection rather than +rolling our own in some cases. Patch by Olli Pottonen.
  • +
  • GH#159: Validity checks for names and string content were tightened +to detect the use of illegal characters early. Patch by Olli Pottonen.
  • +
  • LP#1421921: Comments/PIs before the DOCTYPE declaration were not +serialised. Patch by Olli Pottonen.
  • +
  • LP#659367: Some HTML DOCTYPE declarations were not serialised. +Patch by Olli Pottonen.
  • +
  • LP#1238503: lxml.doctestcompare is now consistent with stdlib's doctest +in how it uses + and - to refer to unexpected and missing output.
  • +
  • Empty prefixes are explicitly rejected when a namespace mapping is used +with ElementPath to avoid hiding bugs in user code.
  • +
  • Several problems with PyPy were fixed by switching to Cython 0.23.
  • +
+
+
+
+

3.4.4 (2015-04-25)

+
+

Bugs fixed

+
    +
  • An ElementTree compatibility test added in lxml 3.4.3 that failed in +Python 3.4+ was removed again.
  • +
+
+
+
+

3.4.3 (2015-04-15)

+
+

Bugs fixed

+
    +
  • Expression cache in ElementPath was ignored. Fix by Changaco.
  • +
  • LP#1426868: Passing a default namespace and a prefixed namespace mapping +as nsmap into xmlfile.element() raised a TypeError.
  • +
  • LP#1421927: DOCTYPE system URLs were incorrectly quoted when containing +double quotes. Patch by Olli Pottonen.
  • +
  • LP#1419354: meta-redirect URLs were incorrectly processed by +iterlinks() if preceded by whitespace.
  • +
+
+
+
+

3.4.2 (2015-02-07)

+
+

Bugs fixed

+
    +
  • LP#1415907: Crash when creating an XMLSchema from a non-root element +of an XML document.
  • +
  • LP#1369362: HTML cleaning failed when hitting processing instructions +with pseudo-attributes.
  • +
  • CDATA() wrapped content was rejected for tail text.
  • +
  • CDATA sections were not serialised as tail text of the top-level element.
  • +
+
+
+
+

3.4.1 (2014-11-20)

+
+

Features added

+
    +
  • New htmlfile HTML generator to accompany the incremental xmlfile +serialisation API. Patch by Burak Arslan.
  • +
+
+
+

Bugs fixed

+
    +
  • lxml.sax.ElementTreeContentHandler did not initialise its superclass.
  • +
+
+
+
+

3.4.0 (2014-09-10)

+
+

Features added

+
    +
  • xmlfile(buffered=False) disables output buffering and flushes the +content after each API operation (starting/ending element blocks or writes). +A new method xf.flush() can alternatively be used to explicitly flush +the output.
  • +
  • lxml.html.document_fromstring has a new option ensure_head_body=True +which will add an empty head and/or body element to the result document if +missing.
  • +
  • lxml.html.iterlinks now returns links inside meta refresh tags.
  • +
  • New XMLParser option collect_ids=False to disable ID hash table +creation. This can substantially speed up parsing of documents with many +different IDs that are not used.
  • +
  • The parser uses per-document hash tables for XML IDs. This reduces the +load of the global parser dict and speeds up parsing for documents with +many different IDs.
  • +
  • ElementTree.getelementpath(element) returns a structural ElementPath +expression for the given element, which can be used for lookups later.
  • +
  • xmlfile() accepts a new argument close=True to close file(-like) +objects after writing to them. Before, xmlfile() only closed the file +if it had opened it internally.
  • +
  • Allow "bytearray" type for ASCII text input.
  • +
+
+
+

Bugs fixed

+
+
+

Other changes

+
    +
  • LP#400588: decoding errors have become hard errors even in recovery mode. +Previously, they could lead to an internal tree representation in a mixed +encoding state, which lead to very late errors or even silently incorrect +behaviour during tree traversal or serialisation.
  • +
  • Requires Python 2.6, 2.7, 3.2 or later. No longer supports +Python 2.4, 2.5 and 3.1, use lxml 3.3.x for those.
  • +
  • Requires libxml2 2.7.0 or later and libxslt 1.1.23 or later, +use lxml 3.3.x with older versions.
  • +
+
+
+
+

3.3.6 (2014-08-28)

+
+

Bugs fixed

+
    +
  • Prevent tree cycle creation when adding Elements as siblings.
  • +
  • LP#1361948: crash when deallocating Element siblings without parent.
  • +
  • LP#1354652: crash when traversing internally loaded documents in XSLT +extension functions.
  • +
+
+
+
+

3.3.5 (2014-04-18)

+
+

Bugs fixed

+
    +
  • HTML cleaning could fail to strip javascript links that mix control +characters into the link scheme.
  • +
+
+
+
+

3.3.4 (2014-04-03)

+
+

Features added

+
    +
  • Source line numbers above 65535 are available on Elements when +using libxml2 2.9 or later.
  • +
+
+
+

Bugs fixed

+
    +
  • lxml.html.fragment_fromstring() failed for bytes input in Py3.
  • +
+
+
+

Other changes

+
+
+
+

3.3.3 (2014-03-04)

+
+

Bugs fixed

+
    +
  • LP#1287118: Crash when using Element subtypes with __slots__.
  • +
+
+
+

Other changes

+
    +
  • The internal classes _LogEntry and _Attrib can no longer be +subclassed from Python code.
  • +
+
+
+
+

3.3.2 (2014-02-26)

+
+

Bugs fixed

+
    +
  • The properties resolvers and version, as well as the methods +set_element_class_lookup() and makeelement(), were lost from +iterparse objects in 3.3.0.
  • +
  • LP#1222132: instances of XMLSchema, Schematron and RelaxNG +did not clear their local error_log before running a validation.
  • +
  • LP#1238500: lxml.doctestcompare mixed up "expected" and "actual" in +attribute values.
  • +
  • Some file I/O tests were failing in MS-Windows due to non-portable temp +file usage. Initial patch by Gabi Davar.
  • +
  • LP#910014: duplicate IDs in a document were not reported by DTD validation.
  • +
  • LP#1185332: tostring(method="html") did not use HTML serialisation +semantics for trailing tail text. Initial patch by Sylvain Viollon.
  • +
  • LP#1281139: .attrib value of Comments lost its mutation methods +in 3.3.0. Even though it is empty and immutable, it should still +provide the same interface as that returned for Elements.
  • +
+
+
+
+

3.3.1 (2014-02-12)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#1014290: HTML documents parsed with parser.feed() failed to find +elements during tag iteration.
  • +
  • LP#1273709: Building in PyPy failed due to missing support for +PyUnicode_Compare() and PyByteArray_*() in PyPy's C-API.
  • +
  • LP#1274413: Compilation in MSVC failed due to missing "stdint.h" standard +header file.
  • +
  • LP#1274118: iterparse() failed to parse BOM prefixed files.
  • +
+
+
+

Other changes

+
+
+
+

3.3.0 (2014-01-26)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • The heuristic that distinguishes file paths from URLs was tightened +to produce less false negatives.
  • +
+
+
+

Other changes

+
+
+
+

3.3.0beta5 (2014-01-18)

+
+

Features added

+
    +
  • The PEP 393 unicode parsing support gained a fallback for wchar strings +which might still be somewhat common on Windows systems.
  • +
+
+
+

Bugs fixed

+
    +
  • Several error handling problems were fixed throughout the code base that +could previously lead to exceptions being silently swallowed or not +properly reported.
  • +
  • The C-API function appendChild() is now deprecated as it does not +propagate exceptions (its return type is void). The new function +appendChildToElement() was added as a safe replacement.
  • +
  • Passing a string into fromstringlist() raises an exception instead of +parsing the string character by character.
  • +
+
+
+

Other changes

+
    +
  • Document cleanup code was simplified using the new GC features in +Cython 0.20.
  • +
+
+
+
+

3.3.0beta4 (2014-01-12)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • The (empty) value returned by the attrib property of Entity and Comment +objects was mutable.
  • +
  • Element class lookup wasn't available for the new pull parsers or when using +a custom parser target.
  • +
  • Setting Element attributes on instantiation with both the attrib argument +and keyword arguments could modify the mapping passed as attrib.
  • +
  • LP#1266171: DTDs instantiated from internal/external subsets (i.e. through +the docinfo property) lost their attribute declarations.
  • +
+
+
+

Other changes

+
    +
  • Built with Cython 0.20pre (gitrev 012ae82eb) to prepare support for +Python 3.4.
  • +
+
+
+
+

3.3.0beta3 (2014-01-02)

+
+

Features added

+
    +
  • Unicode string parsing was optimised for Python 3.3 (PEP 393).
  • +
+
+
+

Bugs fixed

+
    +
  • HTML parsing of Unicode strings could misdecode the input on some platforms.
  • +
  • Crash in xmlfile() when closing open elements out of order in an error case.
  • +
+
+
+

Other changes

+
+
+
+

3.3.0beta2 (2013-12-20)

+
+

Features added

+
    +
  • iterparse() supports the recover option.
  • +
+
+
+

Bugs fixed

+
    +
  • Crash in iterparse() for HTML parsing.
  • +
  • Crash in target parsing with attributes.
  • +
+
+
+

Other changes

+
    +
  • The safety check in the read-only tree implementation (e.g. used by +PythonElementClassLookup) raises a more appropriate ReferenceError +for illegal access after tree disposal instead of an AssertionError. +This should only impact test code that specifically checks the original +behaviour.
  • +
+
+
+
+

3.3.0beta1 (2013-12-12)

+
+

Features added

+
    +
  • New option handle_failures in make_links_absolute() and +resolve_base_href() (lxml.html) that enables ignoring or +discarding links that fail to parse as URLs.
  • +
  • New parser classes XMLPullParser and HTMLPullParser for +incremental parsing, as implemented for ElementTree in Python 3.4.
  • +
  • iterparse() enables recovery mode by default for HTML parsing +(html=True).
  • +
+
+
+

Bugs fixed

+
    +
  • LP#1255132: crash when trying to run validation over non-Element (e.g. +comment or PI).
  • +
  • Error messages in the log and in exception messages that originated +from libxml2 could accidentally be picked up from preceding warnings +instead of the actual error.
  • +
  • The ElementMaker in lxml.objectify did not accept a dict as +argument for adding attributes to the element it's building. This +works as in lxml.builder now.
  • +
  • LP#1228881: repr(XSLTAccessControl) failed in Python 3.
  • +
  • Raise ValueError when trying to append an Element to itself or +to one of its own descendants, instead of running into an infinite +loop.
  • +
  • LP#1206077: htmldiff discarded whitespace from the output.
  • +
  • Compressed plain-text serialisation to file-like objects was broken.
  • +
  • lxml.html.formfill: Fix textarea form filling. +The textarea used to be cleared before the new content was set, +which removed the name attribute.
  • +
+
+
+

Other changes

+
    +
  • Some basic API classes use freelists internally for faster +instantiation. This can speed up some iterparse() scenarios, +for example.
  • +
  • iterparse() was rewritten to use the new *PullParser +classes internally instead of being a parser itself.
  • +
+
+
+
+

3.2.5 (2014-01-02)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash in xmlfile() when closing open elements out of order in an error case.
  • +
  • Crash in target parsing with attributes.
  • +
  • LP#1255132: crash when trying to run validation over non-Element (e.g. +comment or PI).
  • +
+
+
+

Other changes

+
+
+
+

3.2.4 (2013-11-07)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Memory leak when creating an XPath evaluator in a thread.
  • +
  • LP#1228881: repr(XSLTAccessControl) failed in Python 3.
  • +
  • Raise ValueError when trying to append an Element to itself or +to one of its own descendants.
  • +
  • LP#1206077: htmldiff discarded whitespace from the output.
  • +
  • Compressed plain-text serialisation to file-like objects was broken.
  • +
+
+
+

Other changes

+
+
+
+

3.2.3 (2013-07-28)

+
+

Bugs fixed

+
    +
  • Fix support for Python 2.4 which was lost in 3.2.2.
  • +
+
+
+
+

3.2.2 (2013-07-28)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#1185701: spurious XMLSyntaxError after finishing iterparse().
  • +
  • Crash in lxml.objectify during xsi annotation.
  • +
+
+
+

Other changes

+
    +
  • Return values of user provided element class lookup methods are now +validated against the type of the XML node they represent to prevent +API class mismatches.
  • +
+
+
+
+

3.2.1 (2013-05-11)

+
+

Features added

+
    +
  • The methods apply_templates() and process_children() of XSLT +extension elements have gained two new boolean options elements_only +and remove_blank_text that discard either all strings or whitespace-only +strings from the result list.
  • +
+
+
+

Bugs fixed

+
    +
  • When moving Elements to another tree, the namespace cleanup mechanism +no longer drops namespace prefixes from attributes for which it finds +a default namespace declaration, to prevent them from appearing as +unnamespaced attributes after serialisation.
  • +
  • Returning non-type objects from a custom class lookup method could lead +to a crash.
  • +
  • Instantiating and using subtypes of Comments and ProcessingInstructions +crashed.
  • +
+
+
+

Other changes

+
+
+
+

3.2.0 (2013-04-28)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#690319: Leading whitespace could change the behaviour of the string +parsing functions in lxml.html.
  • +
  • LP#599318: The string parsing functions in lxml.html are more robust +in the face of uncommon HTML content like framesets or missing body tags. +Patch by Stefan Seelmann.
  • +
  • LP#712941: I/O errors while trying to access files with paths that contain +non-ASCII characters could raise UnicodeDecodeError instead of properly +reporting the IOError.
  • +
  • LP#673205: Parsing from in-memory strings disabled network access in the +default parser and made subsequent attempts to parse from a URL fail.
  • +
  • LP#971754: lxml.html.clean appends 'nofollow' to 'rel' attributes instead +of overwriting the current value.
  • +
  • LP#715687: lxml.html.clean no longer discards scripts that are explicitly +allowed by the user provided whitelist. Patch by Christine Koppelt.
  • +
+
+
+

Other changes

+
+
+
+

3.1.2 (2013-04-12)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#1136509: Passing attributes through the namespace-unaware API of +the sax bridge (i.e. the handler.startElement() method) failed +with a TypeError. Patch by Mike Bayer.
  • +
  • LP#1123074: Fix serialisation error in XSLT output when converting +the result tree to a Unicode string.
  • +
  • GH#105: Replace illegal usage of xmlBufLength() in libxml2 2.9.0 +by properly exported API function xmlBufUse().
  • +
+
+
+

Other changes

+
+
+
+

3.1.1 (2013-03-29)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#1160386: Write access to lxml.html.FormElement.fields raised +an AttributeError in Py3.
  • +
  • Illegal memory access during cleanup in incremental xmlfile writer.
  • +
+
+
+

Other changes

+
    +
  • The externally useless class lxml.etree._BaseParser was removed +from the module dict.
  • +
+
+
+
+

3.1.0 (2013-02-10)

+
+

Features added

+
    +
  • GH#89: lxml.html.clean allows overriding the set of attributes that it +considers 'safe'. Patch by Francis Devereux.
  • +
+
+
+

Bugs fixed

+
    +
  • LP#1104370: copy.copy(el.attrib) raised an exception. It now returns +a copy of the attributes as a plain Python dict.
  • +
  • GH#95: When used with namespace prefixes, the el.find*() methods +always used the first namespace mapping that was provided for each +path expression instead of using the one that was actually passed +in for the current run.
  • +
  • LP#1092521, GH#91: Fix undefined C symbol in Python runtimes compiled +without threading support. Patch by Ulrich Seidl.
  • +
+
+
+

Other changes

+
+
+
+

3.1beta1 (2012-12-21)

+
+

Features added

+
    +
  • New build-time option --with-unicode-strings for Python 2 that +makes the API always return Unicode strings for names and text +instead of byte strings for plain ASCII content.
  • +
  • New incremental XML file writing API etree.xmlfile().
  • +
  • E factory in lxml.objectify is callable to simplify the creation of +tags with non-identifier names without having to resort to getattr().
  • +
+
+
+

Bugs fixed

+
    +
  • When starting from a non-namespaced element in lxml.objectify, searching +for a child without explicitly specifying a namespace incorrectly found +namespaced elements with the requested local name, instead of restricting +the search to non-namespaced children.
  • +
  • GH#85: Deprecation warnings were fixed for Python 3.x.
  • +
  • GH#33: lxml.html.fromstring() failed to accept bytes input in Py3.
  • +
  • LP#1080792: Static build of libxml2 2.9.0 failed due to missing file.
  • +
+
+
+

Other changes

+
    +
  • The externally useless class _ObjectifyElementMakerCaller was +removed from the module API of lxml.objectify.
  • +
  • LP#1075622: lxml.builder is faster for adding text to elements with +many children. Patch by Anders Hammarquist.
  • +
+
+
+
+

3.0.2 (2012-12-14)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Fix crash during interpreter shutdown by switching to Cython 0.17.3 for building.
  • +
+
+
+

Other changes

+
+
+
+

3.0.1 (2012-10-14)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • LP#1065924: Element proxies could disappear during garbage collection +in PyPy without proper cleanup.
  • +
  • GH#71: Failure to work with libxml2 2.6.x.
  • +
  • LP#1065139: static MacOS-X build failed in Py3.
  • +
+
+
+

Other changes

+
+
+
+

3.0 (2012-10-08)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • End-of-file handling was incorrect in iterparse() when reading from +a low-level C file stream and failed in libxml2 2.9.0 due to its +improved consistency checks.
  • +
+
+
+

Other changes

+
    +
  • The build no longer uses Cython by default unless the generated C files +are missing. To use Cython, pass the option "--with-cython". To ignore +the fatal build error when Cython is required but not available (e.g. to +run special setup.py commands that do not actually run a build), pass +"--without-cython".
  • +
+
+
+
+

3.0beta1 (2012-09-26)

+
+

Features added

+
    +
  • Python level access to (optional) libxml2 memory debugging features +to simplify debugging of memory leaks etc.
  • +
+
+
+

Bugs fixed

+
    +
  • Fix a memory leak in XPath by switching to Cython 0.17.1.
  • +
  • Some tests were adapted to work with PyPy.
  • +
+
+
+

Other changes

+
    +
  • The code was adapted to work with the upcoming libxml2 2.9.0 release.
  • +
+
+
+
+

3.0alpha2 (2012-08-23)

+
+

Features added

+
    +
  • The .iter() method of elements now accepts tag arguments like +"{*}name" to search for elements with a given local name in any +namespace. With this addition, all combinations of wildcards now work +as expected: +"{ns}name", "{}name", "{*}name", "{ns}*", "{}*" +and "{*}*". Note that "name" is equivalent to "{}name", +but "*" is "{*}*". +The same change applies to the .getiterator(), .itersiblings(), +.iterancestors(), .iterdescendants(), .iterchildren() +and .itertext() methods;the strip_attributes(), +strip_elements() and strip_tags() functions as well as the +iterparse() class. Patch by Simon Sapin.
  • +
  • C14N allows specifying the inclusive prefixes to be promoted +to top-level during exclusive serialisation.
  • +
+
+
+

Bugs fixed

+
    +
  • Passing long Unicode strings into the feed() parser interface +failed to read the entire string.
  • +
+
+
+

Other changes

+
+
+
+

3.0alpha1 (2012-07-31)

+
+

Features added

+
    +
  • Initial support for building in PyPy (through cpyext).
  • +
  • DTD objects gained an API that allows read access to their +declarations.
  • +
  • xpathgrep.py gained support for parsing line-by-line (e.g. +from grep output) and for surrounding the output with a new root +tag.
  • +
  • E-factory in lxml.builder accepts subtypes of known data +types (such as string subtypes) when building elements around them.
  • +
  • Tree iteration and iterparse() with a selective tag +argument supports passing a set of tags. Tree nodes will be +returned by the iterators if they match any of the tags.
  • +
+
+
+

Bugs fixed

+
    +
  • The .find*() methods in lxml.objectify no longer use XPath +internally, which makes them faster in many cases (especially when +short circuiting after a single or couple of elements) and fixes +some behavioural differences compared to lxml.etree. Note that +this means that they no longer support arbitrary XPath expressions +but only the subset that the ElementPath language supports. +The previous implementation was also redundant with the normal +XPath support, which can be used as a replacement.
  • +
  • el.find('*') could accidentally return a comment or processing +instruction that happened to be in the wrong spot. (Same for the +other .find*() methods.)
  • +
  • The error logging is less intrusive and avoids a global setup where +possible.
  • +
  • Fixed undefined names in html5lib parser.
  • +
  • xpathgrep.py did not work in Python 3.
  • +
  • Element.attrib.update() did not accept an attrib of +another Element as parameter.
  • +
  • For subtypes of ElementBase that make the .text or .tail +properties immutable (as in objectify, for example), inserting text +when creating Elements through the E-Factory feature of the class +constructor would fail with an exception, stating that the text +cannot be modified.
  • +
+
+
+

Other changes

+
    +
  • The code base was overhauled to properly use 'const' where the API +of libxml2 and libxslt requests it. This also has an impact on the +public C-API of lxml itself, as defined in etreepublic.pxd, as +well as the provided declarations in the lxml/includes/ directory. +Code that uses these declarations may have to be adapted. On the +plus side, this fixes several C compiler warnings, also for user +code, thus making it easier to spot real problems again.
  • +
  • The functionality of "lxml.cssselect" was moved into a separate PyPI +package called "cssselect". To continue using it, you must install +that package separately. The "lxml.cssselect" module is still +available and provides the same interface, provided the "cssselect" +package can be imported at runtime.
  • +
  • Element attributes passed in as an attrib dict or as keyword +arguments are now sorted by (namespaced) name before being created +to make their order predictable for serialisation and iteration. +Note that adding or deleting attributes afterwards does not take +that order into account, i.e. setting a new attribute appends it +after the existing ones.
  • +
  • Several classes that are for internal use only were removed +from the lxml.etree module dict: +_InputDocument, _ResolverRegistry, _ResolverContext, _BaseContext, +_ExsltRegExp, _IterparseContext, _TempStore, _ExceptionContext, +__ContentOnlyElement, _AttribIterator, _NamespaceRegistry, +_ClassNamespaceRegistry, _FunctionNamespaceRegistry, +_XPathFunctionNamespaceRegistry, _ParserDictionaryContext, +_FileReaderContext, _ParserContext, _PythonSaxParserTarget, +_TargetParserContext, _ReadOnlyProxy, _ReadOnlyPIProxy, +_ReadOnlyEntityProxy, _ReadOnlyElementProxy, _OpaqueNodeWrapper, +_OpaqueDocumentWrapper, _ModifyContentOnlyProxy, +_ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy, +_AppendOnlyElementProxy, _SaxParserContext, _FilelikeWriter, +_ParserSchemaValidationContext, _XPathContext, +_XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam
  • +
  • Several internal classes can no longer be inherited from: +_InputDocument, _ResolverRegistry, _ExsltRegExp, _ElementUnicodeResult, +_IterparseContext, _TempStore, _AttribIterator, _ClassNamespaceRegistry, +_XPathFunctionNamespaceRegistry, _ParserDictionaryContext, +_FileReaderContext, _PythonSaxParserTarget, _TargetParserContext, +_ReadOnlyPIProxy, _ReadOnlyEntityProxy, _OpaqueDocumentWrapper, +_ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy, +_AppendOnlyElementProxy, _FilelikeWriter, _ParserSchemaValidationContext, +_XPathContext, _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam, +_XSLTResultTree, _XSLTProcessingInstruction
  • +
+
+
+
+

2.3.6 (2012-09-28)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Passing long Unicode strings into the feed() parser interface +failed to read the entire string.
  • +
+
+
+

Other changes

+
+
+
+

2.3.5 (2012-07-31)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash when merging text nodes in element.remove().
  • +
  • Crash in sax/target parser when reporting empty doctype.
  • +
+
+
+

Other changes

+
+
+
+

2.3.4 (2012-03-26)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash when building an nsmap (Element property) with empty +namespace URIs.
  • +
  • Crash due to race condition when errors (or user messages) occur +during threaded XSLT processing.
  • +
  • XSLT stylesheet compilation could ignore compilation errors.
  • +
+
+
+

Other changes

+
+
+
+

2.3.3 (2012-01-04)

+
+

Features added

+
    +
  • lxml.html.tostring() gained new serialisation options +with_tail and doctype.
  • +
+
+
+

Bugs fixed

+
    +
  • Fixed a crash when using iterparse() for HTML parsing and +requesting start events.
  • +
  • Fixed parsing of more selectors in cssselect. Whitespace before +pseudo-elements and pseudo-classes is significant as it is a +descendant combinator. +"E :pseudo" should parse the same as "E *:pseudo", not "E:pseudo". +Patch by Simon Sapin.
  • +
  • lxml.html.diff no longer raises an exception when hitting +'img' tags without 'src' attribute.
  • +
+
+
+

Other changes

+
+
+
+

2.3.2 (2011-11-11)

+
+

Features added

+
    +
  • lxml.objectify.deannotate() has a new boolean option +cleanup_namespaces to remove the objectify namespace +declarations (and generally clean up the namespace declarations) +after removing the type annotations.
  • +
  • lxml.objectify gained its own SubElement() function as a +copy of etree.SubElement to avoid an otherwise redundant import +of lxml.etree on the user side.
  • +
+
+
+

Bugs fixed

+
    +
  • Fixed the "descendant" bug in cssselect a second time (after a first +fix in lxml 2.3.1). The previous change resulted in a serious +performance regression for the XPath based evaluation of the +translated expression. Note that this breaks the usage of some of +the generated XPath expressions as XSLT location paths that +previously worked in 2.3.1.
  • +
  • Fixed parsing of some selectors in cssselect. Whitespace after combinators +">", "+" and "~" is now correctly ignored. Previously it was parsed as +a descendant combinator. For example, "div> .foo" was parsed the same as +"div>* .foo" instead of "div>.foo". Patch by Simon Sapin.
  • +
+
+
+

Other changes

+
+
+
+

2.3.1 (2011-09-25)

+
+

Features added

+
    +
  • New option kill_tags in lxml.html.clean to remove specific +tags and their content (i.e. their whole subtree).
  • +
  • pi.get() and pi.attrib on processing instructions to parse +pseudo-attributes from the text content of processing instructions.
  • +
  • lxml.get_include() returns a list of include paths that can be +used to compile external C code against lxml.etree. This is +specifically required for statically linked lxml builds when code +needs to compile against the exact same header file versions as lxml +itself.
  • +
  • Resolver.resolve_file() takes an additional option +close_file that configures if the file(-like) object will be +closed after reading or not. By default, the file will be closed, +as the user is not expected to keep a reference to it.
  • +
+
+
+

Bugs fixed

+
    +
  • HTML cleaning didn't remove 'data:' links.
  • +
  • The html5lib parser integration now uses the 'official' +implementation in html5lib itself, which makes it work with newer +releases of the library.
  • +
  • In lxml.sax, endElementNS() could incorrectly reject a plain +tag name when the corresponding start event inferred the same plain +tag name to be in the default namespace.
  • +
  • When an open file-like object is passed into parse() or +iterparse(), the parser will no longer close it after use. This +reverts a change in lxml 2.3 where all files would be closed. It is +the users responsibility to properly close the file(-like) object, +also in error cases.
  • +
  • Assertion error in lxml.html.cleaner when discarding top-level elements.
  • +
  • In lxml.cssselect, use the xpath 'A//B' (short for +'A/descendant-or-self::node()/B') instead of 'A/descendant::B' for +the css descendant selector ('A B'). This makes a few edge cases +like "div *:last-child" consistent with the selector behavior in +WebKit and Firefox, and makes more css expressions valid location +paths (for use in xsl:template match).
  • +
  • In lxml.html, non-selected <option> tags no longer show up in the +collected form values.
  • +
  • Adding/removing <option> values to/from a multiple select form +field properly selects them and unselects them.
  • +
+
+
+

Other changes

+
    +
  • Static builds can specify the download directory with the +--download-dir option.
  • +
+
+
+
+

2.3 (2011-02-06)

+
+

Features added

+
    +
  • When looking for children, lxml.objectify takes '{}tag' as +meaning an empty namespace, as opposed to the parent namespace.
  • +
+
+
+

Bugs fixed

+
    +
  • When finished reading from a file-like object, the parser +immediately calls its .close() method.
  • +
  • When finished parsing, iterparse() immediately closes the input +file.
  • +
  • Work-around for libxml2 bug that can leave the HTML parser in a +non-functional state after parsing a severely broken document (fixed +in libxml2 2.7.8).
  • +
  • marque tag in HTML cleanup code is correctly named marquee.
  • +
+
+
+

Other changes

+
    +
  • Some public functions in the Cython-level C-API have more explicit +return types.
  • +
+
+
+
+

2.3beta1 (2010-09-06)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash in newer libxml2 versions when moving elements between +documents that had attributes on replaced XInclude nodes.
  • +
  • XMLID() function was missing the optional parser and +base_url parameters.
  • +
  • Searching for wildcard tags in iterparse() was broken in Py3.
  • +
  • lxml.html.open_in_browser() didn't work in Python 3 due to the +use of os.tempnam. It now takes an optional 'encoding' parameter.
  • +
+
+
+

Other changes

+
+
+
+

2.3alpha2 (2010-07-24)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash in XSLT when generating text-only result documents with a +stylesheet created in a different thread.
  • +
+
+
+

Other changes

+
    +
  • repr() of Element objects shows the hex ID with leading 0x +(following ElementTree 1.3).
  • +
+
+
+
+

2.3alpha1 (2010-06-19)

+
+

Features added

+
    +
  • Keyword argument namespaces in lxml.cssselect.CSSSelector() +to pass a prefix-to-namespace mapping for the selector.
  • +
  • New function lxml.etree.register_namespace(prefix, uri) that +globally registers a namespace prefix for a namespace that newly +created Elements in that namespace will use automatically. Follows +ElementTree 1.3.
  • +
  • Support 'unicode' string name as encoding parameter in +tostring(), following ElementTree 1.3.
  • +
  • Support 'c14n' serialisation method in ElementTree.write() and +tostring(), following ElementTree 1.3.
  • +
  • The ElementPath expression syntax (el.find*()) was extended to +match the upcoming ElementTree 1.3 that will ship in the standard +library of Python 3.2/2.7. This includes extended support for +predicates as well as namespace prefixes (as known from XPath).
  • +
  • During regular XPath evaluation, various ESXLT functions are +available within their namespace when using libxslt 1.1.26 or later.
  • +
  • Support passing a readily configured logger instance into +PyErrorLog, instead of a logger name.
  • +
  • On serialisation, the new doctype parameter can be used to +override the DOCTYPE (internal subset) of the document.
  • +
  • New parameter output_parent to XSLTExtension.apply_templates() +to append the resulting content directly to an output element.
  • +
  • XSLTExtension.process_children() to process the content of the +XSLT extension element itself.
  • +
  • ISO-Schematron support based on the de-facto Schematron reference +'skeleton implementation'.
  • +
  • XSLT objects now take XPath object as __call__ stylesheet +parameters.
  • +
  • Enable path caching in ElementPath (el.find*()) to avoid parsing +overhead.
  • +
  • Setting the value of a namespaced attribute always uses a prefixed +namespace instead of the default namespace even if both declare the +same namespace URI. This avoids serialisation problems when an +attribute from a default namespace is set on an element from a +different namespace.
  • +
  • XSLT extension elements: support for XSLT context nodes other than +elements: document root, comments, processing instructions.
  • +
  • Support for strings (in addition to Elements) in node-sets returned +by extension functions.
  • +
  • Forms that lack an action attribute default to the base URL of +the document on submit.
  • +
  • XPath attribute result strings have an attrname property.
  • +
  • Namespace URIs get validated against RFC 3986 at the API level +(required by the XML namespace specification).
  • +
  • Target parsers show their target object in the .target property +(compatible with ElementTree).
  • +
+
+
+

Bugs fixed

+
    +
  • API is hardened against invalid proxy instances to prevent crashes +due to incorrectly instantiated Element instances.
  • +
  • Prevent crash when instantiating CommentBase and friends.
  • +
  • Export ElementTree compatible XML parser class as +XMLTreeBuilder, as it is called in ET 1.2.
  • +
  • ObjectifiedDataElements in lxml.objectify were not hashable. They +now use the hash value of the underlying Python value (string, +number, etc.) to which they compare equal.
  • +
  • Parsing broken fragments in lxml.html could fail if the fragment +contained an orphaned closing '</div>' tag.
  • +
  • Using XSLT extension elements around the root of the output document +crashed.
  • +
  • lxml.cssselect did not distinguish between x[attr="val"] and +x [attr="val"] (with a space). The latter now matches the +attribute independent of the element.
  • +
  • Rewriting multiple links inside of HTML text content could end up +replacing unrelated content as replacements could impact the +reported position of subsequent matches. Modifications are now +simplified by letting the iterlinks() generator in lxml.html +return links in reversed order if they appear inside the same text +node. Thus, replacements and link-internal modifications no longer +change the position of links reported afterwards.
  • +
  • The .value attribute of textarea elements in lxml.html did +not represent the complete raw value (including child tags etc.). It +now serialises the complete content on read and replaces the +complete content by a string on write.
  • +
  • Target parser didn't call .close() on the target object if +parsing failed. Now it is guaranteed that .close() will be +called after parsing, regardless of the outcome.
  • +
+
+
+

Other changes

+
    +
  • Official support for Python 3.1.2 and later.
  • +
  • Static MS Windows builds can now download their dependencies +themselves.
  • +
  • Element.attrib no longer uses a cyclic reference back to its +Element object. It therefore no longer requires the garbage +collector to clean up.
  • +
  • Static builds include libiconv, in addition to libxml2 and libxslt.
  • +
+
+
+
+

2.2.8 (2010-09-02)

+
+

Bugs fixed

+
    +
  • Crash in newer libxml2 versions when moving elements between +documents that had attributes on replaced XInclude nodes.
  • +
  • Import fix for urljoin in Python 3.1+.
  • +
+
+
+
+

2.2.7 (2010-07-24)

+
+

Bugs fixed

+
    +
  • Crash in XSLT when generating text-only result documents with a +stylesheet created in a different thread.
  • +
+
+
+
+

2.2.6 (2010-03-02)

+
+

Bugs fixed

+
    +
  • Fixed several Python 3 regressions by building with Cython 0.11.3.
  • +
+
+
+
+

2.2.5 (2010-02-28)

+
+

Features added

+
    +
  • Support for running XSLT extension elements on the input root node +(e.g. in a template matching on "/").
  • +
+
+
+

Bugs fixed

+
    +
  • Crash in XPath evaluation when reading smart strings from a document +other than the original context document.
  • +
  • Support recent versions of html5lib by not requiring its +XHTMLParser in htmlparser.py anymore.
  • +
  • Manually instantiating the custom element classes in +lxml.objectify could crash.
  • +
  • Invalid XML text characters were not rejected by the API when they +appeared in unicode strings directly after non-ASCII characters.
  • +
  • lxml.html.open_http_urllib() did not work in Python 3.
  • +
  • The functions strip_tags() and strip_elements() in +lxml.etree did not remove all occurrences of a tag in all cases.
  • +
  • Crash in XSLT extension elements when the XSLT context node is not +an element.
  • +
+
+
+
+

2.2.4 (2009-11-11)

+
+

Bugs fixed

+
    +
  • Static build of libxml2/libxslt was broken.
  • +
+
+
+
+

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 honour 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 losing 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 pickling 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 lose 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 compatibility 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 '<!-- comment -->' 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 lose 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 00000000..7ce9e1e5 --- /dev/null +++ b/doc/html/compatibility.html @@ -0,0 +1,206 @@ + + + + + +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:

+ +
+ + + \ No newline at end of file diff --git a/doc/html/credits.html b/doc/html/credits.html new file mode 100644 index 00000000..5865da1b --- /dev/null +++ b/doc/html/credits.html @@ -0,0 +1,95 @@ + + + + + +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
+
ISO-Schematron support, development on lxml.objectify, bug reports, feedback
+
Simon Sapin
+
external maintenance and development of the cssselect package
+
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
+
Sidnei da Silva
+
official MS Windows builds
+
Pascal Oberndörfer
+
official Mac-OS builds
+
+

... 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 et al. (Cython) for the +binding technology.
  • +
  • Jonathan Stoppani for hosting the new mailing list on lxml.de.
  • +
  • the codespeak crew, in particular Philipp von Weitershausen and +Holger Krekel for originally 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 00000000..ffa25306 --- /dev/null +++ b/doc/html/cssselect.html @@ -0,0 +1,120 @@ + + + + + +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 made available in form of the lxml.cssselect +module.

+

Although it started its life in lxml, cssselect is now an independent project. +It translates CSS selectors to XPath 1.0 expressions that can be used with +lxml's XPath engine. lxml.cssselect adds a few convenience shortcuts into +that package.

+

To install cssselect, run

+
+pip install cssselect
+
+

lxml will then import and use it automatically.

+ +
+

The CSSSelector class

+

The most important class in the lxml.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[@class and 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']
+
+

Using CSSSelector is equivalent to translating with cssselect +and using the XPath class:

+
>>> from cssselect import GenericTranslator
+>>> from lxml.etree import XPath
+>>> sel = XPath(GenericTranslator().css_to_xpath('div.content'))
+
+

CSSSelector takes a translator parameter to let you choose which +translator to use. It can be 'xml' (the default), 'xhtml', 'html' +or a Translator object.

+
+
+

The cssselect method

+

lxml Element objects have a cssselect convenience method.

+
>>> h.cssselect('div.content') == sel(h)
+True
+
+

Note however that pre-compiling the expression with the CSSSelector or +XPath class can provide a substantial speedup.

+

The method also accepts a translator parameter. On HtmlElement +objects, the default is changed to 'html'.

+
+
+

Supported Selectors

+

Most Level 3 selectors are supported. The details are in the +cssselect documentation.

+
+
+

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: the CSSSelector class accepts a dictionary as its +namespaces argument.

+
+
+ + + \ 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 00000000..663ee8e3 --- /dev/null +++ b/doc/html/element_classes.html @@ -0,0 +1,532 @@ + + + + + +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):
+...    @property
+...    def honking(self):
+...       return self.get('honking') == 'true'
+
+

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 normally 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 or proxy +state, 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, or need a way to persistently store state in the proxy +instances instead of the XML tree, here is a way to do so.

+

There is one important guarantee regarding Element proxies. Once a +proxy has been instantiated, it will keep alive as long as there is a +Python reference to it, and any access to the XML element in the tree +will return this very instance. Therefore, if you need to store local +state in a custom Element class (which is generally discouraged), you +can do so by keeping the Elements in a tree alive. If the tree +doesn't change, you can simply do this:

+
proxy_cache = list(root.iter())
+
+

or

+
proxy_cache = set(root.iter())
+
+

or use any other suitable container. Note that you have to keep this +cache manually up to date if the tree changes, which can get tricky in +cases.

+

For proxy initialisation, ElementBase classes have an _init() +method that can be overridden, as oppose to the normal __init__() +method. 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 through 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. Specifically, +it also handles comments and processing instructions, which are easy to +forget about when mapping proxies to classes.

+

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
+
+>>> root = etree.fromstring(
+...     '<root honking="true"><!--comment--></root>', parser)
+>>> root.honking
+True
+>>> print(root[0].text)
+comment
+
+
+
+

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)
+
+>>> root = etree.fromstring(
+...     '<root honking="true"><!--comment--></root>', parser)
+>>> root.honking
+True
+>>> print(root[0].text)
+comment
+
+
+
+

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)
+
+

And here is how to use it:

+
>>> xml = '<a id="123"><b id="1234"/><b id="1234" honking="true"/></a>'
+>>> a = etree.fromstring(xml, parser)
+
+>>> a.honking       # id does not match !
+Traceback (most recent call last):
+AttributeError: 'lxml.etree._Element' object has no attribute 'honking'
+
+>>> a[0].honking
+False
+>>> a[1].honking
+True
+
+

This lookup scheme 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):
+...         if node_type == 'element':
+...             return honk  # be a bit more selective here ...
+...         else:
+...             return None  # pass on to (default) fallback
+
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(MyLookup())
+
+>>> root = etree.fromstring(
+...     '<root honking="true"><!--comment--></root>', parser)
+>>> root.honking
+True
+>>> print(root[0].text)
+comment
+
+

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(globals()) 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 Python functions for use 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/><!--comment-->'
+...        '</honk>')
+>>> 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'
+>>> print(honk_element[1].text)
+comment
+
+

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):
+...    @property
+...    def honking(self):
+...       return self.get('honking') == 'true'
+>>> 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/><!--comment-->'
+...        '</honk>')
+>>> honk_element = etree.fromstring(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)
+Traceback (most recent call last):
+...
+AttributeError: 'HonkNSElement' object has no attribute 'honking'
+
+>>> print(honk_element[1].text)  # uses fallback for non-elements
+comment
+
+

Since lxml 4.1, the registration is more conveniently done with +class decorators. The namespace registry object is callable with +a name (or None) as argument and can then be used as decorator.

+
>>> honk_elements = lookup.get_namespace('http://hui.de/honk')
+
+>>> @honk_elements(None)
+... class HonkNSElement(etree.ElementBase):
+...    def honk(self):
+...       return "HONK"
+
+

If the class has the same name as the tag, you can also leave out the call +and use the blank decorator instead:

+
+
+>>> @honk_elements
+... class honkel(HonkNSElement):
+...    @property
+...    def honking(self):
+...       return self.get('honking') == 'true'
+
+
+>>> xml = '<honkel xmlns="http://hui.de/honk" honking="true"><bla/><!--comment--></honkel>'
+>>> honk_element = etree.fromstring(xml, parser)
+
+
+>>> print(type(honk_element))
+<class 'honkel'>
+>>> print(type(honk_element[0]))
+<class 'HonkNSElement'>
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/elementsoup.html b/doc/html/elementsoup.html new file mode 100644 index 00000000..59bec1d7 --- /dev/null +++ b/doc/html/elementsoup.html @@ -0,0 +1,210 @@ + + + + + +BeautifulSoup Parser + + + +
+

BeautifulSoup Parser

+ +

BeautifulSoup is a Python package for working with real-world and broken HTML, +just like lxml.html. As of version 4.x, it can use +different HTML parsers, +each of which has its advantages and disadvantages (see the link).

+

lxml can make use of BeautifulSoup as a parser backend, just like BeautifulSoup +can employ lxml as a parser. When using BeautifulSoup from lxml, however, the +default is to use Python's integrated HTML parser in the +html.parser module. +In order to make use of the HTML5 parser of +html5lib instead, it is better +to go directly through the html5parser module in +lxml.html.

+

A very nice feature of BeautifulSoup is its excellent support for encoding +detection which can provide better results for real-world HTML pages that +do not (correctly) declare their encoding.

+

lxml interfaces with 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 +lxml. 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 Fredrik Lundh's 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).strip())
+<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? The parser did its best, and so now it's a tree.

+

To control how Element objects are created during the conversion +of the tree, 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.9.1 parses the same tag soup as +follows. The only 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 onload="crash()">Hi all<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 C implemented HTML parser of libxml2 that lxml uses. 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

+

Even if you prefer lxml's fast HTML parser, you can still benefit +from BeautifulSoup's support for encoding detection in the +UnicodeDammit class. Once it succeeds in decoding the data, +you can simply pass the resulting Unicode string into lxml's parser.

+
>>> try:
+...    from bs4 import UnicodeDammit             # BeautifulSoup 4
+...
+...    def decode_html(html_string):
+...        converted = UnicodeDammit(html_string)
+...        if not converted.unicode_markup:
+...            raise UnicodeDecodeError(
+...                "Failed to detect encoding, tried [%s]",
+...                ', '.join(converted.tried_encodings))
+...        # print converted.original_encoding
+...        return converted.unicode_markup
+...
+... except ImportError:
+...    from BeautifulSoup import UnicodeDammit   # BeautifulSoup 3
+...
+...    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 00000000..6e659c07 --- /dev/null +++ b/doc/html/extensions.html @@ -0,0 +1,537 @@ + + + + + +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(context, a):
+...    return "Hello %s" % a
+>>> def ola(context, a):
+...    return "Ola %s" % a
+>>> def loadsofargs(context, *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.

+

Since lxml 4.1, it is preferred to use the FunctionNamespace as a decorator. +Either pass an explicit function name (@ns("countargs")), or just use the +bare decorator to register the function under its own name:

+
>>> @ns
+... def hello(context, a):
+...    return "Hello %s" % a
+
+

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('Dr. Falken')"))
+Hello Dr. Falken
+>>> 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"
+...     print(sorted(context.eval_context.items()))
+>>> 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')
+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:

+
>>> 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 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'
+
+

Here, 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.

+

The return value of .apply_templates() is always a list. It may +contain a mix of elements and strings, collected from the XSLT processing +result. If you want to append these values to the output parent, be aware +that you cannot use the .append() method to add strings. In many +cases, you would only be interested in elements anyway, so you can discard +strings (e.g. formatting whitespace) and append the rest.

+

If you want to include string results in the output, you can either build +an appropriate tree yourself and append that, or you can manually add the +string values to the current output tree, e.g. by concatenating them with +the .tail of the last element that was appended.

+

Note that you can also let lxml build the result tree for you by passing +the output_parent into the .apply_templates() method. In this +case, the result will be None and all content found by applying templates +will be appended to the output parent.

+

If you do not care about string results at all, e.g. because you already +know that they will only contain whitespace, you can pass the option +elements_only=True to the .apply_templates() method, or pass +remove_blank_text=True to remove only those strings that consist +entirely of whitespace.

+
+
+

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 00000000..8ceaae4f --- /dev/null +++ b/doc/html/html5parser.html @@ -0,0 +1,97 @@ + + + + + +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 00000000..4a2eaa50 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,253 @@ + + + + + +lxml - Processing XML and HTML with Python + + + + + +
+

lxml - XML and HTML with Python

+ + +

lxml is the most feature-rich +and easy-to-use library +for processing XML and HTML +in the Python language.

+
+

Introduction

+

The lxml XML toolkit is a Pythonic binding for the C libraries +libxml2 and libxslt. It is unique in that it combines the speed and +XML feature completeness of these libraries with the simplicity of a +native Python API, mostly compatible but superior to the well-known +ElementTree API. The latest release works with all CPython versions +from 2.7 to 3.7. See the introduction for more information about +background and goals of the lxml project. Some common questions are +answered in the FAQ.

+
+

Support the project

+

lxml has been downloaded from the Python Package Index +millions of times and is also available directly in many package +distributions, e.g. for Linux or MacOS-X.

+

Most people who use lxml do so because they like using it. +You can show us that you like it by blogging about your experience +with it and linking to the project website.

+

If you are using lxml for your work and feel like giving a bit of +your own benefit back to support the project, consider sending us +money through GitHub Sponsors, Tidelift or PayPal that we can use +to buy us free time for the maintenance of this great library, to +fix bugs in the software, review and integrate code contributions, +and improving its features and documentation. Please read the +Legal Notice below, at the bottom of this page. +Thank you for your support.

+

Support lxml through GitHub Sponsors

+

(Note: GitHub will currently double your donation!)

+

via Tidelift

+

or via PayPal:

+

Donate to the lxml project

+

Please contact Stefan Behnel +for other ways to support the lxml project, +as well as commercial consulting, customisations and trainings on lxml and +fast Python XML processing.

+

Travis-CI and AppVeyor +support the lxml project with their build and CI servers. +Jetbrains supports the lxml project by donating free licenses of their +PyCharm IDE. +Another supporter of the lxml project is +COLOGNE Webdesign.

+
+
+
+

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 for XML processing. See also the +ElementTree compatibility overview and the ElementTree performance +page comparing lxml to the original ElementTree and cElementTree +implementations.

+

Right after the lxml.etree tutorial for XML processing and the +ElementTree documentation, the next place to look is the lxml.etree +specific API documentation. It describes how lxml extends the +ElementTree API to expose libxml2 and libxslt specific XML +functionality, such as XPath, Relax NG, XML Schema, XSLT, and +c14n (including c14n 2.0). +Python code can be called from XPath expressions and XSLT +stylesheets through the use of XPath 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 XML element classes. This is a simple way to write +arbitrary XML driven APIs on top of lxml. lxml.etree also has a +C-level API that can be used to efficiently extend lxml.etree in +external C modules, including fast 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.

+

The latest version is lxml 4.4.3, released 2020-01-28 +(changes for 4.4.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, or use the +PDF documentation.

+

The latest installable developer sources +are available from Github. It's also possible to check out +the latest development version of lxml from Github directly, using a command +like this (assuming you use hg and have hg-git installed):

+
+hg clone git+ssh://git@github.com/lxml/lxml.git lxml
+
+

Alternatively, if you use git, this should work as well:

+
+git clone https://github.com/lxml/lxml.git lxml
+
+

You can browse the source repository and its history through +the web. 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 +check the documentation and 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 websites of lxml +4.3, +4.2, +4.1, +4.0, +3.8, +3.7, +3.6, +3.5, +3.4, +3.3, +3.2, +3.1, +3.0, +2.3, +2.2, +2.1, +2.0, +1.3

+ +
+ +
+ + + \ No newline at end of file diff --git a/doc/html/installation.html b/doc/html/installation.html new file mode 100644 index 00000000..dc7f1c79 --- /dev/null +++ b/doc/html/installation.html @@ -0,0 +1,215 @@ + + + + + +Installing lxml + + + +
+

Installing lxml

+ + +
+

Where to get it

+

lxml is generally distributed through PyPI.

+

Most Linux platforms come with some version of lxml readily +packaged, usually named python-lxml for the Python 2.x version +and python3-lxml for Python 3.x. If you can use that version, +the quickest way to install lxml is to use the system package +manager, e.g. apt-get on Debian/Ubuntu:

+
+sudo apt-get install python3-lxml
+
+

For MacOS-X, a macport of lxml is available. +Try something like

+
+sudo port install py27-lxml
+
+

To install a newer version or to install lxml on other systems, +see below.

+
+
+

Requirements

+

You need Python 2.7 or 3.4+.

+

Unless you are using a static binary distribution (e.g. from a +Windows binary installer), lxml requires libxml2 and libxslt to +be installed, in particular:

+
    +
  • libxml2 version 2.9.2 or later.
  • +
  • libxslt version 1.1.27 or later.
      +
    • We recommend libxslt 1.1.28 or later.
    • +
    +
  • +
+

Newer versions generally contain fewer bugs and are therefore +recommended. XML Schema support is also still worked on in libxml2, +so newer versions will give you better compliance with the W3C spec.

+

To install the required development packages of these dependencies +on Linux systems, use your distribution specific installation tool, +e.g. apt-get on Debian/Ubuntu:

+
+sudo apt-get install libxml2-dev libxslt-dev python-dev
+
+

For Debian based systems, it should be enough to install the known +build dependencies of the provided lxml package, e.g.

+
+sudo apt-get build-dep python3-lxml
+
+
+
+

Installation

+

If your system does not provide binary packages or you want to install +a newer version, the best way is to get the pip package management tool +(or use a virtualenv) and +run the following:

+
+pip install lxml
+
+

If you are not using pip in a virtualenv and want to install lxml globally +instead, you have to run the above command as admin, e.g. on Linux:

+
+sudo pip install lxml
+
+

To install a specific version, either download the distribution +manually and let pip install that, or pass the desired version +to pip:

+
+pip install lxml==3.4.2
+
+

To speed up the build in test environments, e.g. on a continuous +integration server, disable the C compiler optimisations by setting +the CFLAGS environment variable:

+
+CFLAGS="-O0"  pip install lxml
+
+

(The option reads "minus Oh Zero", i.e. zero optimisations.)

+
+

MS Windows

+

For MS Windows, recent lxml releases feature community donated +binary distributions, although you might still want to take a look +at the related FAQ entry. +If you fail to build lxml on your MS Windows system from the signed +and tested sources that we release, consider using the binary builds +from PyPI or the unofficial Windows binaries +that Christoph Gohlke generously provides.

+
+
+

Linux

+

On Linux (and most other well-behaved operating systems), pip will +manage to build the source distribution as long as libxml2 and libxslt +are properly installed, including development packages, i.e. header files, +etc. See the requirements section above and use your system package +management tool to look for packages like libxml2-dev or +libxslt-devel. If the build fails, make sure they are installed.

+

Alternatively, setting STATIC_DEPS=true will download and build +both libraries automatically in their latest version, e.g. +STATIC_DEPS=true pip install lxml.

+
+
+

MacOS-X

+

On MacOS-X, use the following to build the source distribution, +and make sure you have a working Internet connection, as this will +download libxml2 and libxslt in order to build them:

+
+STATIC_DEPS=true sudo pip install lxml
+
+
+
+
+

Building lxml from dev sources

+

If you want to build lxml from the GitHub repository, you should read +how to build lxml from source (or the file doc/build.txt in the +source tree). Building from developer 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.

+
+
+

Using lxml with python-libxml2

+

If you want to use lxml together with the official libxml2 Python +bindings (maybe because one of your dependencies uses it), you must +build lxml statically. Otherwise, the two packages will interfere in +places where the libxml2 library requires global configuration, which +can have any kind of effect from disappearing functionality to crashes +in either of the two.

+

To get a static build, either pass the --static-deps option to the +setup.py script, or run pip with the STATIC_DEPS or +STATICBUILD environment variable set to true, i.e.

+
+STATIC_DEPS=true pip install lxml
+
+

The STATICBUILD environment variable is handled equivalently to +the STATIC_DEPS variable, but is used by some other extension +packages, too.

+
+
+

Source builds on MS Windows

+

Most MS Windows systems lack the necessarily tools to build software, +starting with a C compiler already. Microsoft leaves it to users to +install and configure them, which is usually not trivial and means +that distributors cannot rely on these dependencies being available +on a given system. In a way, you get what you've paid for and make +others pay for it.

+

Due to the additional lack of package management of this platform, +it is best to link the library dependencies statically if you decide +to build from sources, rather than using a binary installer. For +that, lxml can use the binary distribution of libxml2 and libxslt, which it downloads +automatically during the static build. It needs both libxml2 and +libxslt, as well as iconv and zlib, which are available from the +same download site. Further build instructions are in the +source build documentation.

+
+
+

Source builds on MacOS-X

+

If you are not using macports or want to use a more recent lxml +release, you have to build it yourself. While the pre-installed system +libraries of libxml2 and libxslt are less outdated in recent MacOS-X +versions than they used to be, so lxml should work with them out of the +box, it is still recommended to use a static build with the most recent +library versions.

+

Luckily, lxml's setup.py script has built-in support for building +and integrating these libraries statically during the build. Please +read the +MacOS-X build instructions.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/intro.html b/doc/html/intro.html new file mode 100644 index 00000000..fef02189 --- /dev/null +++ b/doc/html/intro.html @@ -0,0 +1,89 @@ + + + + + +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 00000000..32b50259 --- /dev/null +++ b/doc/html/lxml-source-howto.html @@ -0,0 +1,293 @@ + + + + + +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 GitHub 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 source 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/lxmlhtml.html b/doc/html/lxmlhtml.html new file mode 100644 index 00000000..153a5546 --- /dev/null +++ b/doc/html/lxmlhtml.html @@ -0,0 +1,703 @@ + + + + + +lxml.html + + + + +
+

lxml.html

+ +++ + + + +
Author:Ian Bicking
+

Since version 2.0, lxml comes with a dedicated Python package for +dealing with HTML: lxml.html. It is based on lxml's HTML parser, +but provides a special Element API for HTML elements, as well as a +number of utilities for common HTML processing 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 in a useful way. A way to deal with this +is ElementSoup, which deploys the well-known BeautifulSoup parser to +build an lxml HTML tree.

+

However, note that the most common problem with web pages is the lack +of (or the existence of incorrect) encoding declarations. It is +therefore often sufficient to only use the encoding detection of +BeautifulSoup, called UnicodeDammit, and to leave the rest to lxml's +own HTML parser, which is several times faster.

+
+
+
+

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.
+
.classes:
+
Returns a set-like object that allows accessing and modifying the +names in the 'class' attribute of the element. (New in lxml 3.5).
+
.set(key, value=None):
+
Sets an HTML attribute. If no value is given, or if the value is +None, it creates a boolean attribute like <form novalidate></form> +or <div custom-attribute></div>. In XML, attributes must +have at least the empty string as their value like <form +novalidate=""></form>, but HTML boolean attributes can also be +just present or absent from an element without having a value.
+
+
+
+

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 an 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[0].fields['url'] = 'http://lxml.de/'
+>>> result = parse(submit_form(page.forms[0])).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)
+<div><style>/* deleted */</style><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></div>
+
+

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 00000000..50105fe4 --- /dev/null +++ b/doc/html/objectify.html @@ -0,0 +1,1172 @@ + + + + + +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.

+
+

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 = objectify.SubElement(root, "b")
+>>> print(root.b[0].tag)
+b
+>>> root.index(root.b[0])
+0
+>>> b = objectify.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 = objectify.SubElement(root, "x")
+>>> x2 = objectify.SubElement(root, "x")
+>>> x3 = objectify.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 = objectify.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 = objectify.SubElement(root, "child")
+>>> child2 = objectify.SubElement(root, "child")
+>>> child3 = objectify.SubElement(root, "child")
+
+>>> el = objectify.Element("new_child")
+>>> subel = objectify.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
+
+
+
+

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 = objectify.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 = objectify.SubElement(obj_el, "sub")
+>>> print(isinstance(subel, objectify.ObjectifiedElement))
+True
+
+>>> independent_el = etree.Element("new")
+>>> print(isinstance(independent_el, objectify.ObjectifiedElement))
+False
+
+
+
+

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.21),
+...   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.21</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 = objectify.SubElement(root, "{http://ns/}b")
+>>> c = objectify.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 = objectify.SubElement(root, "{http://ns/}tag-name")
+>>> print(root["tag-name"].tag)
+{http://ns/}tag-name
+
+>>> new_el = objectify.Element("{http://ns/}new-element")
+>>> el = objectify.SubElement(new_el, "{http://ns/}child")
+>>> el = objectify.SubElement(new_el, "{http://ns/}child")
+>>> el = objectify.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 = b"<a><b>test</b><c/></a>"
+>>> a = objectify.fromstring(xml, parser)  # doctest: +ELLIPSIS
+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 = objectify.SubElement(root, "{http://ns/}b")
+>>> c  = objectify.SubElement(b1,   "{http://ns/}c")
+>>> b2 = objectify.SubElement(root, "{http://ns/}b")
+>>> d  = objectify.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]
+      * py:pytype = 'float'
+      * xsi:type = 'xsd:double'
+    i = 5 [IntElement]
+      * py:pytype = 'int'
+      * xsi:type = 'xsd:int'
+    s = '5' [StringElement]
+      * py:pytype = 'str'
+      * xsi:type = 'xsd:string'
+>>> 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]
+      * py:pytype = 'float'
+      * xsi:type = 'xsd:double'
+    i = 5 [IntElement]
+      * py:pytype = 'int'
+      * xsi:type = 'xsd:int'
+    s = '5' [StringElement]
+      * py:pytype = 'str'
+      * xsi:type = 'xsd:string'
+    n = None [NoneElement]
+      * py:pytype = 'NoneType'
+      * xsi:nil = 'true'
+>>> 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]
+
+

Note that deannotate() does not remove the namespace declarations +of the pytype namespace by default. To remove them as well, and +to generally clean up the namespace declarations in the document +(usually when done with the whole processing), pass the option +cleanup_namespaces=True. This option is new in lxml 2.3.2. In +older versions, use the function lxml.etree.cleanup_namespaces() +instead.

+
+
+

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]
+      * myattr = 'someval'
+      * py:pytype = 'str'
+
+>>> 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 00000000..185b9c5b --- /dev/null +++ b/doc/html/parsing.html @@ -0,0 +1,900 @@ + + + + + +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
+
+

The following examples also use StringIO or BytesIO to show how to parse +from files and file-like objects. Both are available in the io module:

+
from io import StringIO, BytesIO
+
+
+

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, also known as +ignorable whitespace. This is best used together with a DTD or schema +(which tells data and noise apart), otherwise a heuristic will be applied.
  • +
  • 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)
  • +
  • collect_ids - collect XML IDs in a hash table while parsing (on by default). +Disabling this can substantially speed up parsing of documents with many +different IDs if the hash lookup is not used afterwards.
  • +
+

Other keyword arguments:

+
    +
  • encoding - override the document encoding
  • +
  • target - a parser target object that will receive the parse events +(see The target parser interface)
  • +
  • schema - an XMLSchema to validate against (see validation)
  • +
+
+
+

Error log

+

Parsers have an error_log property that lists the errors and +warnings of the last parser run:

+
>>> parser = etree.XMLParser()
+>>> print(len(parser.error_log))
+0
+
+>>> tree = etree.XML("<root>\n</b>", parser)  # doctest: +ELLIPSIS
+Traceback (most recent call last):
+  ...
+lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: root line 1 and b, line 2, column 5...
+
+>>> 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)
+2
+>>> print(error.column)
+5
+
+

Each entry in the log has the following properties:

+
    +
  • message: the message text
  • +
  • domain: the domain ID (see the lxml.etree.ErrorDomains class)
  • +
  • type: the message type ID (see the lxml.etree.ErrorTypes class)
  • +
  • level: the log level ID (see the lxml.etree.ErrorLevels class)
  • +
  • line: the line at which the message originated (if applicable)
  • +
  • column: the character column at which the message originated (if applicable)
  • +
  • filename: the name of the file in which the message originated (if applicable)
  • +
+

For convenience, there are also three properties that provide readable +names for the ID values:

+
    +
  • domain_name
  • +
  • type_name
  • +
  • level_name
  • +
+

To filter for a specific kind of message, use the different +filter_*() methods on the error log (see the +lxml.etree._ListErrorLog class).

+
+
+

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.

+

Also note that the HTML parser is meant to parse HTML documents. For +XHTML documents, use the XML parser, which is namespace aware.

+
+
+

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. Since lxml 3.5, the doctype references are mutable.

+
>>> 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
+
+>>> docinfo.system_url = None
+>>> docinfo.public_id = None
+>>> print(etree.tostring(tree))
+<!DOCTYPE html>
+<html><body/></html>
+
+
+
+
+

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(object):
+...     def start(self, tag, attrib):
+...         print("start %s %r" % (tag, dict(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!
+
+

Starting with lxml 2.3, the .close() method will also be called in +the error case. This diverges from the behaviour of ElementTree, but +allows target objects to clean up their state in all situations, so +that the parser can reuse them afterwards.

+
>>> class CollectorTarget(object):
+...     def __init__(self):
+...         self.events = []
+...     def start(self, tag, attrib):
+...         self.events.append("start %s %r" % (tag, dict(attrib)))
+...     def end(self, tag):
+...         self.events.append("end %s" % tag)
+...     def data(self, data):
+...         self.events.append("data %r" % data)
+...     def comment(self, text):
+...         self.events.append("comment %s" % text)
+...     def close(self):
+...         self.events.append("close")
+...         return "closed!"
+
+>>> parser = etree.XMLParser(target = CollectorTarget())
+
+>>> result = etree.XML("<element>some</error>",
+...                    parser)        # doctest: +ELLIPSIS
+Traceback (most recent call last):
+  ...
+lxml.etree.XMLSyntaxError: Opening and ending tag mismatch...
+
+>>> for event in parser.target.events:
+...     print(event)
+start element {}
+data u'some'
+close
+
+

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.

+
+
+

Incremental event parsing

+

In Python 3.4, the xml.etree.ElementTree package gained an extension +to the feed parser interface that is implemented by the XMLPullParser +class. It additionally allows processing parse events after each +incremental parsing step, by calling the .read_events() method and +iterating over the result. This is most useful for non-blocking execution +environments where data chunks arrive one after the other and should be +processed as far as possible in each step.

+

The same feature is available in lxml 3.3. The basic usage is as follows:

+
>>> parser = etree.XMLPullParser(events=('start', 'end'))
+
+>>> def print_events(parser):
+...     for action, element in parser.read_events():
+...         print('%s: %s' % (action, element.tag))
+
+>>> parser.feed('<root>some text')
+>>> print_events(parser)
+start: root
+>>> print_events(parser)    # well, no more events, as before ...
+
+>>> parser.feed('<child><a />')
+>>> print_events(parser)
+start: child
+start: a
+end: a
+
+>>> parser.feed('</child></roo')
+>>> print_events(parser)
+end: child
+>>> parser.feed('t>')
+>>> print_events(parser)
+end: root
+
+

Just like the normal feed parser, the XMLPullParser builds a tree in +memory (and you should always call the .close() method when done with +parsing):

+
>>> root = parser.close()
+>>> etree.tostring(root)
+b'<root>some text<child><a/></child></root>'
+
+

However, since the parser provides incremental access to that tree, +you can explicitly delete content that you no longer need once you +have processed it. Read the section on Modifying the tree below +to see what you can do here and what kind of modifications you should +avoid.

+

In lxml, it is enough to call the .read_events() method once as +the iterator it returns can be reused when new events are available.

+

Also, as known from other iterators in lxml, you can pass a tag +argument that selects which parse events are returned by the +.read_events() iterator.

+
+

Event types

+

The parse events 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, whereas the +example above requested the generation of both 'start' and 'end' events.

+

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.

+
>>> def print_events(events):
+...     for action, obj in events:
+...         if action in ('start', 'end'):
+...             print("%s: %s" % (action, obj.tag))
+...         elif action == 'start-ns':
+...             print("%s: %s" % (action, obj))
+...         else:
+...             print(action)
+
+>>> event_types = ("start", "end", "start-ns", "end-ns")
+>>> parser = etree.XMLPullParser(event_types)
+>>> events = parser.read_events()
+
+>>> parser.feed('<root><element>')
+>>> print_events(events)
+start: root
+start: element
+>>> parser.feed('text</element><element>text</element>')
+>>> print_events(events)
+end: element
+start: element
+end: element
+>>> parser.feed('<empty-element xmlns="http://testns/" />')
+>>> print_events(events)
+start-ns: ('', 'http://testns/')
+start: {http://testns/}empty-element
+end: {http://testns/}empty-element
+end-ns
+>>> parser.feed('</root>')
+>>> print_events(events)
+end: 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:

+
>>> parser = etree.XMLPullParser()
+>>> events = parser.read_events()
+
+>>> parser.feed('<root><element key="value">text</element>')
+>>> parser.feed('<element><child /></element>')
+>>> for action, elem in events:
+...     print('%s: %d' % (elem.tag, len(elem)))  # processing
+...     elem.clear(keep_tail=True)               # delete children
+element: 0
+child: 0
+element: 1
+>>> parser.feed('<empty-element xmlns="http://testns/" /></root>')
+>>> for action, elem in events:
+...     print('%s: %d' % (elem.tag, len(elem)))  # processing
+...     elem.clear(keep_tail=True)               # delete children
+{http://testns/}empty-element: 0
+root: 3
+
+>>> root = parser.close()
+>>> etree.tostring(root)
+b'<root/>'
+
+

WARNING: During the 'start' event, any content of the element, +such as the descendants, following siblings or text, is not yet +available and should not be accessed. Only attributes are guaranteed +to be set. 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 parser.read_events():
+...     # ... do something with the element
+...     element.clear(keep_tail=True)   # 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.

+
+
+

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:

+
>>> parser = etree.XMLPullParser(tag="element")
+
+>>> parser.feed('<root><element key="value">text</element>')
+>>> parser.feed('<element><child /></element>')
+>>> parser.feed('<empty-element xmlns="http://testns/" /></root>')
+
+>>> for action, elem in parser.read_events():
+...     print("%s: %s" % (action, elem.tag))
+end: element
+end: element
+
+>>> event_types = ("start", "end")
+>>> parser = etree.XMLPullParser(event_types, tag="{http://testns/}*")
+
+>>> parser.feed('<root><element key="value">text</element>')
+>>> parser.feed('<element><child /></element>')
+>>> parser.feed('<empty-element xmlns="http://testns/" /></root>')
+
+>>> for action, elem in parser.read_events():
+...     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 XMLPullParser in lxml.etree +also supports the event types 'comment' and 'pi' for the respective +XML structures.

+
>>> event_types = ("start", "end", "comment", "pi")
+>>> parser = etree.XMLPullParser(event_types)
+
+>>> parser.feed('<?some pi ?><!-- a comment --><root>')
+>>> parser.feed('<element key="value">text</element>')
+>>> parser.feed('<!-- another comment -->')
+>>> parser.feed('<element>text</element>tail')
+>>> parser.feed('<empty-element xmlns="http://testns/" />')
+>>> parser.feed('</root>')
+
+>>> for action, elem in parser.read_events():
+...     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
+
+>>> root = parser.close()
+>>> print(root.tag)
+root
+
+
+
+

Events with custom targets

+

You can combine the pull parser with a parser target. In that case, +it is the target's responsibility to generate event values. Whatever +it returns from its .start() and .end() methods will be returned +by the pull parser as the second item of the parse events tuple.

+
>>> class Target(object):
+...     def start(self, tag, attrib):
+...         print('-> start(%s)' % tag)
+...         return '>>START: %s<<' % tag
+...     def end(self, tag):
+...         print('-> end(%s)' % tag)
+...         return '>>END: %s<<' % tag
+...     def close(self):
+...         print('-> close()')
+...         return "CLOSED!"
+
+>>> event_types = ('start', 'end')
+>>> parser = etree.XMLPullParser(event_types, target=Target())
+
+>>> parser.feed('<root><child1 /><child2 /></root>')
+-> start(root)
+-> start(child1)
+-> end(child1)
+-> start(child2)
+-> end(child2)
+-> end(root)
+
+>>> for action, value in parser.read_events():
+...     print('%s: %s' % (action, value))
+start: >>START: root<<
+start: >>START: child1<<
+end: >>END: child1<<
+start: >>START: child2<<
+end: >>END: child2<<
+end: >>END: root<<
+
+>>> print(parser.close())
+-> close()
+CLOSED!
+
+

As you can see, the event values do not even have to be Element objects. +The target is generally free to decide how it wants to create an XML tree +or whatever else it wants to make of the parser callbacks. In many cases, +however, you will want to make your custom target inherit from the +TreeBuilder class in order to have it build a tree that you can process +normally. The start() and .end() methods of TreeBuilder return +the Element object that was created, so you can override them and modify +the input or output according to your needs. Here is an example that +filters attributes before they are being added to the tree:

+
>>> class AttributeFilter(etree.TreeBuilder):
+...     def start(self, tag, attrib):
+...         attrib = dict(attrib)
+...         if 'evil' in attrib:
+...             del attrib['evil']
+...         return super(AttributeFilter, self).start(tag, attrib)
+
+>>> parser = etree.XMLPullParser(target=AttributeFilter())
+>>> parser.feed('<root><child1 test="123" /><child2 evil="YES" /></root>')
+
+>>> for action, element in parser.read_events():
+...     print('%s: %s(%r)' % (action, element.tag, element.attrib))
+end: child1({'test': '123'})
+end: child2({})
+end: root({})
+
+>>> root = parser.close()
+
+
+
+
+

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. You can think of it as +a blocking wrapper around the XMLPullParser that automatically and +incrementally reads data from the input file for you and provides a +single iterator for them:

+
>>> 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
+
+

After parsing, 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
+
+

iterparse() also supports the tag argument for selective event +iteration and several other parameters that control the parser setup. +The tag argument can be a single tag or a sequence of tags. +You can also use it to parse HTML input by passing html=True.

+
+

iterwalk

+

For convenience, lxml also provides an iterwalk() function. +It behaves exactly like iterparse(), but works on Elements and +ElementTrees. Here is an example for a tree parsed by iterparse():

+
>>> 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
+
+>>> root = context.root
+
+

And now we can take the resulting in-memory tree and iterate over it +using iterwalk() to get the exact same events without parsing the +input again:

+
>>> 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
+
+

In order to avoid wasting time on uninteresting parts of the tree, the iterwalk +iterator can be instructed to skip over an entire subtree with its +.skip_subtree() method.

+
>>> root = etree.XML('''
+... <root>
+...   <a> <b /> </a>
+...   <c />
+... </root>
+... ''')
+
+>>> context = etree.iterwalk(root, events=("start", "end"))
+
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+...     if action == 'start' and elem.tag == 'a':
+...         context.skip_subtree()  # ignore <b>
+start: root
+start: a
+end: a
+start: c
+end: c
+end: root
+
+

Note that .skip_subtree() only has an effect when handling start or +start-ns events.

+
+
+
+

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:

+
>>> root = etree.XML( u'<test> \uf8d1 + \uf8d2 </test>' )
+
+

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' +
+...            u'<test> \uf8d1 + \uf8d2 </test>' )
+Traceback (most recent call last):
+  ...
+ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
+
+

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 name 'unicode' 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 00000000..b7761566 --- /dev/null +++ b/doc/html/performance.html @@ -0,0 +1,805 @@ + + + + + +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 presented below compare lxml 3.1.1 (with libxml2 2.9.0) to the +latest released versions of ElementTree (with cElementTree as accelerator +module) in the standard library of CPython 3.3.0. They were run +single-threaded on a 2.9GHz 64bit double core Intel i7 machine under +Ubuntu Linux 12.10 (Quantal). The C libraries were compiled with the +same platform specific optimisation flags. The Python interpreter was +also manually compiled for the platform. Note that many of the following +ElementTree timings are therefore better than what a normal Python +installation with the standard library (c)ElementTree modules would yield. +Note also that CPython 2.7 and 3.2+ come with a newer ElementTree version, +so older Python installations will not perform as good for (c)ElementTree, +and sometimes substantially worse.

+

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 was part of the standard library before Python 2.7/3.2), +lxml is still more than 10 times as fast as the much improved +ElementTree 1.3 in recent Python versions:

+
+lxe: tostring_utf16  (S-TR T1)    7.9958 msec/pass
+cET: tostring_utf16  (S-TR T1)   83.1358 msec/pass
+
+lxe: tostring_utf16  (UATR T1)    8.3222 msec/pass
+cET: tostring_utf16  (UATR T1)   84.4688 msec/pass
+
+lxe: tostring_utf16  (S-TR T2)    8.2297 msec/pass
+cET: tostring_utf16  (S-TR T2)   87.3415 msec/pass
+
+lxe: tostring_utf8   (S-TR T2)    6.5677 msec/pass
+cET: tostring_utf8   (S-TR T2)   76.2064 msec/pass
+
+lxe: tostring_utf8   (U-TR T3)    1.1952 msec/pass
+cET: tostring_utf8   (U-TR T3)   22.0058 msec/pass
+
+

The difference is somewhat smaller for plain text serialisation:

+
+lxe: tostring_text_ascii     (S-TR T1)    2.7738 msec/pass
+cET: tostring_text_ascii     (S-TR T1)    4.7629 msec/pass
+
+lxe: tostring_text_ascii     (S-TR T3)    0.8273 msec/pass
+cET: tostring_text_ascii     (S-TR T3)    1.5273 msec/pass
+
+lxe: tostring_text_utf16     (S-TR T1)    2.7659 msec/pass
+cET: tostring_text_utf16     (S-TR T1)   10.5038 msec/pass
+
+lxe: tostring_text_utf16     (U-TR T1)    2.8017 msec/pass
+cET: tostring_text_utf16     (U-TR T1)   10.5207 msec/pass
+
+

The tostring() function also supports serialisation to a Python +unicode string object, which is currently faster in ElementTree +under CPython 3.3:

+
+lxe: tostring_text_unicode   (S-TR T1)    2.6896 msec/pass
+cET: tostring_text_unicode   (S-TR T1)    1.0056 msec/pass
+
+lxe: tostring_text_unicode   (U-TR T1)    2.7366 msec/pass
+cET: tostring_text_unicode   (U-TR T1)    1.0154 msec/pass
+
+lxe: tostring_text_unicode   (S-TR T3)    0.7997 msec/pass
+cET: tostring_text_unicode   (S-TR T3)    0.3154 msec/pass
+
+lxe: tostring_text_unicode   (U-TR T4)    0.0048 msec/pass
+cET: tostring_text_unicode   (U-TR T4)    0.0160 msec/pass
+
+

For parsing, lxml.etree and cElementTree compete for the medal. +Depending on the input, either of the two can be faster. The (c)ET +libraries use a very thin layer on top of the expat parser, which is +known to be very fast. Here are some timings from the benchmarking +suite:

+
+lxe: parse_bytesIO   (SAXR T1)   13.0246 msec/pass
+cET: parse_bytesIO   (SAXR T1)    8.2929 msec/pass
+
+lxe: parse_bytesIO   (S-XR T3)    1.3542 msec/pass
+cET: parse_bytesIO   (S-XR T3)    2.4023 msec/pass
+
+lxe: parse_bytesIO   (UAXR T3)    7.5610 msec/pass
+cET: parse_bytesIO   (UAXR T3)   11.2455 msec/pass
+
+

And another couple of timings from a benchmark that Fredrik Lundh +used to promote cElementTree, comparing a number of different +parsers. First, parsing a 274KB XML file containing Shakespeare's +Hamlet:

+
+xml.etree.ElementTree.parse done in 0.017 seconds
+xml.etree.cElementTree.parse done in 0.007 seconds
+xml.etree.cElementTree.XMLParser.feed(): 6636 nodes read in 0.007 seconds
+lxml.etree.parse done in 0.003 seconds
+drop_whitespace.parse done in 0.003 seconds
+lxml.etree.XMLParser.feed(): 6636 nodes read in 0.004 seconds
+minidom tree read in 0.080 seconds
+
+

And a 3.4MB XML file containing the Old Testament:

+
+xml.etree.ElementTree.parse done in 0.038 seconds
+xml.etree.cElementTree.parse done in 0.030 seconds
+xml.etree.cElementTree.XMLParser.feed(): 25317 nodes read in 0.030 seconds
+lxml.etree.parse done in 0.016 seconds
+drop_whitespace.parse done in 0.015 seconds
+lxml.etree.XMLParser.feed(): 25317 nodes read in 0.022 seconds
+minidom tree read in 0.288 seconds
+
+

Here are the same benchmarks again, but including the memory usage +of the process in KB before and after parsing (using os.fork() to +make sure we start from a clean state each time). For the 274KB +hamlet.xml file:

+
+Memory usage: 7284
+xml.etree.ElementTree.parse done in 0.017 seconds
+Memory usage: 9432 (+2148)
+xml.etree.cElementTree.parse done in 0.007 seconds
+Memory usage: 9432 (+2152)
+xml.etree.cElementTree.XMLParser.feed(): 6636 nodes read in 0.007 seconds
+Memory usage: 9448 (+2164)
+lxml.etree.parse done in 0.003 seconds
+Memory usage: 11032 (+3748)
+drop_whitespace.parse done in 0.003 seconds
+Memory usage: 10224 (+2940)
+lxml.etree.XMLParser.feed(): 6636 nodes read in 0.004 seconds
+Memory usage: 11804 (+4520)
+minidom tree read in 0.080 seconds
+Memory usage: 12324 (+5040)
+
+

And for the 3.4MB Old Testament XML file:

+
+Memory usage: 10420
+xml.etree.ElementTree.parse done in 0.038 seconds
+Memory usage: 20660 (+10240)
+xml.etree.cElementTree.parse done in 0.030 seconds
+Memory usage: 20660 (+10240)
+xml.etree.cElementTree.XMLParser.feed(): 25317 nodes read in 0.030 seconds
+Memory usage: 20844 (+10424)
+lxml.etree.parse done in 0.016 seconds
+Memory usage: 27624 (+17204)
+drop_whitespace.parse done in 0.015 seconds
+Memory usage: 24468 (+14052)
+lxml.etree.XMLParser.feed(): 25317 nodes read in 0.022 seconds
+Memory usage: 29844 (+19424)
+minidom tree read in 0.288 seconds
+Memory usage: 28788 (+18368)
+
+

As can be seen from the sizes, both lxml.etree and cElementTree are +rather memory friendly compared to the pure Python libraries +ElementTree and (especially) minidom. Comparing to older CPython +versions, the memory footprint of the minidom library was considerably +reduced in CPython 3.3, by about a factor of 4 in this case.

+

For plain parser performance, lxml.etree and cElementTree tend to stay +rather close to each other, usually within a factor of two, with +winners well distributed over both sides. Similar timings can be +observed for the iterparse() function:

+
+lxe: iterparse_bytesIO   (SAXR T1)   17.9198 msec/pass
+cET: iterparse_bytesIO   (SAXR T1)   14.4982 msec/pass
+
+lxe: iterparse_bytesIO   (UAXR T3)    8.8522 msec/pass
+cET: iterparse_bytesIO   (UAXR T3)   12.9857 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_bytesIO   (S-TR T1)   19.8867 msec/pass
+cET: write_utf8_parse_bytesIO   (S-TR T1)   80.7259 msec/pass
+
+lxe: write_utf8_parse_bytesIO   (UATR T2)   23.7896 msec/pass
+cET: write_utf8_parse_bytesIO   (UATR T2)   98.0766 msec/pass
+
+lxe: write_utf8_parse_bytesIO   (S-TR T3)    3.0684 msec/pass
+cET: write_utf8_parse_bytesIO   (S-TR T3)   24.6122 msec/pass
+
+lxe: write_utf8_parse_bytesIO   (SATR T4)    0.3495 msec/pass
+cET: write_utf8_parse_bytesIO   (SATR T4)    1.9610 msec/pass
+
+

For applications that require a high parser throughput of large files, +and that do little to no serialization, both cET and lxml.etree are a +good choice. The cET library is particularly fast 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 is 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 +superior 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.0299 0.0343 0.0344 0.0293 0.0345 0.0342
+     T2: 0.0368 0.0423 0.0418 0.0427 0.0474 0.0459
+     T3: 0.0088 0.0084 0.0086 0.0251 0.0258 0.0261
+     T4: 0.0002 0.0002 0.0002 0.0005 0.0006 0.0006
+cET:       --     S-     U-     -A     SA     UA
+     T1: 0.0050 0.0045 0.0093 0.0044 0.0043 0.0043
+     T2: 0.0073 0.0075 0.0074 0.0201 0.0075 0.0074
+     T3: 0.0033 0.0213 0.0032 0.0034 0.0033 0.0035
+     T4: 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
+
+

The timings are somewhat close to each other, although cET can be +several times faster than lxml for larger trees. 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. ElementTree +represents the tree itself through these objects, which reduces +the overhead in creating them.

+
+

Child access

+

The same tree overhead makes operations like collecting children as in +list(element) more costly in lxml. Where 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.0038 msec/pass
+cET: root_list_children        (--TR T1)    0.0010 msec/pass
+
+lxe: root_list_children        (--TR T2)    0.0455 msec/pass
+cET: root_list_children        (--TR T2)    0.0050 msec/pass
+
+

This handicap is also visible when accessing single children:

+
+lxe: first_child               (--TR T2)    0.0424 msec/pass
+cET: first_child               (--TR T2)    0.0384 msec/pass
+
+lxe: last_child                (--TR T1)    0.0477 msec/pass
+cET: last_child                (--TR T1)    0.0467 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.0710 msec/pass
+cET: middle_child              (--TR T1)    0.0420 msec/pass
+
+lxe: middle_child              (--TR T2)    1.7393 msec/pass
+cET: middle_child              (--TR T2)    0.0396 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)    1.0045 msec/pass
+cET: create_elements           (--TC T2)    0.0753 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.0586 msec/pass
+cET: makeelement               (--TC T2)    0.1483 msec/pass
+
+lxe: create_subelements        (--TC T2)    0.8826 msec/pass
+cET: create_subelements        (--TC T2)    0.0827 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)    1.0812 msec/pass
+cET: append_from_document      (--TR T1,T2)    0.1104 msec/pass
+
+lxe: append_from_document      (--TR T3,T4)    0.0155 msec/pass
+cET: append_from_document      (--TR T3,T4)    0.0060 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)    3.9763 msec/pass
+cET: insert_from_document         (--TR T1,T2)    0.1459 msec/pass
+
+

or replacing the child slice by a newly created element:

+
+lxe: replace_children_element   (--TC T1)    0.0749 msec/pass
+cET: replace_children_element   (--TC T1)    0.0081 msec/pass
+
+

as opposed to replacing the slice with an existing element from the +same document:

+
+lxe: replace_children           (--TC T1)    0.0052 msec/pass
+cET: replace_children           (--TC T1)    0.0036 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. Note that Elements have a makeelement() +method that allows to create an Element within the same document, +thus avoiding the merge overhead when inserting it into that tree.

+
+
+

deepcopy

+

Deep copying a tree is fast in lxml:

+
+lxe: deepcopy_all              (--TR T1)    3.1650 msec/pass
+cET: deepcopy_all              (--TR T1)   53.9973 msec/pass
+
+lxe: deepcopy_all              (-ATR T2)    3.7365 msec/pass
+cET: deepcopy_all              (-ATR T2)   61.6267 msec/pass
+
+lxe: deepcopy_all              (S-TR T3)    0.7913 msec/pass
+cET: deepcopy_all              (S-TR T3)   13.6220 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 important area in XML processing 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, the .iter() +method is a good choice:

+
+lxe: iter_all             (--TR T1)    1.0529 msec/pass
+cET: iter_all             (--TR T1)    0.2635 msec/pass
+
+lxe: iter_islice          (--TR T2)    0.0110 msec/pass
+cET: iter_islice          (--TR T2)    0.0050 msec/pass
+
+lxe: iter_tag             (--TR T2)    0.0079 msec/pass
+cET: iter_tag             (--TR T2)    0.0112 msec/pass
+
+lxe: iter_tag_all         (--TR T2)    0.1822 msec/pass
+cET: iter_tag_all         (--TR T2)    0.5343 msec/pass
+
+

This translates directly into similar timings for Element.findall():

+
+lxe: findall              (--TR T2)    1.7176 msec/pass
+cET: findall              (--TR T2)    0.9973 msec/pass
+
+lxe: findall              (--TR T3)    0.3967 msec/pass
+cET: findall              (--TR T3)    0.2525 msec/pass
+
+lxe: findall_tag          (--TR T2)    0.2258 msec/pass
+cET: findall_tag          (--TR T2)    0.5770 msec/pass
+
+lxe: findall_tag          (--TR T3)    0.1085 msec/pass
+cET: findall_tag          (--TR T3)    0.1919 msec/pass
+
+

Note that all three libraries currently use the same Python +implementation for .findall(), except for their native tree +iterator (element.iter()). In general, lxml is very fast +for iteration, but loses ground against cET when many Elements +are found and need to be instantiated. So, the more selective +your search is, the faster lxml will run.

+
+
+
+

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)    0.3982 msec/pass
+lxe: xpath_method         (--TC T2)    7.8895 msec/pass
+lxe: xpath_method         (--TC T3)    0.0477 msec/pass
+lxe: xpath_method         (--TC T4)    0.3982 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.0713 msec/pass
+lxe: xpath_class          (--TC T2)    1.1325 msec/pass
+lxe: xpath_class          (--TC T3)    0.0215 msec/pass
+lxe: xpath_class          (--TC T4)    0.0722 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.1101 msec/pass
+lxe: xpath_element        (--TR T2)    2.0473 msec/pass
+lxe: xpath_element        (--TR T3)    0.0267 msec/pass
+lxe: xpath_element        (--TR T4)    0.1087 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   )    0.3884 msec/pass
+lxe: xpath_class_repeat           (--TC T2   )    7.6182 msec/pass
+lxe: xpath_class_repeat           (--TC T3   )    0.0465 msec/pass
+lxe: xpath_class_repeat           (--TC T4   )    0.3877 msec/pass
+
+

Note that tree iteration can be substantially faster than XPath if +your code short-circuits after the first couple of elements were +found. The XPath engine will always return the complete result set, +regardless of how much of it will actually be used.

+

Here is an example where only the first matching element is being +searched, a case for which XPath has syntax support as well:

+
+lxe: find_single                (--TR T2)    0.0184 msec/pass
+cET: find_single                (--TR T2)    0.0052 msec/pass
+
+lxe: iter_single                (--TR T2)    0.0024 msec/pass
+cET: iter_single                (--TR T2)    0.0007 msec/pass
+
+lxe: xpath_single               (--TR T2)    0.0033 msec/pass
+
+

When looking for the first two elements out of many, the numbers +explode for XPath, as restricting the result subset requires a +more complex expression:

+
+lxe: iterfind_two               (--TR T2)    0.0184 msec/pass
+cET: iterfind_two               (--TR T2)    0.0062 msec/pass
+
+lxe: iter_two                   (--TR T2)    0.0029 msec/pass
+cET: iter_two                   (--TR T2)    0.0017 msec/pass
+
+lxe: xpath_two                  (--TR T2)    0.2768 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 incredibly 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)    4.1828 msec/pass
+lxe: attribute                  (--TR T2)   17.3802 msec/pass
+lxe: attribute                  (--TR T4)    3.8657 msec/pass
+
+lxe: objectpath                 (--TR T1)    0.9289 msec/pass
+lxe: objectpath                 (--TR T2)   13.3109 msec/pass
+lxe: objectpath                 (--TR T4)    0.9289 msec/pass
+
+lxe: attributes_deep            (--TR T1)    6.2900 msec/pass
+lxe: attributes_deep            (--TR T2)   20.4713 msec/pass
+lxe: attributes_deep            (--TR T4)    6.1679 msec/pass
+
+lxe: objectpath_deep            (--TR T1)    1.3049 msec/pass
+lxe: objectpath_deep            (--TR T2)   14.0815 msec/pass
+lxe: objectpath_deep            (--TR T4)    1.3051 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)    3.1357 msec/pass
+lxe: attribute_cached           (--TR T2)   15.8911 msec/pass
+lxe: attribute_cached           (--TR T4)    2.9194 msec/pass
+
+lxe: attributes_deep_cached     (--TR T1)    3.8984 msec/pass
+lxe: attributes_deep_cached     (--TR T2)   16.8300 msec/pass
+lxe: attributes_deep_cached     (--TR T4)    3.6936 msec/pass
+
+lxe: objectpath_deep_cached     (--TR T1)    0.7496 msec/pass
+lxe: objectpath_deep_cached     (--TR T2)   12.3763 msec/pass
+lxe: objectpath_deep_cached     (--TR T4)    0.7427 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 descendants 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/resolvers.html b/doc/html/resolvers.html new file mode 100644 index 00000000..2a91be5a --- /dev/null +++ b/doc/html/resolvers.html @@ -0,0 +1,257 @@ + + + + + +Document loading and URL resolving + + + +
+

Document loading and URL resolving

+ + +

The normal way to load external entities (such as DTDs) is by using +XML catalogs. Lxml also has support for user provided document +loaders in both the parsers and XSL transformations. These so-called +resolvers are subclasses of the etree.Resolver class.

+
+

XML Catalogs

+

When loading an external entity for a document, e.g. a DTD, the parser +is normally configured to prevent network access (see the +no_network parser option). Instead, it will try to load the +entity from their local file system path or, in the most common case +that the entity uses a network URL as reference, from a local XML +catalog.

+

XML catalogs are the preferred and agreed-on mechanism to load +external entities from XML processors. Most tools will use them, so +it is worth configuring them properly on a system. Many Linux +installations use them by default, but on other systems they may need +to get enabled manually. The libxml2 site has some documentation +on how to set up XML catalogs

+
+
+

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 the 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 00000000..9ed54a2b --- /dev/null +++ b/doc/html/sax.html @@ -0,0 +1,131 @@ + + + + + +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 cannot 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/sitemap.html b/doc/html/sitemap.html new file mode 100644 index 00000000..6b006965 --- /dev/null +++ b/doc/html/sitemap.html @@ -0,0 +1,12 @@ + + + + + Sitemap of lxml.de - Processing XML and HTML with Python + + + + +

Sitemap of lxml.de - Processing XML and HTML with Python

+
+ \ No newline at end of file diff --git a/doc/html/tutorial.html b/doc/html/tutorial.html new file mode 100644 index 00000000..dc05f009 --- /dev/null +++ b/doc/html/tutorial.html @@ -0,0 +1,1194 @@ + + + + + +The lxml.etree Tutorial + + + + + + +
+

The lxml.etree Tutorial

+ +++ + + + +
Author:Stefan Behnel
+

This is a tutorial on XML processing with lxml.etree. It briefly +overviews the main concepts of the ElementTree API, 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 easy and straight forward, +elements mimic the behaviour of normal Python lists as closely as +possible:

+
>>> 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
+
+

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:

+
if root:   # this no longer works!
+    print("The root element has children")
+
+

This is no longer supported as people tend to expect that a "something" +evaluates to True and expect Elements to be "something", may they have +children or not. So, many users find it surprising that any Element +would evaluate to False in an if-statement like the above. Instead, +use len(element), which is both more explicit and less error prone.

+
>>> print(etree.iselement(root))  # test if it's some kind of Element
+True
+>>> if len(root):                 # test if it has children
+...     print("The root element has children")
+The root element has children
+
+

There is another important case where the behaviour of Elements in lxml +(in 2.0 and later) deviates from that of lists and from that of the +original ElementTree (prior to version 1.3 or Python 2.7/3.2):

+
>>> for child in root:
+...     print(child.tag)
+child0
+child1
+child2
+child3
+>>> root[0] = root[-1]  # this moves the element in lxml.etree!
+>>> for child in root:
+...     print(child.tag)
+child3
+child1
+child2
+
+

In this example, the last element is moved to a different position, +instead of being copied, i.e. it is automatically removed from its +previous position when it is put in a different place. In lists, +objects can appear in multiple positions at the same time, and the +above assignment would just copy the item reference into the first +position, so that both contain the exact same item:

+
>>> l = [0, 1, 2, 3]
+>>> l[0] = l[-1]
+>>> l
+[3, 1, 2, 3]
+
+

Note that in the original ElementTree, a single Element object can sit +in any number of places in any number of trees, which allows for the same +copy operation as with lists. The obvious drawback is that modifications +to such an Element will apply to all places where it appears in a tree, +which may or may not be intended.

+

The upside of this difference is that an Element in lxml.etree always +has exactly one parent, which can be queried through the getparent() +method. This is not supported in the original ElementTree.

+
>>> root is root[0].getparent()  # lxml.etree only!
+True
+
+

If you want to copy an element to a different position in lxml.etree, +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 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 as a dict

+

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"/>'
+
+

Attributes are just unordered name-value pairs, so a very convenient way +of dealing with them is through the dictionary-like interface of Elements:

+
>>> print(root.get("interesting"))
+totally
+
+>>> print(root.get("hello"))
+None
+>>> root.set("hello", "Huhu")
+>>> print(root.get("hello"))
+Huhu
+
+>>> etree.tostring(root)
+b'<root interesting="totally" hello="Huhu"/>'
+
+>>> sorted(root.keys())
+['hello', 'interesting']
+
+>>> for name, value in sorted(root.items()):
+...     print('%s = %r' % (name, value))
+hello = 'Huhu'
+interesting = 'totally'
+
+

For the cases where you want to do item lookup or have other reasons for +getting a 'real' dictionary-like object, e.g. for passing it around, +you can use the attrib property:

+
>>> attributes = root.attrib
+
+>>> print(attributes["interesting"])
+totally
+>>> print(attributes.get("no-such-attribute"))
+None
+
+>>> attributes["hello"] = "Guten Tag"
+>>> print(attributes["hello"])
+Guten Tag
+>>> print(root.get("hello"))
+Guten Tag
+
+

Note that attrib is a dict-like object backed by the Element itself. +This means that any changes to the Element are reflected in attrib +and vice versa. It also means that the XML tree stays alive in memory +as long as the attrib of one of its Elements is in use. To get an +independent snapshot of the attributes that does not depend on the XML +tree, copy it into a dict:

+
>>> d = dict(root.attrib)
+>>> sorted(d.items())
+[('hello', 'Guten Tag'), ('interesting', 'totally')]
+
+
+
+

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. Starting with lxml 3.0, you can also +pass more than one tag to intercept on multiple tags during iteration.

+
>>> for element in root.iter("child"):
+...     print("%s - %s" % (element.tag, element.text))
+child - Child 1
+child - Child 2
+
+>>> for element in root.iter("another", "child"):
+...     print("%s - %s" % (element.tag, element.text))
+child - Child 1
+child - Child 2
+another - Child 3
+
+

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):  # or 'str' in Python 3
+...         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;
+
+

Note that passing a wildcard "*" tag name will also yield all +Element nodes (and only elements).

+

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.

+

In lxml 2.0 and later (as well as 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 = next(root.iter('br'))  # get first result of iteration
+>>> 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 name 'unicode' 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 serialisation and +general document handling.

+
>>> root = etree.XML('''\
+... <?xml version="1.0"?>
+... <!DOCTYPE root SYSTEM "test" [ <!ENTITY tasty "parsnips"> ]>
+... <root>
+...   <a>&tasty;</a>
+... </root>
+... ''')
+
+>>> tree = etree.ElementTree(root)
+>>> print(tree.docinfo.xml_version)
+1.0
+>>> print(tree.docinfo.doctype)
+<!DOCTYPE root SYSTEM "test">
+
+>>> tree.docinfo.public_id = '-//W3C//DTD XHTML 1.0 Transitional//EN'
+>>> tree.docinfo.system_url = 'file://local.dtd'
+>>> print(tree.docinfo.doctype)
+<!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "file://local.dtd">
+
+

An ElementTree is also what you get back when you call the +parse() function to parse files or file-like objects (see the +parsing section below).

+

One of the important differences is that the ElementTree class +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:

+
>>> print(etree.tostring(tree))  # lxml 1.3.4 and later
+<!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "file://local.dtd" [
+<!ENTITY tasty "parsnips">
+]>
+<root>
+  <a>parsnips</a>
+</root>
+
+

In the original xml.etree.ElementTree implementation and in lxml +up to 1.3.3, the output looks the same as when serialising only +the root Element:

+
>>> print(etree.tostring(tree.getroot()))
+<root>
+  <a>parsnips</a>
+</root>
+
+

This serialisation behaviour has changed in lxml 1.3.4. Before, +the tree was serialised without DTD content, which made lxml +lose 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>'
+
+

There is also a corresponding function HTML() for HTML literals.

+
>>> root = etree.HTML("<p>data</p>")
+>>> etree.tostring(root)
+b'<html><body><p>data</p></body></html>'
+
+
+
+

The parse() function

+

The parse() function is used to parse from files and file-like objects.

+

As an example of such a file-like object, the following code uses the +BytesIO class for reading from a string instead of an external file. +That class comes from the io module in Python 2.6 and later. In older +Python versions, you will have to use the StringIO class from the +StringIO module. However, in real life, you would obviously avoid +doing this all together and use the string parsing functions above.

+
>>> from io import BytesIO
+>>> some_file_or_file_like_object = BytesIO(b"<root>data</root>")
+
+>>> tree = etree.parse(some_file_or_file_like_object)
+
+>>> 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 (make sure to open it in binary mode)
  • +
  • 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 or file-like object. However, the HTTP/FTP client in libxml2 +is rather simple, so things like HTTP authentication require a dedicated +URL request library, e.g. urllib2 or requests. These libraries +usually provide a file-like object for the result that you can parse +from while the response is streaming in.

+
+
+

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 new 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 = BytesIO(b"<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 = BytesIO(b"<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 present +yet when receiving the start event. Only the end event guarantees +that the Element has been parsed completely.

+

It also allows you 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. The keep_tail=True argument to .clear() makes sure that +(tail) text content that follows the current element will not be touched. +It is highly discouraged to modify any content that the parser may not +have completely read through yet.

+
>>> some_file_like = BytesIO(
+...     b"<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(keep_tail=True)
+data
+** cleaning up the subtree
+None
+** cleaning up the subtree
+
+

A very important use case for iterparse() is parsing large +generated XML files, e.g. database dumps. Most often, these XML +formats only have one main data item element that hangs directly below +the root node and that is repeated thousands of times. In this case, +it is best practice to let lxml.etree do the tree building and only to +intercept on exactly this one Element, using the normal tree API +for data extraction.

+
>>> xml_file = BytesIO(b'''\
+... <root>
+...   <a><b>ABC</b><c>abc</c></a>
+...   <a><b>MORE DATA</b><c>more data</c></a>
+...   <a><b>XYZ</b><c>xyz</c></a>
+... </root>''')
+
+>>> for _, element in etree.iterparse(xml_file, tag='a'):
+...     print('%s -- %s' % (element.findtext('b'), element[1].text))
+...     element.clear(keep_tail=True)
+ABC -- abc
+MORE DATA -- more data
+XYZ -- xyz
+
+

If, for some reason, 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() method 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 namespace (the URI) 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>
+
+

The notation that ElementTree uses was originally brought up by +James Clark. It has the major +advantage of providing a universally qualified name for a tag, regardless +of any prefixes that may or may not have been used or defined in a document. +By moving the indirection of prefixes out of the way, it makes namespace +aware code much clearer and easier to get right.

+

As you can see from the example, prefixes only become important when +you serialise the result. However, the above code looks 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 function, 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>
+
+

You can also use the QName helper class to build or split qualified +tag names:

+
>>> tag = etree.QName('http://www.w3.org/1999/xhtml', 'html')
+>>> print(tag.localname)
+html
+>>> print(tag.namespace)
+http://www.w3.org/1999/xhtml
+>>> print(tag.text)
+{http://www.w3.org/1999/xhtml}html
+
+>>> tag = etree.QName('{http://www.w3.org/1999/xhtml}html')
+>>> print(tag.localname)
+html
+>>> print(tag.namespace)
+http://www.w3.org/1999/xhtml
+
+>>> root = etree.Element('{http://www.w3.org/1999/xhtml}html')
+>>> tag = etree.QName(root)
+>>> print(tag.localname)
+html
+
+>>> tag = etree.QName(root, 'script')
+>>> print(tag.text)
+{http://www.w3.org/1999/xhtml}script
+>>> tag = etree.QName('{http://www.w3.org/1999/xhtml}html', 'script')
+>>> print(tag.text)
+{http://www.w3.org/1999/xhtml}script
+
+

lxml.etree allows you to look up the current namespaces defined for a +node through the .nsmap property:

+
>>> xhtml.nsmap
+{None: 'http://www.w3.org/1999/xhtml'}
+
+

Note, however, that this includes all prefixes known in the context of +an Element, not only those that it defines itself.

+
>>> root = etree.Element('root', nsmap={'a': 'http://a.b/c'})
+>>> child = etree.SubElement(root, 'child',
+...                          nsmap={'b': 'http://b.c/d'})
+>>> len(root.nsmap)
+1
+>>> len(child.nsmap)
+2
+>>> child.nsmap['a']
+'http://a.b/c'
+>>> child.nsmap['b']
+'http://b.c/d'
+
+

Therefore, modifying the returned dict cannot have any meaningful +impact on the Element. Any changes to it are ignored.

+

Namespaces on attributes work alike, but as of version 2.3, lxml.etree +will ensure that the attribute uses a prefixed namespace +declaration. This is because unprefixed attribute names are not +considered being in a namespace by the XML namespace specification +(section 6.2), so they may end up losing their namespace on a +serialise-parse roundtrip, even if they appear in a namespaced +element.

+
>>> body.set(XHTML + "bgcolor", "#CCFFAA")
+
+>>> print(etree.tostring(xhtml, pretty_print=True))
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <body xmlns:html="http://www.w3.org/1999/xhtml" html:bgcolor="#CCFFAA">Hello World</body>
+</html>
+
+>>> print(body.get("bgcolor"))
+None
+>>> body.get(XHTML + "bgcolor")
+'#CCFFAA'
+
+

You can also use XPath with fully qualified names:

+
>>> 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
+
+

For convenience, you can use "*" wildcards in all iterators of lxml.etree, +both for tag names and namespaces:

+
>>> for el in xhtml.iter('*'): print(el.tag)   # any element
+{http://www.w3.org/1999/xhtml}html
+{http://www.w3.org/1999/xhtml}body
+>>> for el in xhtml.iter('{http://www.w3.org/1999/xhtml}*'): print(el.tag)
+{http://www.w3.org/1999/xhtml}html
+{http://www.w3.org/1999/xhtml}body
+>>> for el in xhtml.iter('{*}body'): print(el.tag)
+{http://www.w3.org/1999/xhtml}body
+
+

To look for elements that do not have a namespace, either use the +plain tag name or provide the empty namespace explicitly:

+
>>> [ el.tag for el in xhtml.iter('{http://www.w3.org/1999/xhtml}body') ]
+['{http://www.w3.org/1999/xhtml}body']
+>>> [ el.tag for el in xhtml.iter('body') ]
+[]
+>>> [ el.tag for el in xhtml.iter('{}body') ]
+[]
+>>> [ el.tag for el in xhtml.iter('{}*') ]
+[]
+
+
+
+

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 reserved 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 reserved characters: &lt;spam&amp;egg&gt;.</p>
+    <p>And finally an embedded XHTML fragment.</p>
+  </body>
+</html>
+
+

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.

+

When dealing with multiple namespaces, it is good practice to define +one ElementMaker for each namespace URI. Again, note how the above +example predefines the tag builders in named constants. That makes it +easy to put all tag declarations of a namespace into one Python module +and to import/use the tag name constants from there. This avoids +pitfalls like typos or accidentally missing namespaces.

+
+
+

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]"))
+[]
+
+

In lxml 3.4, there is a new helper to generate a structural ElementPath +expression for an Element:

+
>>> tree = etree.ElementTree(root)
+>>> a = root[0]
+>>> print(tree.getelementpath(a[0]))
+a/b[1]
+>>> print(tree.getelementpath(a[1]))
+a/c
+>>> print(tree.getelementpath(a[2]))
+a/b[2]
+>>> tree.find(tree.getelementpath(a[2])) == a[2]
+True
+
+

As long as the tree is not modified, this path expression represents an +identifier for a given element that can be used to find() it in the same +tree later. Compared to XPath, ElementPath expressions have the advantage +of being self-contained even for documents that use namespaces.

+

The .iter() method is a special case that only finds specific tags +in the tree by their name, not based on a path. That means that the +following commands are equivalent in the success case:

+
>>> print(root.find(".//b").tag)
+b
+>>> print(next(root.iterfind(".//b")).tag)
+b
+>>> print(next(root.iter("b")).tag)
+b
+
+

Note that the .find() method simply returns None if no match is found, +whereas the other two examples would raise a StopIteration exception.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/validation.html b/doc/html/validation.html new file mode 100644 index 00000000..10d2844c --- /dev/null +++ b/doc/html/validation.html @@ -0,0 +1,563 @@ + + + + + +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.

+

lxml also provides support for ISO-Schematron, based on the pure-XSLT +skeleton implementation of Schematron:

+

There is also basic support for pre-ISO-Schematron through the libxml2 +Schematron features. However, this 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 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)  # doctest: +ELLIPSIS
+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")
+
+

The DTD information is available as attributes on the DTD object. The method +iterelements provides an iterator over the element declarations:

+
>>> dtd = etree.DTD(StringIO('<!ELEMENT a EMPTY><!ELEMENT b EMPTY>'))
+>>> for el in dtd.iterelements():
+...     print(el.name)
+a
+b
+
+

The method elements returns the element declarations as a list:

+
>>> dtd = etree.DTD(StringIO('<!ELEMENT a EMPTY><!ELEMENT b EMPTY>'))
+>>> len(dtd.elements())
+2
+
+

An element declaration object provides the following attributes/methods:

+
+
    +
  • name: The name of the element;
  • +
  • type: The element type, one of "undefined", "empty", "any", "mixed", or "element";
  • +
  • content: Element content declaration (see below);
  • +
  • iterattributes(): Return an iterator over attribute declarations (see below);
  • +
  • attributes(): Return a list of attribute declarations.
  • +
+
+

The content attribute contains information about the content model of the element. +These element content declaration objects form a binary tree (via the left and right +attributes), that makes it possible to reconstruct the content model expression. Here's a +list of all attributes:

+
+
    +
  • name: If this object represents an element in the content model expression, +name is the name of the element, otherwise it is None;
  • +
  • type: The type of the node: one of "pcdata", "element", "seq", or "or";
  • +
  • occur: How often this element (or this combination of elements) may occur: +one of "once", "opt", "mult", or "plus"
  • +
  • left: The left hand subexpression
  • +
  • right: The right hand subexpression
  • +
+
+

For example, the element declaration <!ELEMENT a (a|b)+> results +in the following element content declaration objects:

+
>>> dtd = etree.DTD(StringIO('<!ELEMENT a (a|b)+>'))
+>>> content = dtd.elements()[0].content
+>>> content.type, content.occur, content.name
+('or', 'plus', None)
+
+>>> left, right = content.left, content.right
+>>> left.type, left.occur, left.name
+('element', 'once', 'a')
+>>> right.type, right.occur, right.name
+('element', 'once', 'b')
+
+

Attributes declarations have the following attributes/methods:

+
+
    +
  • name: The name of the attribute;
  • +
  • elemname: The name of the element the attribute belongs to;
  • +
  • type: The attribute type, one of "cdata", "id", "idref", "idrefs", "entity", +"entities", "nmtoken", "nmtokens", "enumeration", or "notation";
  • +
  • default: The type of the default value, one of "none", "required", "implied", +or "fixed";
  • +
  • defaultValue: The default value;
  • +
  • itervalues(): Return an iterator over the allowed attribute values (if the attribute +is of type "enumeration");
  • +
  • values(): Return a list of allowed attribute values.
  • +
+
+

Entity declarations are available via the iterentities and entities methods:

+
+
+>>> dtd = etree.DTD(StringIO('<!ENTITY hurz "&#x40;">'))
+>>> entity = dtd.entities()[0]
+>>> entity.name, entity.orig, entity.content
+('hurz', '&#x40;', '@')
+
+
+
+
+

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, if rnc2rng is installed, lxml 3.6 and later can use it +internally to parse the input schema. It recognises the .rnc file +extension and also allows parsing an RNC schema from a string using +RelaxNG.from_rnc_string().

+

Alternatively, 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

+

From version 2.3 on lxml features ISO-Schematron support built on the +de-facto reference implementation of Schematron, the pure-XSLT-1.0 +skeleton implementation. This is provided by the lxml.isoschematron package +that implements the Schematron class, with an API compatible to the other +validators'. Pass an Element or ElementTree object to construct a Schematron +validator:

+
>>> from lxml import isoschematron
+>>> f = StringIO('''\
+... <schema xmlns="http://purl.oclc.org/dsdl/schematron" >
+...   <pattern id="sum_equals_100_percent">
+...     <title>Sum equals 100%.</title>
+...     <rule context="Total">
+...       <assert test="sum(//Percent)=100">Sum is not 100%.</assert>
+...     </rule>
+...   </pattern>
+... </schema>
+... ''')
+
+>>> sct_doc = etree.parse(f)
+>>> schematron = isoschematron.Schematron(sct_doc)
+
+

You can then validate some ElementTree document with this. Just like with +XMLSchema or 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 can be useful for conditional statements:

+
>>> is_valid = isoschematron.Schematron(sct_doc)
+
+>>> if not is_valid(doc):
+...     print("invalid!")
+invalid!
+
+

Built on a pure-xslt implementation, the actual validator is created as an +XSLT 1.0 stylesheet using these steps:

+
    +
  1. (Extract embedded Schematron from XML Schema or RelaxNG schema)
  2. +
  3. Process inclusions
  4. +
  5. Process abstract patterns
  6. +
  7. Compile the schematron schema to XSLT
  8. +
+

To allow more control over the individual steps, isoschematron.Schematron +supports an extended API:

+

The include and expand keyword arguments can be used to switch off +steps 1) and 2).

+

To set parameters for steps 1), 2) and 3) dictionaries containing parameters +for XSLT can be provided using the keyword arguments include_params, +expand_params or compile_params. Schematron automatically converts these +parameters to stylesheet parameters so you need not worry to set string +parameters using quotes or to use XSLT.strparam(). If you ever need to pass an +XPath as argument to the XSLT stylesheet you can pass in an etree.XPath object +(see XPath and XSLT with lxml: Stylesheet-parameters for background on this).

+

The phase parameter of the compile step is additionally exposed as a keyword +argument. If set, it overrides occurrence in compile_params. Note that +isoschematron.Schematron might expose more common parameters as additional keyword +args in the future.

+

By setting store_schematron to True, the (included-and-expanded) schematron +document tree is stored and made available through the schematron property.

+

Similarly, setting store_xslt to True will result in the validation XSLT +document tree being kept; it can be retrieved through the validator_xslt +property.

+

Finally, with store_report set to True (default: False), the resulting +validation report document gets stored and can be accessed as the +validation_report property.

+

Using the phase parameter of isoschematron.Schematron allows for selective +validation of predefined pattern groups:

+
>>> f = StringIO('''\
+... <schema xmlns="http://purl.oclc.org/dsdl/schematron" >
+...   <phase id="phase.sum_check">
+...     <active pattern="sum_equals_100_percent"/>
+...   </phase>
+...   <phase id="phase.entries_check">
+...     <active pattern="all_positive"/>
+...   </phase>
+...   <pattern id="sum_equals_100_percent">
+...     <title>Sum equals 100%.</title>
+...     <rule context="Total">
+...       <assert test="sum(//Percent)=100">Sum is not 100%.</assert>
+...     </rule>
+...   </pattern>
+...   <pattern id="all_positive">
+...     <title>All entries must be positive.</title>
+...     <rule context="Percent">
+...       <assert test="number(.)>0">Number (<value-of select="."/>) not positive</assert>
+...     </rule>
+...   </pattern>
+... </schema>
+... ''')
+
+>>> sct_doc = etree.parse(f)
+>>> schematron = isoschematron.Schematron(sct_doc)
+
+>>> valid = StringIO('''\
+... <Total>
+...   <Percent>20</Percent>
+...   <Percent>30</Percent>
+...   <Percent>50</Percent>
+... </Total>
+... ''')
+
+>>> doc = etree.parse(valid)
+>>> schematron.validate(doc)
+True
+
+>>> invalid_positive = StringIO('''\
+... <Total>
+...   <Percent>0</Percent>
+...   <Percent>50</Percent>
+...   <Percent>50</Percent>
+... </Total>
+... ''')
+
+>>> doc = etree.parse(invalid_positive)
+
+>>> schematron.validate(doc)
+False
+
+

If the constraint of Percent entries being positive is not of interest in a +certain validation scenario, it can now be disabled:

+
>>> selective = isoschematron.Schematron(sct_doc, phase="phase.sum_check")
+>>> selective.validate(doc)
+True
+
+

The usage of validation phases is a unique feature of ISO-Schematron and can be +a very powerful tool e.g. for establishing validation stages or to provide +different validators for different "validation audiences".

+
+
+

(Pre-ISO-Schematron)

+

Since version 2.0, lxml.etree features pre-ISO-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 00000000..f6dc5230 --- /dev/null +++ b/doc/html/xpathxslt.html @@ -0,0 +1,639 @@ + + + + + +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!
+
+
+
+

Namespaces and prefixes

+

If your XPath expression uses namespace prefixes, you must define them +in a prefix mapping. To this end, pass a dictionary to the +namespaces keyword argument that maps 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('/x:foo/b:bar',
+...               namespaces={'x': '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'
+
+

The prefixes you choose here are not linked to the prefixes used +inside the XML document. The document may define whatever prefixes it +likes, including the empty prefix, without breaking the above code.

+

Note that XPath does not have a notion of a default namespace. The +empty prefix is therefore undefined for XPath and cannot be used in +namespace prefix mappings.

+

There is also an optional extensions argument which is used to +define custom extension functions in Python that are local to this +evaluation. The namespace prefixes that they use in the XPath +expression must also be defined in the namespace prefix mapping.

+
+
+

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
+
+
+
+

Regular expressions in XPath

+

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 or Element object to construct an XSLT +transformer:

+
>>> xslt_root = etree.XML('''\
+... <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>''')
+>>> transform = etree.XSLT(xslt_root)
+
+

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:

+
>>> root = etree.XML('<a><b>Text</b></a>')
+>>> result = transform(root)
+
+>>> 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
+
+

While it is possible to use the .write() method (known from ElementTree +objects) to serialise the XSLT result into a file, it is better to use the +.write_output() method. The latter knows about the <xsl:output> tag +and writes the expected data into the output file.

+
>>> xslt_root = etree.XML('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:output method="text" encoding="utf8" />
+...     <xsl:template match="/">
+...         <foo><xsl:value-of select="/a/b/text()" /></foo>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+>>> transform = etree.XSLT(xslt_root)
+
+>>> result = transform(doc)
+>>> result.write_output("output.txt.gz", compression=9)    # doctest: +SKIP
+
+
+
+>>> from io import BytesIO
+>>> out = BytesIO()
+>>> result.write_output(out)
+>>> data = out.getvalue()
+>>> b'Text' in data
+True
+
+
+
+
+

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)
+>>> doc_root = etree.XML('<a><b>Text</b></a>')
+
+

The parameters are passed as keyword parameters to the transform call. +First, let's try passing in a simple integer expression:

+
>>> result = transform(doc_root, 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_root, a="/a/b/text()")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+

It's also possible to pass an XPath object as a parameter:

+
>>> result = transform(doc_root, a=etree.XPath("/a/b/text()"))
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+

Passing a string expression looks like this:

+
>>> result = transform(doc_root, 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_root, a=plain_string_value)
+>>> str(result)
+'<?xml version="1.0"?>\n<foo> It\'s "Monty Python" </foo>\n'
+
+

If you need to pass parameters that are not legal Python identifiers, +pass them inside of a dictionary:

+
>>> transform = etree.XSLT(etree.XML('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:param name="non-python-identifier" />
+...     <xsl:template match="/">
+...         <foo><xsl:value-of select="$non-python-identifier" /></foo>
+...     </xsl:template>
+... </xsl:stylesheet>'''))
+
+>>> result = transform(doc_root, **{'non-python-identifier': '5'})
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>5</foo>\n'
+
+
+
+

Errors and messages

+

Like most of the processing oriented objects in lxml.etree, XSLT +provides an error log that lists messages and error output from the +last run. See the parser documentation for a description of the +error log.

+
>>> xslt_root = etree.XML('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:template match="/">
+...         <xsl:message terminate="no">STARTING</xsl:message>
+...         <foo><xsl:value-of select="/a/b/text()" /></foo>
+...         <xsl:message terminate="no">DONE</xsl:message>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+>>> transform = etree.XSLT(xslt_root)
+
+>>> doc_root = etree.XML('<a><b>Text</b></a>')
+>>> result = transform(doc_root)
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+>>> print(transform.error_log)
+<string>:0:0:ERROR:XSLT:ERR_OK: STARTING
+<string>:0:0:ERROR:XSLT:ERR_OK: DONE
+
+>>> for entry in transform.error_log:
+...     print('message from line %s, col %s: %s' % (
+...                entry.line, entry.column, entry.message))
+...     print('domain: %s (%d)' % (entry.domain_name, entry.domain))
+...     print('type: %s (%d)' % (entry.type_name, entry.type))
+...     print('level: %s (%d)' % (entry.level_name, entry.level))
+...     print('filename: %s' % entry.filename)
+message from line 0, col 0: STARTING
+domain: XSLT (22)
+type: ERR_OK (0)
+level: ERROR (2)
+filename: <string>
+message from line 0, col 0: DONE
+domain: XSLT (22)
+type: ERR_OK (0)
+level: ERROR (2)
+filename: <string>
+
+

Note that there is no way in XSLT to distinguish between user +messages, warnings and error messages that occurred during the +run. libxslt simply does not provide this information. You can +partly work around this limitation by making your own messages +uniquely identifiable, e.g. with a common text prefix.

+
+
+

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 +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/main.txt b/doc/main.txt index df34df4c..a4caca16 100644 --- a/doc/main.txt +++ b/doc/main.txt @@ -7,7 +7,7 @@ lxml .. class:: pagequote -| `» lxml takes all the pain out of XML. « `_ +| `» lxml takes all the pain out of XML. « `_ | Stephan Richter .. class:: eyecatcher @@ -159,8 +159,8 @@ Index `_ (PyPI). It has the source that compiles on various platforms. The source distribution is signed with `this key `_. -The latest version is `lxml 4.4.2`_, released 2019-11-25 -(`changes for 4.4.2`_). `Older versions <#old-versions>`_ +The latest version is `lxml 4.4.3`_, released 2020-01-28 +(`changes for 4.4.3`_). `Older versions <#old-versions>`_ are listed below. Please take a look at the @@ -254,7 +254,9 @@ See the websites of lxml .. and the `latest in-development version `_. -.. _`PDF documentation`: lxmldoc-4.4.2.pdf +.. _`PDF documentation`: lxmldoc-4.4.3.pdf + +* `lxml 4.4.3`_, released 2020-01-28 (`changes for 4.4.3`_) * `lxml 4.4.2`_, released 2019-11-25 (`changes for 4.4.2`_) @@ -276,6 +278,7 @@ See the websites of lxml * `older releases `_ +.. _`lxml 4.4.3`: /files/lxml-4.4.3.tgz .. _`lxml 4.4.2`: /files/lxml-4.4.2.tgz .. _`lxml 4.4.1`: /files/lxml-4.4.1.tgz .. _`lxml 4.4.0`: /files/lxml-4.4.0.tgz @@ -286,6 +289,7 @@ See the websites of lxml .. _`lxml 4.3.1`: /files/lxml-4.3.1.tgz .. _`lxml 4.3.0`: /files/lxml-4.3.0.tgz +.. _`changes for 4.4.3`: /changes-4.4.3.html .. _`changes for 4.4.2`: /changes-4.4.2.html .. _`changes for 4.4.1`: /changes-4.4.1.html .. _`changes for 4.4.0`: /changes-4.4.0.html diff --git a/doc/pdf/pubkey.asc b/doc/pdf/pubkey.asc new file mode 100644 index 00000000..f72804c9 --- /dev/null +++ b/doc/pdf/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/s5/lxml-ep2008.html b/doc/s5/lxml-ep2008.html new file mode 100644 index 00000000..07b20720 --- /dev/null +++ b/doc/s5/lxml-ep2008.html @@ -0,0 +1,1357 @@ + + + + + + + +Implementing XML languages with lxml + + + + + + + + + + + + +
+
+
+ + +
+
+
+

Implementing XML languages with lxml

+

Dr. Stefan Behnel

+ +

http://codespeak.net/lxml/

+

lxml-dev@codespeak.net

+tagpython.png + + + + + + + + + + +
+
+

What is an »XML language«?

+
    +
  • a language in XML notation
  • +
  • aka »XML dialect«
      +
    • except that it's not a dialect
    • +
    +
  • +
  • Examples:
      +
    • XML Schema
    • +
    • Atom/RSS
    • +
    • (X)HTML
    • +
    • Open Document Format
    • +
    • SOAP
    • +
    • ... add your own one here
    • +
    +
  • +
+
+ + +
+

Popular mistakes to avoid (2)

+

"This is tree data, I'll take the DOM!"

+
    +
  • DOM is ubiquitous, but it's as complicated as Java
  • +
  • uglify your application with tons of DOM code to
      +
    • walk over non-element nodes to find the data you need
    • +
    • convert text content to other data types
    • +
    • modify the XML tree in memory
    • +
    +
  • +
+

=> write verbose, redundant, hard-to-maintain code

+
+ +
+

Popular mistakes to avoid (3)

+

"SAX is so fast and consumes no memory!"

+
    +
  • but writing SAX code is not fast!
  • +
  • write error-prone, state-keeping SAX code to
      +
    • figure out where you are
    • +
    • find the sections you need
    • +
    • convert text content to other data types
    • +
    • copy the XML data into custom data classes
    • +
    • ... and don't forget the way back into XML!
    • +
    +
  • +
+

=> write confusing state-machine code

+

=> debugging into existence

+
+
+

Working with XML

+
+

Getting XML work done

+

(instead of getting time wasted)

+
+
+
+

How can you work with XML?

+
    +
  • Preparation:
      +
    • Implement usable data classes as an abstraction layer
    • +
    • Implement a mapping from XML to the data classes
    • +
    • Implement a mapping from the data classes to XML
    • +
    +
  • +
  • Workflow:
      +
    • parse XML data
    • +
    • map XML data to data classes
    • +
    • work with data classes
    • +
    • map data classes to XML
    • +
    • serialise XML
    • +
    +
  • +
+
    +
  • Approach:
      +
    • get rid of XML and do everything in your own code
    • +
    +
  • +
+
+
+

What if you could simplify this?

+
    +
  • Preparation:
      +
    • Extend usable XML API classes into an abstraction layer
    • +
    +
  • +
  • Workflow:
      +
    • parse XML data into XML API classes
    • +
    • work with XML API classes
    • +
    • serialise XML
    • +
    +
  • +
+
    +
  • Approach:
      +
    • cover only the quirks of XML and make it work for you
    • +
    +
  • +
+
+
+

What if you could simplify this ...

+
    +
  • ... without sacrificing usability or flexibility?
  • +
  • ... using a high-speed, full-featured, pythonic XML toolkit?
  • +
  • ... with the power of XPath, XSLT and XML validation?
  • +
+

... then »lxml« is your friend!

+
+
+

Overview

+
    +
  • What is lxml?
      +
    • what & who
    • +
    +
  • +
  • How do you use it?
      +
    • Lesson 0: quick API overview
        +
      • ElementTree concepts and lxml features
      • +
      +
    • +
    • Lesson 1: parse XML
        +
      • how to get XML data into memory
      • +
      +
    • +
    • Lesson 2: generate XML
        +
      • how to write an XML generator for a language
      • +
      +
    • +
    • Lesson 3: working with XML trees made easy
        +
      • how to write an XML API for a language
      • +
      +
    • +
    +
  • +
+
+
+

What is lxml?

+
    +
  • a fast, full-featured toolkit for XML and HTML handling +
  • +
  • based on and inspired by
      +
    • the C libraries libxml2 and libxslt (by Daniel Veillard)
    • +
    • the ElementTree API (by Fredrik Lundh)
    • +
    • the Cython compiler (by Robert Bradshaw, Greg Ewing & me)
    • +
    • the Python language (by Guido & [paste Misc/ACKS here])
    • +
    • user feedback, ideas and patches (by you!)
        +
      • keep doing that, we love you all!
      • +
      +
    • +
    +
  • +
  • maintained (and major parts) written by myself
      +
    • initial design and implementation by Martijn Faassen
    • +
    • extensive HTML API and tools by Ian Bicking
    • +
    +
  • +
+
+
+

What do you get for your money?

+
    +
  • many tools in one:
      +
    • Generic, ElementTree compatible XML API: lxml.etree
        +
      • but faster for many tasks and much more feature-rich
      • +
      +
    • +
    • Special tool set for HTML handling: lxml.html
    • +
    • Special API for pythonic data binding: lxml.objectify
    • +
    • General purpose path languages: XPath and CSS selectors
    • +
    • Validation: DTD, XML Schema, RelaxNG, Schematron
    • +
    • XSLT, XInclude, C14N, ...
    • +
    • Fast tree iteration, event-driven parsing, ...
    • +
    +
  • +
  • it's free, but it's worth every €-Cent!
      +
    • what users say:
        +
      • »no qualification, I would recommend lxml for just about any +HTML task«
      • +
      • »THE tool [...] for newbies and experienced developers«
      • +
      • »you can do pretty much anything with an intuitive API«
      • +
      • »lxml takes all the pain out of XML«
      • +
      +
    • +
    +
  • +
+
+
+

Lesson 0: a quick overview

+
+

why »lxml takes all the pain out of XML«

+

(a quick overview of lxml features and ElementTree concepts)

+
+ +
+
+

Namespaces in ElementTree

+
    +
  • uses Clark notation:

    +
      +
    • wrap namespace URI in {...}
    • +
    • append the tag name
    • +
    +
    >>> tag = "{http://www.w3.org/the/namespace}tagname"
    +>>> element = etree.Element(tag)
    +
    +
  • +
  • no prefixes!

    +
  • +
  • a single, self-containing tag identifier

    +
  • +
+
+
+

Text content in ElementTree

+
    +
  • uses .text and .tail attributes:

    +
    >>> div = html.fragment_fromstring(
    +...     "<div><p>a paragraph<br>split in two</p> parts</div>")
    +>>> p = div[0]
    +>>> br = p[0]
    +
    +>>> p.text
    +'a paragraph'
    +>>> br.text
    +>>> br.tail
    +'split in two'
    +>>> p.tail
    +' parts'
    +
    +
  • +
  • no text nodes!

    +
      +
    • simplifies tree traversal a lot
    • +
    • simplifies many XML algorithms
    • +
    +
  • +
+
+
+

Attributes in ElementTree

+
    +
  • uses .get() and .set() methods:

    +
    >>> root = etree.fromstring(
    +...     '<root a="the value" b="of an" c="attribute"/>')
    +
    +>>> root.get('a')
    +'the value'
    +
    +>>> root.set('a', "THE value")
    +>>> root.get('a')
    +'THE value'
    +
    +
  • +
  • or the .attrib dictionary property:

    +
    >>> d = root.attrib
    +
    +>>> list(sorted(d.keys()))
    +['a', 'b', 'c']
    +>>> list(sorted(d.values()))
    +['THE value', 'attribute', 'of an']
    +
    +
  • +
+
+
+

Tree iteration in lxml.etree (1)

+ +
>>> root = etree.fromstring(
+...   "<root> <a><b/><b/></a> <c><d/><e><f/></e><g/></c> </root>")
+
+>>> print([child.tag for child in root])   # children
+['a', 'c']
+
+>>> print([el.tag for el in root.iter()])  # self and descendants
+['root', 'a', 'b', 'b', 'c', 'd', 'e', 'f', 'g']
+
+>>> print([el.tag for el in root.iterdescendants()])
+['a', 'b', 'b', 'c', 'd', 'e', 'f', 'g']
+
+
+>>> def iter_breadth_first(root):
+...     bfs_queue = collections.deque([root])
+...     while bfs_queue:
+...         el = bfs_queue.popleft()  # pop next element
+...         bfs_queue.extend(el)      # append its children
+...         yield el
+
+>>> print([el.tag for el in iter_breadth_first(root)])
+['root', 'a', 'c', 'b', 'b', 'd', 'e', 'g', 'f']
+
+
+
+

Tree iteration in lxml.etree (2)

+
>>> root = etree.fromstring(
+...   "<root> <a><b/><b/></a> <c><d/><e><f/></e><g/></c> </root>")
+
+>>> tree_walker = etree.iterwalk(root, events=('start', 'end'))
+
+>>> for (event, element) in tree_walker:
+...     print("%s (%s)" % (element.tag, event))
+root (start)
+a (start)
+b (start)
+b (end)
+b (start)
+b (end)
+a (end)
+c (start)
+d (start)
+d (end)
+e (start)
+f (start)
+f (end)
+e (end)
+g (start)
+g (end)
+c (end)
+root (end)
+
+
+
+

Path languages in lxml

+
<root>
+  <speech class='dialog'><p>So be it!</p></speech>
+  <p>stuff</p>
+</root>
+
+
    +
  • search it with XPath

    +
    >>> find_paragraphs = etree.XPath("//p")
    +>>> paragraphs = find_paragraphs(xml_tree)
    +
    +>>> print([ p.text for p in paragraphs ])
    +['So be it!', 'stuff']
    +
    +
  • +
  • search it with CSS selectors

    +
    >>> find_dialogs = cssselect.CSSSelector("speech.dialog p")
    +>>> paragraphs = find_dialogs(xml_tree)
    +
    +>>> print([ p.text for p in paragraphs ])
    +['So be it!']
    +
    +
  • +
+
+
+

Summary of lesson 0

+
    +
  • lxml comes with various tools
      +
    • that aim to hide the quirks of XML
    • +
    • that simplify finding and handling data
    • +
    • that make XML a pythonic tool by itself
    • +
    +
  • +
+
+
+

Lesson 1: parsing XML/HTML

+
+

The input side

+

(a quick overview)

+
+
+
+

Parsing XML and HTML from ...

+
    +
  • strings: fromstring(xml_data)
      +
    • byte strings, but also unicode strings
    • +
    +
  • +
  • filenames: parse(filename)
  • +
  • HTTP/FTP URLs: parse(url)
  • +
  • file objects: parse(f)
      +
    • f = open(filename, 'rb') !
    • +
    +
  • +
  • file-like objects: parse(f)
      +
    • only need a f.read(size) method
    • +
    +
  • +
  • data chunks: parser.feed(xml_chunk)
      +
    • result = parser.close()
    • +
    +
  • +
+

(parsing from strings and filenames/URLs frees the GIL)

+
+
+

Example: parsing from a string

+
    +
  • using the fromstring() function:

    +
    >>> root_element = etree.fromstring(some_xml_data)
    +
    +
  • +
  • using the fromstring() function with a specific parser:

    +
    >>> parser = etree.HTMLParser(remove_comments=True)
    +>>> root_element = etree.fromstring(some_html_data, parser)
    +
    +
  • +
  • or the XML() and HTML() aliases for literals in code:

    +
    >>> root_element = etree.XML("<root><child/></root>")
    +>>> root_element = etree.HTML("<p>some<br>paragraph</p>")
    +
    +
  • +
+
+
+

Parsing XML into ...

+
    +
  • a tree in memory
      +
    • parse() and fromstring() functions
    • +
    +
  • +
  • a tree in memory, but step-by-step with a generator
      +
    • iterparse() generates (start/end, element) events
    • +
    • tree can be cleaned up to save space
    • +
    +
  • +
  • SAX-like callbacks without building a tree
      +
    • parse() and fromstring() functions
    • +
    • pass a target object into the parser
    • +
    +
  • +
+
+
+

Summary of lesson 1

+
    +
  • parsing XML/HTML in lxml is mostly straight forward
      +
    • simple functions that do the job
    • +
    +
  • +
  • advanced use cases are pretty simple
      +
    • event-driven parsing using iterparse()
    • +
    • special parser configuration with keyword arguments
        +
      • configuration is generally local to a parser
      • +
      +
    • +
    +
  • +
  • BTW: parsing is very fast, as is serialising
      +
    • don't hesitate to do parse-serialise-parse cycles
    • +
    +
  • +
+
+
+

Lesson 2: generating XML

+
+

The output side

+

(and how to make it safe and simple)

+
+
+
+

The example language: Atom

+

The Atom XML format

+
    +
  • Namespace: http://www.w3.org/2005/Atom
  • +
  • W3C recommendation derived from RSS and friends
  • +
  • Atom feeds describe news entries and annotated links
      +
    • a feed contains one or more entry elements
    • +
    • an entry contains author, link, summary and/or content
    • +
    +
  • +
+
+
+

Example: generate XML (1)

+

The ElementMaker (or E-factory)

+
>>> from lxml.builder import ElementMaker
+>>> A = ElementMaker(namespace="http://www.w3.org/2005/Atom",
+...                  nsmap={None : "http://www.w3.org/2005/Atom"})
+
+
>>> atom = A.feed(
+...   A.author( A.name("Stefan Behnel") ),
+...   A.entry(
+...     A.title("News from lxml"),
+...     A.link(href="http://codespeak.net/lxml/"),
+...     A.summary("See what's <b>fun</b> about lxml...",
+...               type="html"),
+...   )
+... )
+
+
>>> from lxml.etree import tostring
+>>> print( tostring(atom, pretty_print=True) )
+
+
+
+

Example: generate XML (2)

+
>>> atom = A.feed(
+...   A.author( A.name("Stefan Behnel") ),
+...   A.entry(
+...     A.title("News from lxml"),
+...     A.link(href="http://codespeak.net/lxml/"),
+...     A.summary("See what's <b>fun</b> about lxml...",
+...               type="html"),
+...   )
+... )
+
+
<feed xmlns="http://www.w3.org/2005/Atom">
+  <author>
+    <name>Stefan Behnel</name>
+  </author>
+  <entry>
+    <title>News from lxml</title>
+    <link href="http://codespeak.net/lxml/"/>
+    <summary type="html">See what's &lt;b&gt;fun&lt;/b&gt;
+                         about lxml...</summary>
+  </entry>
+</feed>
+
+
+
+

Be careful what you type!

+
>>> atom = A.feed(
+...   A.author( A.name("Stefan Behnel") ),
+...   A.entry(
+...     A.titel("News from lxml"),
+...     A.link(href="http://codespeak.net/lxml/"),
+...     A.summary("See what's <b>fun</b> about lxml...",
+...               type="html"),
+...   )
+... )
+
+
<feed xmlns="http://www.w3.org/2005/Atom">
+  <author>
+    <name>Stefan Behnel</name>
+  </author>
+  <entry>
+    <titel>News from lxml</titel>
+    <link href="http://codespeak.net/lxml/"/>
+    <summary type="html">See what's &lt;b&gt;fun&lt;/b&gt;
+                         about lxml...</summary>
+  </entry>
+</feed>
+
+
+
+

Want more 'type safety'?

+

Write an XML generator module instead:

+
# atomgen.py
+
+from lxml import etree
+from lxml.builder import ElementMaker
+
+ATOM_NAMESPACE = "http://www.w3.org/2005/Atom"
+
+A = ElementMaker(namespace=ATOM_NAMESPACE,
+                 nsmap={None : ATOM_NAMESPACE})
+
+feed = A.feed
+entry = A.entry
+title = A.title
+# ... and so on and so forth ...
+
+
+# plus a little validation function: isvalid()
+isvalid = etree.RelaxNG(file="atom.rng")
+
+
+
+

The Atom generator module

+ +
>>> import atomgen as A
+
+>>> atom = A.feed(
+...   A.author( A.name("Stefan Behnel") ),
+...   A.entry(
+...     A.link(href="http://codespeak.net/lxml/"),
+...     A.title("News from lxml"),
+...     A.summary("See what's <b>fun</b> about lxml...",
+...               type="html"),
+...   )
+... )
+
+>>> A.isvalid(atom) # ok, forgot the ID's => invalid XML ...
+False
+
+>>> title = A.titel("News from lxml")
+Traceback (most recent call last):
+  ...
+AttributeError: 'module' object has no attribute 'titel'
+
+
+
+

Mixing languages (1)

+

Atom can embed serialised HTML

+
>>> import lxml.html.builder as h
+
+>>> html_fragment = h.DIV(
+...   "this is some\n",
+...   h.A("HTML", href="http://w3.org/MarkUp/"),
+...   "\ncontent")
+
+
>>> serialised_html = etree.tostring(html_fragment, method="html")
+
+>>> summary = A.summary(serialised_html, type="html")
+
+
>>> print(etree.tostring(summary))
+<summary xmlns="http://www.w3.org/2005/Atom" type="html">
+   &lt;div&gt;this is some
+   &lt;a href="http://w3.org/MarkUp/"&gt;HTML&lt;/a&gt;
+   content&lt;/div&gt;
+</summary>
+
+
+
+

Mixing languages (2)

+

Atom can also embed non-escaped XHTML

+
>>> from copy import deepcopy
+>>> xhtml_fragment = deepcopy(html_fragment)
+
+>>> from lxml.html import html_to_xhtml
+>>> html_to_xhtml(xhtml_fragment)
+
+>>> summary = A.summary(xhtml_fragment, type="xhtml")
+
+
>>> print(etree.tostring(summary, pretty_print=True))
+<summary xmlns="http://www.w3.org/2005/Atom" type="xhtml">
+  <html:div xmlns:html="http://www.w3.org/1999/xhtml">this is some
+  <html:a href="http://w3.org/MarkUp/">HTML</html:a>
+  content</html:div>
+</summary>
+
+
+
+

Summary of lesson 2

+
    +
  • generating XML is easy
      +
    • use the ElementMaker
    • +
    +
  • +
  • wrap it in a module that provides
      +
    • the target namespace
    • +
    • an ElementMaker name for each language element
    • +
    • a validator
    • +
    • maybe additional helper functions
    • +
    +
  • +
  • mixing languages is easy
      +
    • define a generator module for each
    • +
    +
  • +
+

... this is all you need for the output side of XML languages

+
+
+

Lesson 3: Designing XML APIs

+
+

The Element API

+

(and how to make it the way you want)

+
+
+
+

Trees in C and in Python

+
    +
  • Trees have two representations:
      +
    • a plain, complete, low-level C tree provided by libxml2
    • +
    • a set of Python Element proxies, each representing one element
    • +
    +
  • +
  • Proxies are created on-the-fly:
      +
    • lxml creates an Element object for a C node on request
    • +
    • proxies are garbage collected when going out of scope
    • +
    • XML trees are garbage collected when deleting the last proxy
    • +
    +
  • +
+ep2008/proxies.png +
+
+

Mapping Python classes to nodes

+
    +
  • Proxies can be assigned to XML nodes by user code
      +
    • lxml tells you about a node, you return a class
    • +
    +
  • +
+
+
+

Example: a simple Element class (1)

+
    +
  • define a subclass of ElementBase

    +
    >>> class HonkElement(etree.ElementBase):
    +...    @property
    +...    def honking(self):
    +...       return self.get('honking') == 'true'
    +
    +
  • +
  • let it replace the default Element class

    +
    >>> lookup = etree.ElementDefaultClassLookup(
    +...                             element=HonkElement)
    +
    +>>> parser = etree.XMLParser()
    +>>> parser.set_element_class_lookup(lookup)
    +
    +
  • +
+
+
+

Example: a simple Element class (2)

+
    +
  • use the new Element class

    +
    >>> root = etree.XML('<root><honk honking="true"/></root>',
    +...                  parser)
    +
    +>>> root.honking
    +False
    +>>> root[0].honking
    +True
    +
    +
  • +
+
+
+

Mapping Python classes to nodes

+
    +
  • The Element class lookup
      +
    • lxml tells you about a node, you return a class
    • +
    • no restrictions on lookup algorithm
    • +
    • each parser can use a different class lookup scheme
    • +
    • lookup schemes can be chained through fallbacks
    • +
    +
  • +
  • Classes can be selected based on
      +
    • the node type (element, comment or processing instruction)
        +
      • ElementDefaultClassLookup()
      • +
      +
    • +
    • the namespaced node name
        +
      • CustomElementClassLookup() + a fallback
      • +
      • ElementNamespaceClassLookup() + a fallback
      • +
      +
    • +
    • the value of an attribute (e.g. id or class)
        +
      • AttributeBasedElementClassLookup() + a fallback
      • +
      +
    • +
    • read-only inspection of the tree
        +
      • PythonElementClassLookup() + a fallback
      • +
      +
    • +
    +
  • +
+
+
+

Designing an Atom API

+
    +
  • a feed is a container for entries

    +
    # atom.py
    +
    +ATOM_NAMESPACE = "http://www.w3.org/2005/Atom"
    +_ATOM_NS = "{%s}" % ATOM_NAMESPACE
    +
    +class FeedElement(etree.ElementBase):
    +    @property
    +    def entries(self):
    +       return self.findall(_ATOM_NS + "entry")
    +
    +
  • +
  • it also has a couple of meta-data children, e.g. title

    +
    class FeedElement(etree.ElementBase):
    +    # ...
    +    @property
    +    def title(self):
    +        "return the title or None"
    +        return self.find("title")
    +
    +
  • +
+
+
+

Consider lxml.objectify

+
    +
  • ready-to-use, generic Python object API for XML
  • +
+
>>> from lxml import objectify
+
+>>> feed = objectify.parse("atom-example.xml")
+>>> print(feed.title)
+Example Feed
+
+>>> print([entry.title for entry in feed.entry])
+['Atom-Powered Robots Run Amok']
+
+>>> print(feed.entry[0].title)
+Atom-Powered Robots Run Amok
+
+
+
+

Still room for more convenience

+
from itertools import chain
+
+class FeedElement(objectify.ObjectifiedElement):
+
+    def addIDs(self):
+        "initialise the IDs of feed and entries"
+
+        for element in chain([self], self.entry):
+            if element.find(_ATOM_NS + "id") is None:
+                id = etree.SubElement(self, _ATOM_NS + "id")
+                id.text = make_guid()
+
+
+
+

Incremental API design

+
    +
  • choose an XML API to start with
      +
    • lxml.etree is general purpose
    • +
    • lxml.objectify is nice for document-style XML
    • +
    +
  • +
  • fix Elements that really need some API sugar
      +
    • dict-mappings to children with specific content/attributes
    • +
    • properties for specially typed attributes or child values
    • +
    • simplified access to varying content types of an element
    • +
    • shortcuts for unnecessarily deep subtrees
    • +
    +
  • +
  • ignore what works well enough with the Element API
      +
    • lists of homogeneous children -> Element iteration
    • +
    • string attributes -> .get()/.set()
    • +
    +
  • +
  • let the API grow at your fingertips
      +
    • play with it and test use cases
    • +
    • avoid "I want because I can" feature explosion!
    • +
    +
  • +
+
+
+

Setting up the Element mapping

+

Atom has a namespace => leave the mapping to lxml

+
# ...
+_atom_lookup = etree.ElementNamespaceClassLookup(
+                  objectify.ObjectifyElementClassLookup())
+
+# map the classes to tag names
+ns = _atom_lookup.get_namespace(ATOM_NAMESPACE)
+ns["feed"]  = FeedElement
+ns["entry"] = EntryElement
+# ... and so on
+# or use ns.update(vars()) with appropriate class names
+
+# create a parser that does some whitespace cleanup
+atom_parser = etree.XMLParser(remove_blank_text=True)
+
+# make it use our Atom classes
+atom_parser.set_element_class_lookup(_atom_lookup)
+
+# and help users in using our parser setup
+def parse(input):
+    return etree.parse(input, atom_parser)
+
+
+
+

Using your new Atom API

+
>>> import atom
+>>> feed = atom.parse("ep2008/atom-example.xml").getroot()
+
+>>> print(len(feed.entry))
+1
+>>> print([entry.title for entry in feed.entry])
+['Atom-Powered Robots Run Amok']
+
+>>> link_tag = "{%s}link" % atom.ATOM_NAMESPACE
+>>> print([link.get("href") for link in feed.iter(link_tag)])
+['http://example.org/', 'http://example.org/2003/12/13/atom03']
+
+
+
+

Summary of lesson 3

+

To implement an XML API ...

+
    +
  1. start off with lxml's Element API
      +
    • or take a look at the object API of lxml.objectify
    • +
    +
  2. +
  3. specialise it into a set of custom Element classes
  4. +
  5. map them to XML tags using one of the lookup schemes
  6. +
  7. improve the API incrementally while using it
      +
    • discover inconveniences and beautify them
    • +
    • avoid putting work into things that work
    • +
    +
  8. +
+
+
+

Conclusion

+

lxml ...

+
    +
  • provides a convenient set of tools for XML and HTML
      +
    • parsing
    • +
    • generating
    • +
    • working with in-memory trees
    • +
    +
  • +
  • follows Python idioms wherever possible
      +
    • highly extensible through wrapping and subclassing
    • +
    • callable objects for XPath, CSS selectors, XSLT, schemas
    • +
    • iteration for tree traversal (even while parsing)
    • +
    • list-/dict-like APIs, properties, keyword arguments, ...
    • +
    +
  • +
  • makes extension and specialisation easy
      +
    • write a special XML generator module in trivial code
    • +
    • write your own XML API incrementally on-the-fly
    • +
    +
  • +
+
+
+ + diff --git a/setup.py b/setup.py index 03b9edbe..c433c41c 100644 --- a/setup.py +++ b/setup.py @@ -232,6 +232,7 @@ an appropriate version of Cython installed. 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: C', 'Operating System :: OS Independent', 'Topic :: Text Processing :: Markup :: HTML', diff --git a/src/lxml.egg-info/PKG-INFO b/src/lxml.egg-info/PKG-INFO index f974f0a9..33c941f4 100644 --- a/src/lxml.egg-info/PKG-INFO +++ b/src/lxml.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: lxml -Version: 4.4.2 +Version: 4.4.3 Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API. Home-page: http://lxml.de/ Author: lxml dev team @@ -38,15 +38,13 @@ Description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libr as soon as a maintenance branch has been established. Note that this requires Cython to be installed at an appropriate version for the build. - 4.4.2 (2019-11-25) + 4.4.3 (2020-01-28) ================== Bugs fixed ---------- - * LP#1835708: ``ElementInclude`` incorrectly rejected repeated non-recursive - includes as recursive. - Patch by Rainer Hausdorf. + * LP#1844674: ``itertext()`` was missing tail text of comments and PIs since 4.4.0. @@ -62,6 +60,7 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: C Classifier: Operating System :: OS Independent Classifier: Topic :: Text Processing :: Markup :: HTML diff --git a/src/lxml.egg-info/SOURCES.txt b/src/lxml.egg-info/SOURCES.txt index 20824743..c41e04e0 100644 --- a/src/lxml.egg-info/SOURCES.txt +++ b/src/lxml.egg-info/SOURCES.txt @@ -52,14 +52,517 @@ doc/tutorial.txt doc/valgrind.txt doc/validation.txt doc/xpathxslt.txt +doc/html/FAQ.html +doc/html/api.html +doc/html/build.html +doc/html/capi.html +doc/html/changes-4.4.3.html +doc/html/compatibility.html +doc/html/credits.html +doc/html/cssselect.html +doc/html/element_classes.html +doc/html/elementsoup.html +doc/html/extensions.html +doc/html/html5parser.html +doc/html/index.html +doc/html/installation.html +doc/html/intro.html +doc/html/lxml-source-howto.html +doc/html/lxmlhtml.html +doc/html/objectify.html +doc/html/parsing.html +doc/html/performance.html doc/html/pubkey.asc +doc/html/resolvers.html +doc/html/sax.html +doc/html/sitemap.html doc/html/style.css doc/html/tagpython-big.png +doc/html/tutorial.html +doc/html/validation.html +doc/html/xpathxslt.html +doc/html/api/abc.ABCMeta-class.html +doc/html/api/api-objects.txt +doc/html/api/class-tree.html +doc/html/api/cssselect.parser.SelectorError-class.html +doc/html/api/cssselect.parser.SelectorSyntaxError-class.html +doc/html/api/cssselect.xpath.ExpressionError-class.html +doc/html/api/cssselect.xpath.XPathExpr-class.html +doc/html/api/deprecated-index.html +doc/html/api/epydoc.css +doc/html/api/exceptions.AssertionError-class.html +doc/html/api/frames.html +doc/html/api/help.html +doc/html/api/identifier-index-A.html +doc/html/api/identifier-index-B.html +doc/html/api/identifier-index-C.html +doc/html/api/identifier-index-D.html +doc/html/api/identifier-index-E.html +doc/html/api/identifier-index-F.html +doc/html/api/identifier-index-G.html +doc/html/api/identifier-index-H.html +doc/html/api/identifier-index-I.html +doc/html/api/identifier-index-J.html +doc/html/api/identifier-index-K.html +doc/html/api/identifier-index-L.html +doc/html/api/identifier-index-M.html +doc/html/api/identifier-index-N.html +doc/html/api/identifier-index-O.html +doc/html/api/identifier-index-P.html +doc/html/api/identifier-index-Q.html +doc/html/api/identifier-index-R.html +doc/html/api/identifier-index-S.html +doc/html/api/identifier-index-T.html +doc/html/api/identifier-index-U.html +doc/html/api/identifier-index-V.html +doc/html/api/identifier-index-W.html +doc/html/api/identifier-index-X.html +doc/html/api/identifier-index-Y.html +doc/html/api/identifier-index-Z.html +doc/html/api/identifier-index-_.html +doc/html/api/identifier-index.html +doc/html/api/index.html +doc/html/api/lxml-module.html +doc/html/api/lxml-pysrc.html +doc/html/api/lxml.ElementInclude-module.html +doc/html/api/lxml.ElementInclude-pysrc.html +doc/html/api/lxml.ElementInclude.FatalIncludeError-class.html +doc/html/api/lxml.ElementInclude.LimitedRecursiveIncludeError-class.html +doc/html/api/lxml.builder-module.html +doc/html/api/lxml.builder-pysrc.html +doc/html/api/lxml.builder.ElementMaker-class.html +doc/html/api/lxml.cssselect-module.html +doc/html/api/lxml.cssselect-pysrc.html +doc/html/api/lxml.cssselect.CSSSelector-class.html +doc/html/api/lxml.cssselect.LxmlHTMLTranslator-class.html +doc/html/api/lxml.cssselect.LxmlTranslator-class.html +doc/html/api/lxml.doctestcompare-module.html +doc/html/api/lxml.doctestcompare-pysrc.html +doc/html/api/lxml.doctestcompare.LHTMLOutputChecker-class.html +doc/html/api/lxml.doctestcompare.LXMLOutputChecker-class.html +doc/html/api/lxml.doctestcompare._RestoreChecker-class.html +doc/html/api/lxml.etree-module.html +doc/html/api/lxml.etree.AncestorsIterator-class.html +doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html +doc/html/api/lxml.etree.C14NError-class.html +doc/html/api/lxml.etree.C14NWriterTarget-class.html +doc/html/api/lxml.etree.CDATA-class.html +doc/html/api/lxml.etree.CommentBase-class.html +doc/html/api/lxml.etree.CustomElementClassLookup-class.html +doc/html/api/lxml.etree.DTD-class.html +doc/html/api/lxml.etree.DTDError-class.html +doc/html/api/lxml.etree.DTDParseError-class.html +doc/html/api/lxml.etree.DTDValidateError-class.html +doc/html/api/lxml.etree.DocInfo-class.html +doc/html/api/lxml.etree.DocumentInvalid-class.html +doc/html/api/lxml.etree.ETCompatXMLParser-class.html +doc/html/api/lxml.etree.ETXPath-class.html +doc/html/api/lxml.etree.ElementBase-class.html +doc/html/api/lxml.etree.ElementChildIterator-class.html +doc/html/api/lxml.etree.ElementClassLookup-class.html +doc/html/api/lxml.etree.ElementDefaultClassLookup-class.html +doc/html/api/lxml.etree.ElementDepthFirstIterator-class.html +doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html +doc/html/api/lxml.etree.ElementTextIterator-class.html +doc/html/api/lxml.etree.EntityBase-class.html +doc/html/api/lxml.etree.Error-class.html +doc/html/api/lxml.etree.ErrorDomains-class.html +doc/html/api/lxml.etree.ErrorLevels-class.html +doc/html/api/lxml.etree.ErrorTypes-class.html +doc/html/api/lxml.etree.FallbackElementClassLookup-class.html +doc/html/api/lxml.etree.HTMLParser-class.html +doc/html/api/lxml.etree.HTMLPullParser-class.html +doc/html/api/lxml.etree.LxmlError-class.html +doc/html/api/lxml.etree.LxmlRegistryError-class.html +doc/html/api/lxml.etree.LxmlSyntaxError-class.html +doc/html/api/lxml.etree.NamespaceRegistryError-class.html +doc/html/api/lxml.etree.PIBase-class.html +doc/html/api/lxml.etree.ParseError-class.html +doc/html/api/lxml.etree.ParserBasedElementClassLookup-class.html +doc/html/api/lxml.etree.ParserError-class.html +doc/html/api/lxml.etree.PyErrorLog-class.html +doc/html/api/lxml.etree.PythonElementClassLookup-class.html +doc/html/api/lxml.etree.QName-class.html +doc/html/api/lxml.etree.RelaxNG-class.html +doc/html/api/lxml.etree.RelaxNGError-class.html +doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html +doc/html/api/lxml.etree.RelaxNGParseError-class.html +doc/html/api/lxml.etree.RelaxNGValidateError-class.html +doc/html/api/lxml.etree.Resolver-class.html +doc/html/api/lxml.etree.Schematron-class.html +doc/html/api/lxml.etree.SchematronError-class.html +doc/html/api/lxml.etree.SchematronParseError-class.html +doc/html/api/lxml.etree.SchematronValidateError-class.html +doc/html/api/lxml.etree.SerialisationError-class.html +doc/html/api/lxml.etree.SiblingsIterator-class.html +doc/html/api/lxml.etree.TreeBuilder-class.html +doc/html/api/lxml.etree.XInclude-class.html +doc/html/api/lxml.etree.XIncludeError-class.html +doc/html/api/lxml.etree.XMLParser-class.html +doc/html/api/lxml.etree.XMLPullParser-class.html +doc/html/api/lxml.etree.XMLSchema-class.html +doc/html/api/lxml.etree.XMLSchemaError-class.html +doc/html/api/lxml.etree.XMLSchemaParseError-class.html +doc/html/api/lxml.etree.XMLSchemaValidateError-class.html +doc/html/api/lxml.etree.XMLSyntaxError-class.html +doc/html/api/lxml.etree.XPath-class.html +doc/html/api/lxml.etree.XPathDocumentEvaluator-class.html +doc/html/api/lxml.etree.XPathElementEvaluator-class.html +doc/html/api/lxml.etree.XPathError-class.html +doc/html/api/lxml.etree.XPathEvalError-class.html +doc/html/api/lxml.etree.XPathFunctionError-class.html +doc/html/api/lxml.etree.XPathResultError-class.html +doc/html/api/lxml.etree.XPathSyntaxError-class.html +doc/html/api/lxml.etree.XSLT-class.html +doc/html/api/lxml.etree.XSLTAccessControl-class.html +doc/html/api/lxml.etree.XSLTApplyError-class.html +doc/html/api/lxml.etree.XSLTError-class.html +doc/html/api/lxml.etree.XSLTExtension-class.html +doc/html/api/lxml.etree.XSLTExtensionError-class.html +doc/html/api/lxml.etree.XSLTParseError-class.html +doc/html/api/lxml.etree.XSLTSaveError-class.html +doc/html/api/lxml.etree._Attrib-class.html +doc/html/api/lxml.etree._BaseErrorLog-class.html +doc/html/api/lxml.etree._Comment-class.html +doc/html/api/lxml.etree._Document-class.html +doc/html/api/lxml.etree._DomainErrorLog-class.html +doc/html/api/lxml.etree._Element-class.html +doc/html/api/lxml.etree._ElementIterator-class.html +doc/html/api/lxml.etree._ElementMatchIterator-class.html +doc/html/api/lxml.etree._ElementStringResult-class.html +doc/html/api/lxml.etree._ElementTagMatcher-class.html +doc/html/api/lxml.etree._ElementTree-class.html +doc/html/api/lxml.etree._ElementUnicodeResult-class.html +doc/html/api/lxml.etree._Entity-class.html +doc/html/api/lxml.etree._ErrorLog-class.html +doc/html/api/lxml.etree._FeedParser-class.html +doc/html/api/lxml.etree._IDDict-class.html +doc/html/api/lxml.etree._ListErrorLog-class.html +doc/html/api/lxml.etree._LogEntry-class.html +doc/html/api/lxml.etree._ProcessingInstruction-class.html +doc/html/api/lxml.etree._RotatingErrorLog-class.html +doc/html/api/lxml.etree._SaxParserTarget-class.html +doc/html/api/lxml.etree._TargetParserResult-class.html +doc/html/api/lxml.etree._Validator-class.html +doc/html/api/lxml.etree._XPathEvaluatorBase-class.html +doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html +doc/html/api/lxml.etree._XSLTResultTree-class.html +doc/html/api/lxml.etree.htmlfile-class.html +doc/html/api/lxml.etree.iterparse-class.html +doc/html/api/lxml.etree.iterwalk-class.html +doc/html/api/lxml.etree.xmlfile-class.html +doc/html/api/lxml.html-module.html +doc/html/api/lxml.html-pysrc.html +doc/html/api/lxml.html.CheckboxGroup-class.html +doc/html/api/lxml.html.CheckboxValues-class.html +doc/html/api/lxml.html.Classes-class.html +doc/html/api/lxml.html.ElementSoup-module.html +doc/html/api/lxml.html.ElementSoup-pysrc.html +doc/html/api/lxml.html.FieldsDict-class.html +doc/html/api/lxml.html.FormElement-class.html +doc/html/api/lxml.html.HTMLParser-class.html +doc/html/api/lxml.html.HtmlComment-class.html +doc/html/api/lxml.html.HtmlElement-class.html +doc/html/api/lxml.html.HtmlElementClassLookup-class.html +doc/html/api/lxml.html.HtmlEntity-class.html +doc/html/api/lxml.html.HtmlMixin-class.html +doc/html/api/lxml.html.HtmlProcessingInstruction-class.html +doc/html/api/lxml.html.InputElement-class.html +doc/html/api/lxml.html.InputGetter-class.html +doc/html/api/lxml.html.InputMixin-class.html +doc/html/api/lxml.html.LabelElement-class.html +doc/html/api/lxml.html.MultipleSelectOptions-class.html +doc/html/api/lxml.html.RadioGroup-class.html +doc/html/api/lxml.html.SelectElement-class.html +doc/html/api/lxml.html.TextareaElement-class.html +doc/html/api/lxml.html.XHTMLParser-class.html +doc/html/api/lxml.html._MethodFunc-class.html +doc/html/api/lxml.html.builder-module.html +doc/html/api/lxml.html.builder-pysrc.html +doc/html/api/lxml.html.clean-module.html +doc/html/api/lxml.html.clean-pysrc.html +doc/html/api/lxml.html.clean.Cleaner-class.html +doc/html/api/lxml.html.defs-module.html +doc/html/api/lxml.html.defs-pysrc.html +doc/html/api/lxml.html.diff-module.html +doc/html/api/lxml.html.diff-pysrc.html +doc/html/api/lxml.html.diff.DEL_END-class.html +doc/html/api/lxml.html.diff.DEL_START-class.html +doc/html/api/lxml.html.diff.InsensitiveSequenceMatcher-class.html +doc/html/api/lxml.html.diff.NoDeletes-class.html +doc/html/api/lxml.html.diff.href_token-class.html +doc/html/api/lxml.html.diff.tag_token-class.html +doc/html/api/lxml.html.diff.token-class.html +doc/html/api/lxml.html.formfill-module.html +doc/html/api/lxml.html.formfill-pysrc.html +doc/html/api/lxml.html.formfill.DefaultErrorCreator-class.html +doc/html/api/lxml.html.formfill.FormNotFound-class.html +doc/html/api/lxml.html.html5parser-module.html +doc/html/api/lxml.html.html5parser-pysrc.html +doc/html/api/lxml.html.html5parser.HTMLParser-class.html +doc/html/api/lxml.html.html5parser.XHTMLParser-class.html +doc/html/api/lxml.html.soupparser-module.html +doc/html/api/lxml.html.soupparser-pysrc.html +doc/html/api/lxml.html.soupparser._PseudoTag-class.html +doc/html/api/lxml.html.usedoctest-module.html +doc/html/api/lxml.html.usedoctest-pysrc.html +doc/html/api/lxml.includes-module.html +doc/html/api/lxml.includes-pysrc.html +doc/html/api/lxml.isoschematron-module.html +doc/html/api/lxml.isoschematron-pysrc.html +doc/html/api/lxml.isoschematron.Schematron-class.html +doc/html/api/lxml.objectify-module.html +doc/html/api/lxml.objectify.BoolElement-class.html +doc/html/api/lxml.objectify.ElementMaker-class.html +doc/html/api/lxml.objectify.FloatElement-class.html +doc/html/api/lxml.objectify.IntElement-class.html +doc/html/api/lxml.objectify.LongElement-class.html +doc/html/api/lxml.objectify.NoneElement-class.html +doc/html/api/lxml.objectify.NumberElement-class.html +doc/html/api/lxml.objectify.ObjectPath-class.html +doc/html/api/lxml.objectify.ObjectifiedDataElement-class.html +doc/html/api/lxml.objectify.ObjectifiedElement-class.html +doc/html/api/lxml.objectify.ObjectifyElementClassLookup-class.html +doc/html/api/lxml.objectify.PyType-class.html +doc/html/api/lxml.objectify.StringElement-class.html +doc/html/api/lxml.pyclasslookup-module.html +doc/html/api/lxml.pyclasslookup-pysrc.html +doc/html/api/lxml.sax-module.html +doc/html/api/lxml.sax-pysrc.html +doc/html/api/lxml.sax.ElementTreeContentHandler-class.html +doc/html/api/lxml.sax.ElementTreeProducer-class.html +doc/html/api/lxml.sax.SaxError-class.html +doc/html/api/lxml.tests-module.html +doc/html/api/lxml.tests-pysrc.html +doc/html/api/lxml.tests.common_imports-module.html +doc/html/api/lxml.tests.common_imports-pysrc.html +doc/html/api/lxml.tests.common_imports.HelperTestCase-class.html +doc/html/api/lxml.tests.common_imports.LargeFileLike-class.html +doc/html/api/lxml.tests.common_imports.LargeFileLikeUnicode-class.html +doc/html/api/lxml.tests.common_imports.SillyFileLike-class.html +doc/html/api/lxml.tests.common_imports.skipif-class.html +doc/html/api/lxml.tests.dummy_http_server-module.html +doc/html/api/lxml.tests.dummy_http_server-pysrc.html +doc/html/api/lxml.tests.dummy_http_server.HTTPRequestCollector-class.html +doc/html/api/lxml.tests.dummy_http_server.WebServer-class.html +doc/html/api/lxml.tests.dummy_http_server._RequestHandler-class.html +doc/html/api/lxml.tests.selftest-module.html +doc/html/api/lxml.tests.selftest-pysrc.html +doc/html/api/lxml.tests.selftest2-module.html +doc/html/api/lxml.tests.selftest2-pysrc.html +doc/html/api/lxml.tests.test_builder-module.html +doc/html/api/lxml.tests.test_builder-pysrc.html +doc/html/api/lxml.tests.test_builder.BuilderTestCase-class.html +doc/html/api/lxml.tests.test_classlookup-module.html +doc/html/api/lxml.tests.test_classlookup-pysrc.html +doc/html/api/lxml.tests.test_classlookup.ClassLookupTestCase-class.html +doc/html/api/lxml.tests.test_classlookup.ProxyTestCase-class.html +doc/html/api/lxml.tests.test_css-module.html +doc/html/api/lxml.tests.test_css-pysrc.html +doc/html/api/lxml.tests.test_css.CSSTestCase-class.html +doc/html/api/lxml.tests.test_doctestcompare-module.html +doc/html/api/lxml.tests.test_doctestcompare-pysrc.html +doc/html/api/lxml.tests.test_doctestcompare.DoctestCompareTest-class.html +doc/html/api/lxml.tests.test_doctestcompare.DummyInput-class.html +doc/html/api/lxml.tests.test_dtd-module.html +doc/html/api/lxml.tests.test_dtd-pysrc.html +doc/html/api/lxml.tests.test_dtd.ETreeDtdTestCase-class.html +doc/html/api/lxml.tests.test_elementpath-module.html +doc/html/api/lxml.tests.test_elementpath-pysrc.html +doc/html/api/lxml.tests.test_elementpath.EtreeElementPathTestCase-class.html +doc/html/api/lxml.tests.test_elementtree-module.html +doc/html/api/lxml.tests.test_elementtree-pysrc.html +doc/html/api/lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html +doc/html/api/lxml.tests.test_elementtree.CElementTreeTestCase-class.html +doc/html/api/lxml.tests.test_elementtree.ETreeC14N2TostringTest-class.html +doc/html/api/lxml.tests.test_elementtree.ETreeC14N2WriteTest-class.html +doc/html/api/lxml.tests.test_elementtree.ETreeC14NTest-class.html +doc/html/api/lxml.tests.test_elementtree.ETreeElementSlicingTest-class.html +doc/html/api/lxml.tests.test_elementtree.ETreePullTestCase-class.html +doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html +doc/html/api/lxml.tests.test_elementtree.ElementTreeElementSlicingTest-class.html +doc/html/api/lxml.tests.test_elementtree.ElementTreeTestCase-class.html +doc/html/api/lxml.tests.test_elementtree._C14NTest-class.html +doc/html/api/lxml.tests.test_elementtree._ETreeTestCaseBase-class.html +doc/html/api/lxml.tests.test_elementtree._ElementSlicingTest-class.html +doc/html/api/lxml.tests.test_elementtree._XMLPullParserTest-class.html +doc/html/api/lxml.tests.test_errors-module.html +doc/html/api/lxml.tests.test_errors-pysrc.html +doc/html/api/lxml.tests.test_errors.ErrorTestCase-class.html +doc/html/api/lxml.tests.test_etree-module.html +doc/html/api/lxml.tests.test_etree-pysrc.html +doc/html/api/lxml.tests.test_etree.ETreeC14NTestCase-class.html +doc/html/api/lxml.tests.test_etree.ETreeErrorLogTest-class.html +doc/html/api/lxml.tests.test_etree.ETreeOnlyTestCase-class.html +doc/html/api/lxml.tests.test_etree.ETreeWriteTestCase-class.html +doc/html/api/lxml.tests.test_etree.ETreeXIncludeTestCase-class.html +doc/html/api/lxml.tests.test_etree.ElementIncludeTestCase-class.html +doc/html/api/lxml.tests.test_etree.XMLPullParserTest-class.html +doc/html/api/lxml.tests.test_etree._XIncludeTestCase-class.html +doc/html/api/lxml.tests.test_external_document-module.html +doc/html/api/lxml.tests.test_external_document-pysrc.html +doc/html/api/lxml.tests.test_external_document.ExternalDocumentTestCase-class.html +doc/html/api/lxml.tests.test_htmlparser-module.html +doc/html/api/lxml.tests.test_htmlparser-pysrc.html +doc/html/api/lxml.tests.test_htmlparser.HtmlParserTestCase-class.html +doc/html/api/lxml.tests.test_http_io-module.html +doc/html/api/lxml.tests.test_http_io-pysrc.html +doc/html/api/lxml.tests.test_http_io.HttpIOTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile-module.html +doc/html/api/lxml.tests.test_incremental_xmlfile-pysrc.html +doc/html/api/lxml.tests.test_incremental_xmlfile.AsyncXmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.BytesIOXmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.HtmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.TempPathXmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile.TempXmlFileTestCase-class.html +doc/html/api/lxml.tests.test_incremental_xmlfile._XmlFileTestCaseBase-class.html +doc/html/api/lxml.tests.test_io-module.html +doc/html/api/lxml.tests.test_io-pysrc.html +doc/html/api/lxml.tests.test_io.ETreeIOTestCase-class.html +doc/html/api/lxml.tests.test_io.ElementTreeIOTestCase-class.html +doc/html/api/lxml.tests.test_io._IOTestCaseBase-class.html +doc/html/api/lxml.tests.test_isoschematron-module.html +doc/html/api/lxml.tests.test_isoschematron-pysrc.html +doc/html/api/lxml.tests.test_isoschematron.ETreeISOSchematronTestCase-class.html +doc/html/api/lxml.tests.test_nsclasses-module.html +doc/html/api/lxml.tests.test_nsclasses-pysrc.html +doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html +doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html +doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html +doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html +doc/html/api/lxml.tests.test_objectify-module.html +doc/html/api/lxml.tests.test_objectify-pysrc.html +doc/html/api/lxml.tests.test_objectify.ObjectifyTestCase-class.html +doc/html/api/lxml.tests.test_pyclasslookup-module.html +doc/html/api/lxml.tests.test_pyclasslookup-pysrc.html +doc/html/api/lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html +doc/html/api/lxml.tests.test_relaxng-module.html +doc/html/api/lxml.tests.test_relaxng-pysrc.html +doc/html/api/lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html +doc/html/api/lxml.tests.test_relaxng.RelaxNGCompactTestCase-class.html +doc/html/api/lxml.tests.test_sax-module.html +doc/html/api/lxml.tests.test_sax-pysrc.html +doc/html/api/lxml.tests.test_sax.ETreeSaxTestCase-class.html +doc/html/api/lxml.tests.test_sax.NSPrefixSaxTestCase-class.html +doc/html/api/lxml.tests.test_sax.SimpleContentHandler-class.html +doc/html/api/lxml.tests.test_schematron-module.html +doc/html/api/lxml.tests.test_schematron-pysrc.html +doc/html/api/lxml.tests.test_schematron.ETreeSchematronTestCase-class.html +doc/html/api/lxml.tests.test_threading-module.html +doc/html/api/lxml.tests.test_threading-pysrc.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html +doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html +doc/html/api/lxml.tests.test_threading.ThreadingTestCase-class.html +doc/html/api/lxml.tests.test_unicode-module.html +doc/html/api/lxml.tests.test_unicode-pysrc.html +doc/html/api/lxml.tests.test_unicode.EncodingsTestCase-class.html +doc/html/api/lxml.tests.test_unicode.UnicodeTestCase-class.html +doc/html/api/lxml.tests.test_xmlschema-module.html +doc/html/api/lxml.tests.test_xmlschema-pysrc.html +doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html +doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html +doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html +doc/html/api/lxml.tests.test_xpathevaluator-module.html +doc/html/api/lxml.tests.test_xpathevaluator-pysrc.html +doc/html/api/lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html +doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html +doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathExsltTestCase-class.html +doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html +doc/html/api/lxml.tests.test_xslt-module.html +doc/html/api/lxml.tests.test_xslt-pysrc.html +doc/html/api/lxml.tests.test_xslt.ETreeEXSLTTestCase-class.html +doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtElementTestCase-class.html +doc/html/api/lxml.tests.test_xslt.ETreeXSLTExtFuncTestCase-class.html +doc/html/api/lxml.tests.test_xslt.ETreeXSLTTestCase-class.html +doc/html/api/lxml.tests.test_xslt.Py3XSLTTestCase-class.html +doc/html/api/lxml.usedoctest-module.html +doc/html/api/lxml.usedoctest-pysrc.html +doc/html/api/mimetools.Message-class.html +doc/html/api/module-tree.html +doc/html/api/redirect.html +doc/html/api/str-class.html +doc/html/api/toc-everything.html +doc/html/api/toc-lxml-module.html +doc/html/api/toc-lxml.ElementInclude-module.html +doc/html/api/toc-lxml.builder-module.html +doc/html/api/toc-lxml.cssselect-module.html +doc/html/api/toc-lxml.doctestcompare-module.html +doc/html/api/toc-lxml.etree-module.html +doc/html/api/toc-lxml.html-module.html +doc/html/api/toc-lxml.html.ElementSoup-module.html +doc/html/api/toc-lxml.html.builder-module.html +doc/html/api/toc-lxml.html.clean-module.html +doc/html/api/toc-lxml.html.defs-module.html +doc/html/api/toc-lxml.html.diff-module.html +doc/html/api/toc-lxml.html.formfill-module.html +doc/html/api/toc-lxml.html.html5parser-module.html +doc/html/api/toc-lxml.html.soupparser-module.html +doc/html/api/toc-lxml.html.usedoctest-module.html +doc/html/api/toc-lxml.includes-module.html +doc/html/api/toc-lxml.isoschematron-module.html +doc/html/api/toc-lxml.objectify-module.html +doc/html/api/toc-lxml.pyclasslookup-module.html +doc/html/api/toc-lxml.sax-module.html +doc/html/api/toc-lxml.tests-module.html +doc/html/api/toc-lxml.tests.common_imports-module.html +doc/html/api/toc-lxml.tests.dummy_http_server-module.html +doc/html/api/toc-lxml.tests.selftest-module.html +doc/html/api/toc-lxml.tests.selftest2-module.html +doc/html/api/toc-lxml.tests.test_builder-module.html +doc/html/api/toc-lxml.tests.test_classlookup-module.html +doc/html/api/toc-lxml.tests.test_css-module.html +doc/html/api/toc-lxml.tests.test_doctestcompare-module.html +doc/html/api/toc-lxml.tests.test_dtd-module.html +doc/html/api/toc-lxml.tests.test_elementpath-module.html +doc/html/api/toc-lxml.tests.test_elementtree-module.html +doc/html/api/toc-lxml.tests.test_errors-module.html +doc/html/api/toc-lxml.tests.test_etree-module.html +doc/html/api/toc-lxml.tests.test_external_document-module.html +doc/html/api/toc-lxml.tests.test_htmlparser-module.html +doc/html/api/toc-lxml.tests.test_http_io-module.html +doc/html/api/toc-lxml.tests.test_incremental_xmlfile-module.html +doc/html/api/toc-lxml.tests.test_io-module.html +doc/html/api/toc-lxml.tests.test_isoschematron-module.html +doc/html/api/toc-lxml.tests.test_nsclasses-module.html +doc/html/api/toc-lxml.tests.test_objectify-module.html +doc/html/api/toc-lxml.tests.test_pyclasslookup-module.html +doc/html/api/toc-lxml.tests.test_relaxng-module.html +doc/html/api/toc-lxml.tests.test_sax-module.html +doc/html/api/toc-lxml.tests.test_schematron-module.html +doc/html/api/toc-lxml.tests.test_threading-module.html +doc/html/api/toc-lxml.tests.test_unicode-module.html +doc/html/api/toc-lxml.tests.test_xmlschema-module.html +doc/html/api/toc-lxml.tests.test_xpathevaluator-module.html +doc/html/api/toc-lxml.tests.test_xslt-module.html +doc/html/api/toc-lxml.usedoctest-module.html +doc/html/api/toc-xml.etree.ElementTree-module.html +doc/html/api/toc.html +doc/html/api/xml.etree.ElementTree-module.html +doc/html/api/xml.etree.ElementTree-pysrc.html +doc/html/api/xml.etree.ElementTree.Element-class.html +doc/html/api/xml.etree.ElementTree.ElementTree-class.html +doc/html/api/xml.etree.ElementTree.ParseError-class.html +doc/html/api/xml.etree.ElementTree.QName-class.html +doc/html/api/xml.etree.ElementTree.TreeBuilder-class.html +doc/html/api/xml.etree.ElementTree.XMLParser-class.html +doc/html/api/xml.etree.ElementTree._IterParseIterator-class.html +doc/html/api/xml.etree.ElementTree._SimpleElementPath-class.html doc/licenses/BSD.txt doc/licenses/GPL.txt doc/licenses/ZopePublicLicense.txt doc/licenses/elementtree.txt +doc/pdf/pubkey.asc doc/s5/Makefile +doc/s5/lxml-ep2008.html doc/s5/lxml-ep2008.txt doc/s5/tagpython.png doc/s5/ep2008/atom-example.xml diff --git a/src/lxml/etree.c b/src/lxml/etree.c index c81bb3b6..3b429f1d 100644 --- a/src/lxml/etree.c +++ b/src/lxml/etree.c @@ -80295,7 +80295,7 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob * def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True): * _assertValidNode(element) # <<<<<<<<<<<<<< * if with_tail: - * events = (u"start", u"end") + * events = (u"start", u"comment", u"pi", u"end") */ __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2967, __pyx_L1_error) @@ -80303,7 +80303,7 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob * def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True): * _assertValidNode(element) * if with_tail: # <<<<<<<<<<<<<< - * events = (u"start", u"end") + * events = (u"start", u"comment", u"pi", u"end") * else: */ __pyx_t_2 = (__pyx_v_with_tail != 0); @@ -80312,9 +80312,9 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob /* "lxml/etree.pyx":2969 * _assertValidNode(element) * if with_tail: - * events = (u"start", u"end") # <<<<<<<<<<<<<< + * events = (u"start", u"comment", u"pi", u"end") # <<<<<<<<<<<<<< * else: - * events = (u"start",) + * events = (u"start", u"comment", u"pi") */ __Pyx_INCREF(__pyx_tuple__44); __pyx_v_events = __pyx_tuple__44; @@ -80323,16 +80323,16 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob * def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True): * _assertValidNode(element) * if with_tail: # <<<<<<<<<<<<<< - * events = (u"start", u"end") + * events = (u"start", u"comment", u"pi", u"end") * else: */ goto __pyx_L3; } /* "lxml/etree.pyx":2971 - * events = (u"start", u"end") + * events = (u"start", u"comment", u"pi", u"end") * else: - * events = (u"start",) # <<<<<<<<<<<<<< + * events = (u"start", u"comment", u"pi") # <<<<<<<<<<<<<< * self._start_element = element * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ */ @@ -80344,7 +80344,7 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob /* "lxml/etree.pyx":2972 * else: - * events = (u"start",) + * events = (u"start", u"comment", u"pi") * self._start_element = element # <<<<<<<<<<<<<< * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ * @@ -80356,7 +80356,7 @@ static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_ob __pyx_v_self->_start_element = __pyx_v_element; /* "lxml/etree.pyx":2973 - * events = (u"start",) + * events = (u"start", u"comment", u"pi") * self._start_element = element * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ # <<<<<<<<<<<<<< * @@ -241343,22 +241343,22 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "lxml/etree.pyx":2969 * _assertValidNode(element) * if with_tail: - * events = (u"start", u"end") # <<<<<<<<<<<<<< + * events = (u"start", u"comment", u"pi", u"end") # <<<<<<<<<<<<<< * else: - * events = (u"start",) + * events = (u"start", u"comment", u"pi") */ - __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_u_start, __pyx_n_u_end); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 2969, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(4, __pyx_n_u_start, __pyx_n_u_comment, __pyx_n_u_pi, __pyx_n_u_end); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 2969, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__44); __Pyx_GIVEREF(__pyx_tuple__44); /* "lxml/etree.pyx":2971 - * events = (u"start", u"end") + * events = (u"start", u"comment", u"pi", u"end") * else: - * events = (u"start",) # <<<<<<<<<<<<<< + * events = (u"start", u"comment", u"pi") # <<<<<<<<<<<<<< * self._start_element = element * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_u_start); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 2971, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(3, __pyx_n_u_start, __pyx_n_u_comment, __pyx_n_u_pi); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 2971, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); diff --git a/src/lxml/etree.pyx b/src/lxml/etree.pyx index db95f307..5f44df30 100644 --- a/src/lxml/etree.pyx +++ b/src/lxml/etree.pyx @@ -2966,9 +2966,9 @@ cdef class ElementTextIterator: def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True): _assertValidNode(element) if with_tail: - events = (u"start", u"end") + events = (u"start", u"comment", u"pi", u"end") else: - events = (u"start",) + events = (u"start", u"comment", u"pi") self._start_element = element self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ diff --git a/src/lxml/includes/lxml-version.h b/src/lxml/includes/lxml-version.h index 476d76ba..6fb21b7c 100644 --- a/src/lxml/includes/lxml-version.h +++ b/src/lxml/includes/lxml-version.h @@ -1,3 +1,3 @@ #ifndef LXML_VERSION_STRING -#define LXML_VERSION_STRING "4.4.2" +#define LXML_VERSION_STRING "4.4.3" #endif diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py index afe5818b..027aae8a 100644 --- a/src/lxml/tests/test_etree.py +++ b/src/lxml/tests/test_etree.py @@ -1448,6 +1448,17 @@ class ETreeOnlyTestCase(HelperTestCase): [1,2,1,4], counts) + def test_itertext_comment_pi(self): + # https://bugs.launchpad.net/lxml/+bug/1844674 + XML = self.etree.XML + root = XML(_bytes( + "RTEXTATAILCTAIL PITAIL " + )) + + text = list(root.itertext()) + self.assertEqual(["RTEXT", "ATAIL", "CTAIL", " PITAIL "], + text) + def test_resolve_string_dtd(self): parse = self.etree.parse parser = self.etree.XMLParser(dtd_validation=True) diff --git a/version.txt b/version.txt index 1d068c6e..9e3a9335 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -4.4.2 +4.4.3