Home | Trees | Indices | Help |
|
---|
|
object --+ | _ElementTree
|
|||
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
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 |
|
|
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. |
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. |
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. |
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. |
Returns a sequence or iterator of all elements in document order (depth first pre-order), starting with the root element. Can be restricted to find only elements with a specific tag, 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. |
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. |
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 a specific tag, see _Element.iter. |
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. |
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 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'. The exclusive and with_comments arguments are only used with C14N output, where they request exclusive and uncommented C14N serialisation respectively. 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. |
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. |
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. |
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 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. |
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. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Nov 4 09:26:47 2017 | http://epydoc.sourceforge.net |