Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • 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=====================================================
    43
    54.. module:: xml.dom.minidom
    6    :synopsis: Lightweight Document Object Model (DOM) implementation.
     5   :synopsis: Minimal Document Object Model (DOM) implementation.
    76.. moduleauthor:: Paul Prescod <paul@prescod.net>
    87.. sectionauthor:: Paul Prescod <paul@prescod.net>
     
    1211.. versionadded:: 2.0
    1312
    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
     18Model interface, with an API similar to that in other languages.  It is intended
     19to be simpler than the full DOM and also significantly smaller.  Users who are
     20not 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
    1730
    1831DOM applications typically start by parsing some XML into a DOM.  With
     
    4659
    4760   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`.
    4962
    5063Both functions return a :class:`Document` object representing the content of the
     
    8699   assert dom3.documentElement.tagName == "myxml"
    87100
    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 
     101When you are finished with a DOM tree, you may optionally call the
     102:meth:`unlink` method to encourage early cleanup of the now-unneeded
     103objects.  :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific
     104extension to the DOM API that renders the node and its descendants are
     105essentially useless.  Otherwise, Python's garbage collector will
     106eventually take care of the objects in the tree.
    104107
    105108.. seealso::
     
    129132
    130133
    131 .. method:: Node.writexml(writer[, indent=""[, addindent=""[, newl=""[, encoding=""]]]])
     134.. method:: Node.writexml(writer, indent="", addindent="", newl="")
    132135
    133136   Write XML to the writer object.  The writer should have a :meth:`write` method
     
    137140   specifies the string to use to terminate newlines.
    138141
     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
    139145   .. versionchanged:: 2.1
    140146      The optional keyword parameters *indent*, *addindent*, and *newl* were added to
Note: See TracChangeset for help on using the changeset viewer.