source: exist/trunk/python/elementtree-1.3a6-20070212-badc/CHANGES @ 3429

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/python/elementtree-1.3a6-20070212-badc/CHANGES@4663
Revision 3429, 12.8 KB checked in by pjkersha, 12 years ago (diff)

Added latest ElementTree version (12/2/08) from Fredrik Lundh

Line 
1The ElementTree Library
2$Id: CHANGES 3375 2008-02-13 08:05:08Z fredrik $
3
4*** Changes from release 1.2 to 1.3 ***
5
6(1.3a5 released)
7
8- Added the ElementC14N module, including a "c14n" output method for
9  the standard "write" method.
10
11  Note that "write" creates custom namespace prefixes also in "c14n"
12  mode.  To preserve existing prefixes, you can use the "parse" and
13  "write" methods in the ElementC14N method:
14
15      tree = ElementC14N.parse(file)
16      ElementC14N.write(tree, outfile)
17
18  The tree returned by ElementC14N.parse contains additional scope
19  information.  This tree only supports limited modifications; you
20  or modify text content and attribute values, but changes to the
21  element structure are not supported if you want to use the
22  ElementC14N.write to write it out (you can still save a modified
23  tree using the standard "write" method).
24
25(1.3a4 released)
26
27- Added optional namespaces keyword argument to all find methods.  If
28  given, this should map from prefixes to URI:s, and is used to expand
29  path specifications of the form prefix:uri.  The following two calls
30  are equivalent:
31
32     elem.findall(".//{http://spam}egg")
33     elem.findall(".//spam:egg", namespaces=dict(spam="http://spam"))
34
35- Assorted alpha bug fixes (based on input from Stefan Behnel, Berco
36  Beute, and others).
37
38- Split selftest.py into a series of unittests/test*.py scripts; use
39  selftest.py or unittests/run.py to run the test suite.
40
41- Changed "findall" and "getiterator" to return sequences, not
42  iterators, to improve compatibility with 1.2 and lxml.etree.
43
44- Added "iterfind".  This is the same as "findall", but returns an
45  iterator instead.  You can use this to loop over a portion of the
46  tree, when you need more than one match.
47
48- Changed serializer to output xmlns attributes *before* other
49  attributes (for C14N compatibility).
50
51- Added support for [index], [last()], and [last()-index] predicates.
52
53- Fixed parent selector to only report each parent once (oops!).
54
55- Fixed Python 2.3 compatibility, and made 2.3 the baseline version
56  (for now, at least).
57
58(1.3a3 released)
59
60- Added new path engine, for "find", "findall", and "findtext".  The
61  new engine is a bit faster, and supports a number of predicates
62  forms: [@attr], [@attr='value'], and [tag] (in the last case, only
63  single tag names are supported).  The engine also provides limited
64  support for the ".." parent selector; you can use it inside the
65  subtree, but it cannot go above the context element (the element
66  you called "find" on).
67
68- Added "extend" method to Element.
69
70- Added "iter" method to Element and ElementTree.  This replaces
71  "getiterator" (the old name is still available for compatibility).
72  Both "iter" and "getiterator" are now true generators; to get the
73  old ET behaviour, use list() to convert the generator to a list:
74
75     for elem in list(root.iter()):
76        ...
77
78- (experimental) Added "itertext" method to Element and ElementTree.
79  This returns a generated sequence of all character data sections
80  inside the given element.  Use "".join(elem.itertext()) to quickly
81  get all text inside an element.
82
83- (experimental) Added "method" option to the "write" method, and
84  added support for "xml" (standard serialization) "html", and
85  "text".
86
87  The "xml" method is the standard ElementTree serializer.
88
89  The "html" method omits end tags for empty HTML elements, handles
90  "script" and "style" tags correctly, etc.  Note that the HTML
91  serializer is experimental, and the output may be improved in
92  future versions.
93
94  The "text" method only includes "text" and "tail" content, encoded
95  in the given encoding, and without any escaping.
96
97- Added "default_namespace" option to the "write" method.  This option
98  adds an "xmlns" attribute to the root element, and disables prefix
99  generation for the given default namespace.
100
101  Note that all element names in the tree must be qualified if this
102  option is used; the serializer doesn't support undeclaring of prefixes.
103
104- Fixed Comment serialization; the serialization no longer inserts
105  extra spaces around the comment text.
106
107- Fixed "NameError" exception in the 'register_namespace' helper.
108
109(1.3a2 released)
110
111- Raise "ET.ParseError" for XML errors found by the parser, no matter
112  that the error actually was.  "ParseError" is a subclass of Syntax-
113  Error, so code written for cElementTree still works.
114
115- Changed serializer to place all namespace declarations on the
116  root element.
117
118- Changed serializer to omits start and end tags for elements that
119  have the "tag" attribute set to None.
120
121- Fixed serialization of newlines in attribute values.
122
123- Added "target" and "version" attributes to the XMLParser class.
124
125- Added support for optional "doctype" hook to XMLParser.
126
127- Added future warnings for "if e" (use explicit len(e) or is None
128  test) and "e.getchildren()" (use list(e) or iteration).
129
130- Added future warnings for tree.find("/tag") and similar searches,
131  which are broken in 1.3 and earlier.
132
133- Removed old SgmlopXMLTreeBuilder.py and XMLTreeBuilder.py modules.
134
135- Deprecated SimpleXMLTreeBuilder.py on all platforms except Jython.
136
137(1.3a1 released)
138
139- Added 'tostringlist' and 'fromstringlist' helper functions.  These
140  are similar to 'tostring' and 'fromstring', but work on sequences of
141  string fragments, rather than entire strings.
142
143- Added xml_declaration option to serializer.  If set to a true
144  value, the xml declaration is always written.  If set to a false
145  value (except None), it's never written.  If omitted, it's written
146  only if the file is using a non-default encoding (i.e. not utf-8
147  or us-ascii).
148
149- (experimental) Added 'register_namespace' helper.  This can be used
150  to register well-known prefixes for given namespace URI:s, for use
151  when serializing.  Note that the namespace mapping is a global
152  setting.
153
154- Renamed XMLTreeBuilder to XMLParser, as a first step in sorting
155  out the TreeBuilder vs. TreeBuilder mess.  The old name is still
156  available, of course.
157
158- Change Element to be the reference implementation, rather than a
159  factory function.  Removed the _ElementInterface class.
160
161*** Changes from release 1.1 to 1.2 ***
162
163(1.2.6 released)
164
165- Fixed handling of entities defined in internal DTD's (reported
166  by Greg Wilson).
167
168- Fixed serialization under non-standard default encodings (but
169  using non-standard default encodings is still a lousy idea ;-)
170
171(1.2.5 released)
172
173- Added 'iterparse' implementation.  This is similar to 'parse', but
174  returns a stream of events while it builds the tree.  By default,
175  the parser only returns "end" events (for completed elements):
176
177        for event, elem in iterparse(source):
178            ...
179
180  To get other events, use the "events" option to pass in a tuple
181  containing the events you want:
182
183        for event, elem in iterparse(source, events=(...)):
184            ...
185
186  The event tuple can contain one or more of:
187
188  "start"
189    generated for start tags, after the element has been created
190    (but before the current element has been fully populated)
191  "end"
192    generated for end tags, after all element children has been
193    created.
194  "start-ns"
195    generated when a new namespace scope is opened.  for this event,
196    the elem value is a (prefix, url) tuple.
197  "end-ns"
198    generated when the current namespace scope is closed.  elem
199    is None.
200
201  Events arrive asynchronously; the tree is usually more complete
202  than the events indicate, but this is nothing you can rely on.
203
204  The iterable itself contains context information.  In the current
205  release, the only public context attribute is "root", which is set
206  to the root element when parsing is finished.  To access the con-
207  text, assign the iterable to a variable before looping over it:
208
209        context = iterparse(source)
210        for event, elem in context:
211            ...
212        root = context.root
213
214(1.2.4 released)
215
216- Fixed another FancyTreeBuilder bug on Python 2.3.
217
218(1.2.3 released)
219
220- Fixed the FancyTreeBuilder class, which was broken in 1.2.1
221  and 1.2.2 (broken for some Python versions, at least).
222
223(1.2.2 released)
224
225- Fixed some ASCII/Unicode issues in the HTML parser.  You can now
226  use the parser on documents that mixes encoded 8-bit data with
227  character references outside the ASCII range. (backported from 1.3)
228
229(1.2.1 released)
230
231- Changed XMLTreeBuilder to take advantage of new expat features, if
232  present.  This speeds up parsing quite a bit. (backported from 1.3)
233
234(1.2c1 released; 1.2 final released)
235
236- Added 'docs' directory, with PythonDoc documentation for the
237  ElementTree library.  See docs/index.html for an overview.
238
239(1.2b4 released)
240
241- Fixed encoding of Unicode element names and attribute names
242  (reported by Ken Rimey).
243
244(1.2b3 released)
245
246- Added default argument to 'findtext'.  Note that 'findtext' now
247  always returns an empty string if a matching element is found, but
248  has no text content.  None is only returned if no element is found,
249  and no default value is specified.
250
251- Make sure 'dump' adds a trailing linefeed.
252
253(1.2b2 released)
254
255- Added optional tree builder argument to the HTMLTreeBuilder class.
256
257(1.2b1 released)
258
259- Added XMLID() helper.  This is similar to XML(), but returns both
260  the root element and a dictionary mapping ID attributes to elements.
261
262- Added simple SgmlopXMLTreeBuilder module.  This is a very fast
263  parser, but it doesn't yet support namespaces.  To use this parser,
264  you need the sgmlop driver:
265
266      http://effbot.org/zone/sgmlop-index.htm
267
268- Fixed exception in test suite; the TidyHTMLTreeBuilder class
269  now raises a RuntimeError exception if the _elementidy module
270  is not available.
271
272(1.2a5 released)
273
274- Fixed problem that could result in repeated use of the same
275  namespace prefix in the same element (!).
276
277- Fixed import error in ElementInclude, when using the default
278  loader (Gustavo Niemeyer).
279
280(1.2a4 released)
281
282- Fixed exception when .//tag fails to find matching elements
283  (reported by Mike Kent) (@XMLTOOLKIT28)
284
285- Fall back on pre-1.2 find/findtext/findall behaviour if the
286  ElementPath module is not installed.  If you don't need path
287  support, you can simply copy the ElementTree module to your
288  own project.
289
290(1.2a3 released)
291
292- Added experimental support for XInclude-style preprocessing.  The
293  ElementInclude module expands xi:include elements, using a custom
294  resolver.  The current release ignores xi:fallback elements.
295
296- Fixed typo in ElementTree.findtext (reported by Thomas Dartsch)
297  (@XMLTOOLKIT25)
298
299- Fixed parsing of periods in element names (reported by Brian
300  Vicente) (@XMLTOOLKIT27)
301
302(1.2a2 released)
303
304- Fixed serialization of elements and attributes in the XML default
305  namespace (http://www.w3.org/XML/1998/namespace).  Added "rdf" to
306  the set of "well-known" namespace prefixes.
307
308- Added 'makeelement' factory method.  Added 'target' argument to
309  XMLTreeBuilder class.
310
311(1.2a1 released)
312
313- Added support for a very limited subset of the abbreviated XPath
314  syntax.  The following location paths are supported:
315
316        tag -- select all subelements with the given tag
317        . -- select this element
318        * -- select all subelements
319        // (empty path) -- select all subelements, on all levels
320
321  Examples:
322
323        p -- select all p subelements
324        .//a -- select all a sublements, at all sublevels
325        */img -- select all img grandchildren
326        ul/li -- select all li elements that are children of ul elements
327        .//ul/li -- same, but select elements anywhere in the subtree
328
329  Absolute paths (paths starting with a slash) can only be used on
330  ElementTree instances.  To use // on an Element instance, add a
331  leading period (.).
332
333*** Changes from release 1.0 to 1.1 ***
334
335(1.1 final released)
336
337- Added 'fromstring' and 'tostring' helpers.  The 'XML' function is
338  an alias for 'fromstring', and provides a convenient way to add XML
339  literals to source code:
340
341        from elementtree.ElementTree import XML
342
343        element = XML('<element>content</element>')
344
345- Moved XMLTreeBuilder functionality into the ElementTree module.  If
346  all you need is basic XML support, you can simply copy the ElementTree
347  module to your own project.
348
349- Added SimpleXMLWriter module.
350
351(1.1b2 released)
352
353- Changed default encoding to US-ASCII.  Use tree.write(file, "utf-8")
354  to get the old behaviour.  If the tree contains text that cannot be
355  encoded using the given encoding, the writer uses numerical entities
356  for all non-ASCII characters in that text segment.
357
358(1.1b1 released)
359
360- Map tags and attribute names having the same value to the same
361  object.  This saves space when reading large XML trees, and also
362  gives a small speedup (less than 10%).
363
364- Added benchmark script.  This script takes a filename argument, and
365  loads the given file into memory using the XML and SimpleXML tree
366  builders.  For each parser, it reports the document size and the
367  time needed to parse the document.
Note: See TracBrowser for help on using the repository browser.