diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:59:09 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:59:09 +0000 |
commit | e41251e864e94885d785b5a9bf8f824753316296 (patch) | |
tree | f530db7682d71f4920b22b8d7f84c89727647ab5 /Doc/library/xml.etree.elementtree.rst | |
parent | 768db92b438038586c1580b711c528363a97d3f4 (diff) | |
download | cpython-git-e41251e864e94885d785b5a9bf8f824753316296.tar.gz |
Merged revisions 62490 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62490 | benjamin.peterson | 2008-04-24 20:29:10 -0500 (Thu, 24 Apr 2008) | 2 lines
reformat some documentation of classes so methods and attributes are under the class directive
........
Diffstat (limited to 'Doc/library/xml.etree.elementtree.rst')
-rw-r--r-- | Doc/library/xml.etree.elementtree.rst | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 61bc55907a..fde4fa68d6 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -304,61 +304,63 @@ ElementTree Objects XML *file* if given. -.. method:: ElementTree._setroot(element) + .. method:: _setroot(element) - Replaces the root element for this tree. This discards the current contents of - the tree, and replaces it with the given element. Use with care. *element* is - an element instance. + Replaces the root element for this tree. This discards the current + contents of the tree, and replaces it with the given element. Use with + care. *element* is an element instance. -.. method:: ElementTree.find(path) + .. method:: find(path) - Finds the first toplevel element with given tag. Same as getroot().find(path). - *path* is the element to look for. Returns the first matching element, or - ``None`` if no element was found. + Finds the first toplevel element with given tag. Same as + getroot().find(path). *path* is the element to look for. Returns the + first matching element, or ``None`` if no element was found. -.. method:: ElementTree.findall(path) + .. method:: findall(path) - Finds all toplevel elements with the given tag. Same as getroot().findall(path). - *path* is the element to look for. Returns a list or :term:`iterator` containing all - matching elements, in document order. + Finds all toplevel elements with the given tag. Same as + getroot().findall(path). *path* is the element to look for. Returns a + list or :term:`iterator` containing all matching elements, in document + order. -.. method:: ElementTree.findtext(path[, default]) + .. method:: findtext(path[, default]) - Finds the element text for the first toplevel element with given tag. Same as - getroot().findtext(path). *path* is the toplevel element to look for. *default* - is the value to return if the element was not found. Returns the text content of - the first matching element, or the default value no element was found. Note - that if the element has is found, but has no text content, this method returns - an empty string. + Finds the element text for the first toplevel element with given tag. + Same as getroot().findtext(path). *path* is the toplevel element to look + for. *default* is the value to return if the element was not + found. Returns the text content of the first matching element, or the + default value no element was found. Note that if the element has is + found, but has no text content, this method returns an empty string. -.. method:: ElementTree.getiterator([tag]) + .. method:: getiterator([tag]) - Creates and returns a tree iterator for the root element. The iterator loops - over all elements in this tree, in section order. *tag* is the tag to look for - (default is to return all elements) + Creates and returns a tree iterator for the root element. The iterator + loops over all elements in this tree, in section order. *tag* is the tag + to look for (default is to return all elements) -.. method:: ElementTree.getroot() + .. method:: getroot() - Returns the root element for this tree. + Returns the root element for this tree. -.. method:: ElementTree.parse(source[, parser]) + .. method:: parse(source[, parser]) - Loads an external XML section into this element tree. *source* is a file name or - file object. *parser* is an optional parser instance. If not given, the - standard XMLTreeBuilder parser is used. Returns the section root element. + Loads an external XML section into this element tree. *source* is a file + name or file object. *parser* is an optional parser instance. If not + given, the standard XMLTreeBuilder parser is used. Returns the section + root element. -.. method:: ElementTree.write(file[, encoding]) + .. method:: write(file[, encoding]) - Writes the element tree to a file, as XML. *file* is a file name, or a file - object opened for writing. *encoding* [1]_ is the output encoding (default is - US-ASCII). + Writes the element tree to a file, as XML. *file* is a file name, or a + file object opened for writing. *encoding* [1]_ is the output encoding + (default is US-ASCII). This is the XML file that is going to be manipulated:: @@ -419,28 +421,28 @@ TreeBuilder Objects Element instances when given. -.. method:: TreeBuilder.close() + .. method:: close() - Flushes the parser buffers, and returns the toplevel document element. Returns an - Element instance. + Flushes the parser buffers, and returns the toplevel document + element. Returns an Element instance. -.. method:: TreeBuilder.data(data) + .. method:: data(data) - Adds text to the current element. *data* is a string. This should be either an - ASCII-only :class:`bytes` object or a :class:`str` object. + Adds text to the current element. *data* is a string. This should be + either an ASCII-only :class:`bytes` object or a :class:`str` object. -.. method:: TreeBuilder.end(tag) + .. method:: end(tag) - Closes the current element. *tag* is the element name. Returns the closed - element. + Closes the current element. *tag* is the element name. Returns the closed + element. -.. method:: TreeBuilder.start(tag, attrs) + .. method:: start(tag, attrs) - Opens a new element. *tag* is the element name. *attrs* is a dictionary - containing element attributes. Returns the opened element. + Opens a new element. *tag* is the element name. *attrs* is a dictionary + containing element attributes. Returns the opened element. .. _elementtree-xmltreebuilder-objects: @@ -457,20 +459,20 @@ XMLTreeBuilder Objects instance of the standard TreeBuilder class. -.. method:: XMLTreeBuilder.close() + .. method:: close() - Finishes feeding data to the parser. Returns an element structure. + Finishes feeding data to the parser. Returns an element structure. -.. method:: XMLTreeBuilder.doctype(name, pubid, system) + .. method:: doctype(name, pubid, system) - Handles a doctype declaration. *name* is the doctype name. *pubid* is the public - identifier. *system* is the system identifier. + Handles a doctype declaration. *name* is the doctype name. *pubid* is the + public identifier. *system* is the system identifier. -.. method:: XMLTreeBuilder.feed(data) + .. method:: feed(data) - Feeds data to the parser. *data* is encoded data. + Feeds data to the parser. *data* is encoded data. :meth:`XMLTreeBuilder.feed` calls *target*\'s :meth:`start` method for each opening tag, its :meth:`end` method for each closing tag, |