Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d61714d2
Commit
d61714d2
authored
Aug 17, 2015
by
Ned Deily
Browse files
Options
Browse Files
Download
Plain Diff
Issue #24079: merge from 3.4
parents
5fbad3c9
eca04457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
Doc/library/xml.etree.elementtree.rst
Doc/library/xml.etree.elementtree.rst
+19
-11
No files found.
Doc/library/xml.etree.elementtree.rst
View file @
d61714d2
...
...
@@ -651,21 +651,29 @@ Element Objects
.. attribute:: text
tail
The *text* attribute can be used to hold additional data associated with
the element. As the name implies this attribute is usually a string but
may be any application-specific object. If the element is created from
an XML file the attribute will contain any text found between the element
tags.
These attributes can be used to hold additional data associated with
the element. Their values are usually strings but may be any
application-specific object. If the element is created from
an XML file, the *text* attribute holds either the text between
the element's start tag and its first child or end tag, or ``None``, and
the *tail* attribute holds either the text between the element's
end tag and the next tag, or ``None``. For the XML data
.. code-block:: xml
.. attribute:: tail
<a><b>
1
<c>
2
<d/>
3
</c></b>
4
</a>
The *tail* attribute can be used to hold additional data associated with
the element. This attribute is usually a string but may be any
application-specific object. If the element is created from an XML file
the attribute will contain any text found after the element's end tag and
before the next tag.
the *a* element has ``None`` for both *text* and *tail* attributes,
the *b* element has *text* ``"1"`` and *tail* ``"4"``,
the *c* element has *text* ``"2"`` and *tail* ``None``,
and the *d* element has *text* ``None`` and *tail* ``"3"``.
To collect the inner text of an element, see :meth:`itertext`, for
example ``"".join(element.itertext())``.
Applications may store arbitrary objects in these attributes.
.. attribute:: attrib
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment