CHANGES 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. The ElementTree Library
  2. $Id: CHANGES 2326 2005-03-17 07:45:21Z fredrik $
  3. *** Changes from release 1.1 to 1.2 ***
  4. (1.2.6 released)
  5. - Fixed handling of entities defined in internal DTD's (reported
  6. by Greg Wilson).
  7. - Fixed serialization under non-standard default encodings (but
  8. using non-standard default encodings is still a lousy idea ;-)
  9. (1.2.5 released)
  10. - Added 'iterparse' implementation. This is similar to 'parse', but
  11. returns a stream of events while it builds the tree. By default,
  12. the parser only returns "end" events (for completed elements):
  13. for event, elem in iterparse(source):
  14. ...
  15. To get other events, use the "events" option to pass in a tuple
  16. containing the events you want:
  17. for event, elem in iterparse(source, events=(...)):
  18. ...
  19. The event tuple can contain one or more of:
  20. "start"
  21. generated for start tags, after the element has been created
  22. (but before the current element has been fully populated)
  23. "end"
  24. generated for end tags, after all element children has been
  25. created.
  26. "start-ns"
  27. generated when a new namespace scope is opened. for this event,
  28. the elem value is a (prefix, url) tuple.
  29. "end-ns"
  30. generated when the current namespace scope is closed. elem
  31. is None.
  32. Events arrive asynchronously; the tree is usually more complete
  33. than the events indicate, but this is nothing you can rely on.
  34. The iterable itself contains context information. In the current
  35. release, the only public context attribute is "root", which is set
  36. to the root element when parsing is finished. To access the con-
  37. text, assign the iterable to a variable before looping over it:
  38. context = iterparse(source)
  39. for event, elem in context:
  40. ...
  41. root = context.root
  42. (1.2.4 released)
  43. - Fixed another FancyTreeBuilder bug on Python 2.3.
  44. (1.2.3 released)
  45. - Fixed the FancyTreeBuilder class, which was broken in 1.2.1
  46. and 1.2.2 (broken for some Python versions, at least).
  47. (1.2.2 released)
  48. - Fixed some ASCII/Unicode issues in the HTML parser. You can now
  49. use the parser on documents that mixes encoded 8-bit data with
  50. character references outside the ASCII range. (backported from 1.3)
  51. (1.2.1 released)
  52. - Changed XMLTreeBuilder to take advantage of new expat features, if
  53. present. This speeds up parsing quite a bit. (backported from 1.3)
  54. (1.2c1 released; 1.2 final released)
  55. - Added 'docs' directory, with PythonDoc documentation for the
  56. ElementTree library. See docs/index.html for an overview.
  57. (1.2b4 released)
  58. - Fixed encoding of Unicode element names and attribute names
  59. (reported by Ken Rimey).
  60. (1.2b3 released)
  61. - Added default argument to 'findtext'. Note that 'findtext' now
  62. always returns an empty string if a matching element is found, but
  63. has no text content. None is only returned if no element is found,
  64. and no default value is specified.
  65. - Make sure 'dump' adds a trailing linefeed.
  66. (1.2b2 released)
  67. - Added optional tree builder argument to the HTMLTreeBuilder class.
  68. (1.2b1 released)
  69. - Added XMLID() helper. This is similar to XML(), but returns both
  70. the root element and a dictionary mapping ID attributes to elements.
  71. - Added simple SgmlopXMLTreeBuilder module. This is a very fast
  72. parser, but it doesn't yet support namespaces. To use this parser,
  73. you need the sgmlop driver:
  74. http://effbot.org/zone/sgmlop-index.htm
  75. - Fixed exception in test suite; the TidyHTMLTreeBuilder class
  76. now raises a RuntimeError exception if the _elementidy module
  77. is not available.
  78. (1.2a5 released)
  79. - Fixed problem that could result in repeated use of the same
  80. namespace prefix in the same element (!).
  81. - Fixed import error in ElementInclude, when using the default
  82. loader (Gustavo Niemeyer).
  83. (1.2a4 released)
  84. - Fixed exception when .//tag fails to find matching elements
  85. (reported by Mike Kent) (@XMLTOOLKIT28)
  86. - Fall back on pre-1.2 find/findtext/findall behaviour if the
  87. ElementPath module is not installed. If you don't need path
  88. support, you can simply copy the ElementTree module to your
  89. own project.
  90. (1.2a3 released)
  91. - Added experimental support for XInclude-style preprocessing. The
  92. ElementInclude module expands xi:include elements, using a custom
  93. resolver. The current release ignores xi:fallback elements.
  94. - Fixed typo in ElementTree.findtext (reported by Thomas Dartsch)
  95. (@XMLTOOLKIT25)
  96. - Fixed parsing of periods in element names (reported by Brian
  97. Vicente) (@XMLTOOLKIT27)
  98. (1.2a2 released)
  99. - Fixed serialization of elements and attributes in the XML default
  100. namespace (http://www.w3.org/XML/1998/namespace). Added "rdf" to
  101. the set of "well-known" namespace prefixes.
  102. - Added 'makeelement' factory method. Added 'target' argument to
  103. XMLTreeBuilder class.
  104. (1.2a1 released)
  105. - Added support for a very limited subset of the abbreviated XPath
  106. syntax. The following location paths are supported:
  107. tag -- select all subelements with the given tag
  108. . -- select this element
  109. * -- select all subelements
  110. // (empty path) -- select all subelements, on all levels
  111. Examples:
  112. p -- select all p subelements
  113. .//a -- select all a sublements, at all sublevels
  114. */img -- select all img grandchildren
  115. ul/li -- select all li elements that are children of ul elements
  116. .//ul/li -- same, but select elements anywhere in the subtree
  117. Absolute paths (paths starting with a slash) can only be used on
  118. ElementTree instances. To use // on an Element instance, add a
  119. leading period (.).
  120. *** Changes from release 1.0 to 1.1 ***
  121. (1.1 final released)
  122. - Added 'fromstring' and 'tostring' helpers. The 'XML' function is
  123. an alias for 'fromstring', and provides a convenient way to add XML
  124. literals to source code:
  125. from elementtree.ElementTree import XML
  126. element = XML('<element>content</element>')
  127. - Moved XMLTreeBuilder functionality into the ElementTree module. If
  128. all you need is basic XML support, you can simply copy the ElementTree
  129. module to your own project.
  130. - Added SimpleXMLWriter module.
  131. (1.1b2 released)
  132. - Changed default encoding to US-ASCII. Use tree.write(file, "utf-8")
  133. to get the old behaviour. If the tree contains text that cannot be
  134. encoded using the given encoding, the writer uses numerical entities
  135. for all non-ASCII characters in that text segment.
  136. (1.1b1 released)
  137. - Map tags and attribute names having the same value to the same
  138. object. This saves space when reading large XML trees, and also
  139. gives a small speedup (less than 10%).
  140. - Added benchmark script. This script takes a filename argument, and
  141. loads the given file into memory using the XML and SimpleXML tree
  142. builders. For each parser, it reports the document size and the
  143. time needed to parse the document.