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

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