source: exist/trunk/python/elementtree-1.3a6-20070220-badc/CHANGES @ 3578

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/python/elementtree-1.3a6-20070220-badc/CHANGES@3578
Revision 3578, 13.3 KB checked in by pjkersha, 11 years ago (diff)

Latest releases from Fredrik Lundh. 10 March release has exclusive C14N support with namespace prefixes.

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