Changeset 391 for python/trunk/Doc/library/xml.dom.minidom.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/library/xml.dom.minidom.rst
r2 r391 1 2 :mod:`xml.dom.minidom` --- Lightweight DOM implementation 3 ========================================================= 1 :mod:`xml.dom.minidom` --- Minimal DOM implementation 2 ===================================================== 4 3 5 4 .. module:: xml.dom.minidom 6 :synopsis: LightweightDocument Object Model (DOM) implementation.5 :synopsis: Minimal Document Object Model (DOM) implementation. 7 6 .. moduleauthor:: Paul Prescod <paul@prescod.net> 8 7 .. sectionauthor:: Paul Prescod <paul@prescod.net> … … 12 11 .. versionadded:: 2.0 13 12 14 :mod:`xml.dom.minidom` is a light-weight implementation of the Document Object 15 Model interface. It is intended to be simpler than the full DOM and also 16 significantly smaller. 13 **Source code:** :source:`Lib/xml/dom/minidom.py` 14 15 -------------- 16 17 :mod:`xml.dom.minidom` is a minimal implementation of the Document Object 18 Model interface, with an API similar to that in other languages. It is intended 19 to be simpler than the full DOM and also significantly smaller. Users who are 20 not already proficient with the DOM should consider using the 21 :mod:`xml.etree.ElementTree` module for their XML processing instead 22 23 24 .. warning:: 25 26 The :mod:`xml.dom.minidom` module is not secure against 27 maliciously constructed data. If you need to parse untrusted or 28 unauthenticated data see :ref:`xml-vulnerabilities`. 29 17 30 18 31 DOM applications typically start by parsing some XML into a DOM. With … … 46 59 47 60 Return a :class:`Document` that represents the *string*. This method creates a 48 :class:` StringIO` object for the string and passes that on to :func:`parse`.61 :class:`~StringIO.StringIO` object for the string and passes that on to :func:`parse`. 49 62 50 63 Both functions return a :class:`Document` object representing the content of the … … 86 99 assert dom3.documentElement.tagName == "myxml" 87 100 88 When you are finished with a DOM, you should clean it up. This is necessary 89 because some versions of Python do not support garbage collection of objects 90 that refer to each other in a cycle. Until this restriction is removed from all 91 versions of Python, it is safest to write your code as if cycles would not be 92 cleaned up. 93 94 The way to clean up a DOM is to call its :meth:`unlink` method:: 95 96 dom1.unlink() 97 dom2.unlink() 98 dom3.unlink() 99 100 :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific extension to the DOM API. 101 After calling :meth:`unlink` on a node, the node and its descendants are 102 essentially useless. 103 101 When you are finished with a DOM tree, you may optionally call the 102 :meth:`unlink` method to encourage early cleanup of the now-unneeded 103 objects. :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific 104 extension to the DOM API that renders the node and its descendants are 105 essentially useless. Otherwise, Python's garbage collector will 106 eventually take care of the objects in the tree. 104 107 105 108 .. seealso:: … … 129 132 130 133 131 .. method:: Node.writexml(writer [, indent=""[, addindent=""[, newl=""[, encoding=""]]]])134 .. method:: Node.writexml(writer, indent="", addindent="", newl="") 132 135 133 136 Write XML to the writer object. The writer should have a :meth:`write` method … … 137 140 specifies the string to use to terminate newlines. 138 141 142 For the :class:`Document` node, an additional keyword argument *encoding* can 143 be used to specify the encoding field of the XML header. 144 139 145 .. versionchanged:: 2.1 140 146 The optional keyword parameters *indent*, *addindent*, and *newl* were added to
Note:
See TracChangeset
for help on using the changeset viewer.