|
| 1 | +$Id: /work/modules/celementtree/CHANGES 1128 2005-12-16T21:57:13.668520Z Fredrik $ |
| 2 | + |
| 3 | +(1.0.5 released) |
| 4 | + |
| 5 | ++ Added support for non-standard encodings. If an unknown encoding |
| 6 | + is reported by expat, cElementTree uses Python's Unicode system to |
| 7 | + generate a decoding table. |
| 8 | + |
| 9 | +(1.0.4 released) |
| 10 | + |
| 11 | ++ Added support for linking against the "pyexpat" library in Python |
| 12 | + 2.5. Define USE_PYEXPAT_CAPI to enable this feature. |
| 13 | + |
| 14 | ++ Minor optimizations. |
| 15 | + |
| 16 | +(1.0.3 released) |
| 17 | + |
| 18 | ++ Use runtime test for figure out if copy workaround is needed. |
| 19 | + |
| 20 | ++ Don't crash in 'parse' if the file object's 'read' method raises |
| 21 | + an unexpected exception (reported by Martin Pool). |
| 22 | + |
| 23 | ++ Added comment and processing instruction support to the XMLParser |
| 24 | + type. The parser now calls 'comment' and 'pi' methods on the target |
| 25 | + object, if available. |
| 26 | + |
| 27 | ++ Make 'iterparse' available under Python 2.1 (requires ElementTree |
| 28 | + 1.2.5 or newer). |
| 29 | + |
| 30 | ++ Report unknown events passed to 'iterparse', rather than ignoring |
| 31 | + them. (Under 2.1, this only works if ElementTree's iterparse does |
| 32 | + this) |
| 33 | + |
| 34 | ++ Added 'Comment' and 'PI'/'ProcessingInstruction' output helpers. |
| 35 | + |
| 36 | +(1.0.2 released) |
| 37 | + |
| 38 | ++ Let Expat use Python's memory allocator. |
| 39 | + |
| 40 | ++ Added missing 'iselement' function (reported by Ken Rimey). |
| 41 | + |
| 42 | ++ Fixed attribute dictionary aliasing bug in 'makeelement' method |
| 43 | + (reported by Ken Rimey). |
| 44 | + |
| 45 | +(1.0.1 released) |
| 46 | + |
| 47 | ++ Added missing 'remove' method (based on code by Michael Droettboom). |
| 48 | + |
| 49 | +(1.0 released) |
| 50 | + |
| 51 | ++ Added a VERSION attribute to the cElementTree module (also available |
| 52 | + as __version__). |
| 53 | + |
| 54 | +(0.9.8 released) |
| 55 | + |
| 56 | ++ Changed the 'iterparse' interface slightly. The context object |
| 57 | + is no longer included in the sequence, and by default, the parser |
| 58 | + only returns "end" events (for completed elements): |
| 59 | + |
| 60 | + for event, elem in iterparse(source): |
| 61 | + ... |
| 62 | + |
| 63 | + To get other events, use the "events" option to pass in a tuple |
| 64 | + containing the events you want: |
| 65 | + |
| 66 | + for event, elem in iterparse(source, events=(...)): |
| 67 | + ... |
| 68 | + |
| 69 | + The event tuple can contain one or more of: |
| 70 | + |
| 71 | + "start" |
| 72 | + generated for start tags, after the element has been created |
| 73 | + (but before the current element has been fully populated) |
| 74 | + "end" |
| 75 | + generated for end tags, after all element children has been |
| 76 | + created. |
| 77 | + "start-ns" |
| 78 | + generated when a new namespace scope is opened. for this event, |
| 79 | + the elem value is a (prefix, url) tuple. |
| 80 | + "end-ns" |
| 81 | + generated when the current namespace scope is closed. elem |
| 82 | + is None. |
| 83 | + |
| 84 | + Events arrive asynchronously; the tree is usually more complete |
| 85 | + than the events indicate, but this is nothing you can rely on. |
| 86 | + |
| 87 | + The iterable itself contains context information. In the current |
| 88 | + release, the only public context attribute is "root", which is set |
| 89 | + to the root element when parsing is finished. To access the con- |
| 90 | + text, assign the iterable to a variable before looping over it: |
| 91 | + |
| 92 | + context = iterparse(source) |
| 93 | + for event, elem in context: |
| 94 | + ... |
| 95 | + root = context.root |
| 96 | + |
| 97 | +(0.9.3 released) |
| 98 | + |
| 99 | ++ Added 'iterparse' function. This is similar to 'parse', but returns |
| 100 | + a stream of events while it builds the tree. Usage: |
| 101 | + |
| 102 | + for context, action, elem in iterparse(source): |
| 103 | + ... |
| 104 | + |
| 105 | + - The context object is a dummy object in the current release. The |
| 106 | + action object is either "start" (for start tags) or "end" (for end |
| 107 | + tags). The elem object is the current element; for "start" events, |
| 108 | + the element itself has been created (including attributes), but its |
| 109 | + contents may not be complete; for "end" events, all child elements |
| 110 | + has been processed as well. You can use "start" tags to count |
| 111 | + elements, check attributes, and check if certain tags are present |
| 112 | + in a tree. For all other purposes, use "end" handlers instead. |
| 113 | + |
| 114 | + - For incremental parsing, call 'elem.clear()' in the "end" handler, |
| 115 | + when you're done processing a given element. |
| 116 | + |
| 117 | + - When the loop finishes, the last elem object will be the tree's |
| 118 | + root note. You can terminate the loop at any time (but doing that |
| 119 | + will of course leave the tree in an unknown, unfinished state). |
| 120 | + |
| 121 | ++ Fixed getchildren crash. Note that getchildren is deprecated; use |
| 122 | + 'elem' or 'list(elem)' instead of 'elem.getchildren()' (elements are |
| 123 | + sequences; only use 'list(elem)' if you need a real list object). |
| 124 | + |
| 125 | ++ Removed the addobserver/removeobserver API from the TreeBuilder class. |
| 126 | + Use 'iterparse' instead. |
| 127 | + |
| 128 | +(0.9.2 released) |
0 commit comments