Commit Graph

389 Commits

Author SHA1 Message Date
Eli Bendersky e6a951b83e Cleanup even more dead code 2013-05-19 09:25:52 -07:00
Eli Bendersky c4e98a6a9b Cleanup more old ET library leftovers 2013-05-19 09:24:43 -07:00
Eli Bendersky 46955b2d30 Issue #17988: remove unused alias for Element and rename the used one
Renaming to _Element_Py for clarity and moving it to a more logical location.
_ElementInterface OTOH is unused and is therefore removed.

Close #17988
2013-05-19 09:20:50 -07:00
Eli Bendersky 3a4fbd8241 _elementtree.XMLParser._setevents should support any sequence, not just tuples
Also clean up some code around this
2013-05-19 09:01:49 -07:00
Serhiy Storchaka 3068aed92b Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
characters() and ignorableWhitespace() methods.  Original patch by Sebastian
Ortiz Vasquez.
2013-05-12 17:31:59 +03:00
Serhiy Storchaka 3eab6b363a Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
characters() and ignorableWhitespace() methods.  Original patch by Sebastian
Ortiz Vasquez.
2013-05-12 17:31:16 +03:00
Georg Brandl 2665f21866 merge with 3.3 2013-05-12 12:08:05 +02:00
Georg Brandl 64949fa20e merge with 3.2 2013-05-12 11:52:22 +02:00
Georg Brandl c502df4e3e Issue #17915: Fix interoperability of xml.sax with file objects returned by
codecs.open().
2013-05-12 11:41:12 +02:00
Eli Bendersky c9f5ca232a Remove superfluous try/except 2013-04-20 09:11:37 -07:00
Eli Bendersky bf05df2396 Make license notices more consistent and remove old changelog.
Also remove unused macro.
2013-04-20 05:44:01 -07:00
Antoine Pitrou 5b235d0923 Issue #17741: Add ElementTree.IncrementalParser, an event-driven parser for non-blocking applications. 2013-04-18 19:37:06 +02:00
Victor Stinner 765531d2d0 Issue #17516: use comment syntax for comments, instead of multiline string 2013-03-26 01:11:54 +01:00
Eli Bendersky 72cdb5c39e Issue #11367: fix documentation of some find* methods in ElementTree 2013-03-12 06:04:33 -07:00
Eli Bendersky 7343cb0790 Issue #11367: fix documentation of some find* methods in ElementTree 2013-03-12 06:01:22 -07:00
Eli Bendersky 84fae785ce Issue #16954: Add docstrings for ElementTree
Based on patch by David Lam
2013-03-09 07:12:48 -08:00
Giampaolo Rodola' 2f50aaf2ff modernize some modules' code by using with statement around open() 2013-02-12 02:04:27 +01:00
Serhiy Storchaka 02c2076bd5 Issue #1470548: XMLGenerator now works with binary output streams. 2013-02-10 14:34:53 +02:00
Serhiy Storchaka 9fef188c9e Issue #1470548: XMLGenerator now works with binary output streams. 2013-02-10 14:31:07 +02:00
Serhiy Storchaka 88efc52d74 Issue #1470548: XMLGenerator now works with binary output streams. 2013-02-10 14:29:52 +02:00
Eli Bendersky c4d5e08e3f Issue #9708: Fix support for iterparse(parser=...) argument per documentation.
When _elementtree is imported, iterparse is redefined as a class and the parser
argument was ommitted. Fix this, and add a docstring to the class.
2013-01-24 07:15:46 -08:00
Eli Bendersky aaa9780fe1 Issue #9708: Fix support for iterparse(parser=...) argument per documentation.
When _elementtree is imported, iterparse is redefined as a class and the parser
argument was ommitted. Fix this, and add a docstring to the class.
2013-01-24 07:15:19 -08:00
Eli Bendersky 5c6198b3fd Issue #12323: Strengthen error checking of the position XPath selectors 2013-01-24 06:29:26 -08:00
Ezio Melotti 605a95ae44 #11379: merge with 3.3. 2013-01-22 22:50:06 +02:00
Ezio Melotti 564e4d8dc9 #11379: merge with 3.2. 2013-01-22 22:49:46 +02:00
Ezio Melotti da4b5b82a3 #11379: rephrase minidom documentation to use the term "minimal" instead of "lightweight". Patch by Éric Araujo. 2013-01-22 22:47:57 +02:00
Serhiy Storchaka 9e189f0a28 Cleanup the docs ElementTree a bit. 2013-01-13 22:24:27 +02:00
Serhiy Storchaka f1b045f417 Describe the default_namespace parameter of ElemetTree.write. 2013-01-13 22:04:43 +02:00
Serhiy Storchaka 03530b980e Describe the default_namespace parameter of ElemetTree.write. 2013-01-13 21:58:04 +02:00
Eli Bendersky e9af827fb1 Cleanup the docs ElementTree a bit and describe the default_namespace parameter. In the code, replace the old outdated Doxygen-ish comment above ElementTree.write by a proper docstring. 2013-01-13 06:27:51 -08:00
Eli Bendersky a9a2ef5550 Close #14377: Add a new parameter to ElementTree.write and some module-level
serialization functions - short_empty_elements. It controls how elements
without contents are emitted.

Patch by Serhiy Storchaka. Feature initially proposed by Ariel Poliak.
2013-01-13 06:04:43 -08:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov a191959849 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:27:16 +02:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Antoine Pitrou 997adb5819 Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). 2012-10-04 19:54:53 +02:00
Antoine Pitrou ee329318db Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). 2012-10-04 19:53:29 +02:00
Philip Jenvey fd0d3e5d25 more yield from
patch by Serhiy Storchaka
2012-10-01 15:34:31 -07:00
Ezio Melotti ab9b661fdd #15970: merge with 3.2. 2012-09-19 08:25:01 +03:00
Ezio Melotti c90111f9ab #15970: xml.etree.ElementTree now serializes correctly the empty HTML elements "meta" and "param". 2012-09-19 08:19:12 +03:00
Eli Bendersky f90fc68db4 fix whitespace woes 2012-07-17 15:09:56 +03:00
Eli Bendersky 43cc5f29a8 Optimize tostringlist by taking the stream class outside the function. It's now 2x faster on short calls. Related to #1767933 2012-07-17 15:09:12 +03:00
Eli Bendersky 426e248feb Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working 2012-07-17 05:45:11 +03:00
Eli Bendersky 00f402bfcb Close #1767933: Badly formed XML using etree and utf-16. Patch by Serhiy Storchaka, with some minor fixes by me 2012-07-15 06:02:22 +03:00
Eli Bendersky 8a80502d2c Issue #15296: Fix minidom.toxml/toprettyxml for non-unicode encodings. Patch by Serhiy Storchaka, with some minor style adjustments by me. 2012-07-13 09:52:39 +03:00
Florent Xicluna a1c974a66d Minor refactoring in xml.etree.ElementTree doctype parser. 2012-07-07 13:16:44 +02:00
Eli Bendersky 27cbb19ae5 Removed _SimpleElementPath and its flaky test. The test monkey-patches the module, which causes other failures and fails itself depending on the order tests are run. 2012-06-15 09:03:19 +03:00
Eli Bendersky 64d11e60f2 Replace the iter/itertext methods of Element in _elementtree with true C implementations, instead of the bootstrapped Python code. In addition to being cleaner (removing the last remains of the bootstrapping code in _elementtree), this gives a 10x performance boost for iter() on large documents.
Also reorganized the tests a bit to be more robust.
2012-06-15 07:42:50 +03:00
Eli Bendersky 737b173355 Issue 14814: Add namespaces keyword arg to find(*) methods in _elementtree.
Add attrib keyword to Element and SubElement in _elementtree.
Patch developed with Ezio Melotti.
2012-05-29 06:02:56 +03:00
Eli Bendersky 396e8fcf36 Issue #13782: streamline argument type-checking in ET.Element
append, extend and insert now consistently type-check their argument in both
the C and Python implementations, and raise TypeError for non-Element
argument.

Added tests
2012-03-23 14:24:20 +02:00
Florent Xicluna 8cf4b51fa4 xml.dom.minidom: add more __slots__ to limit resource usage. 2012-03-05 12:37:02 +01:00
Florent Xicluna 6c75301eb6 xml.dom: fix typo, drop unused imports. 2012-03-05 12:35:15 +01:00
Florent Xicluna fb06746852 Flatten nested try ... finally, try ... except. 2012-03-05 11:42:49 +01:00
Florent Xicluna 75b5e7ee15 Issue #14007: accept incomplete TreeBuilder objects (missing start/end/data/close) for the Python implementation as well. Add disabled tests for the doctype() method. 2012-03-05 10:42:19 +01:00
Martin v. Löwis 67245a6ed4 Issue #14168: Check for presence of _attrs before accessing it. 2012-03-05 07:01:49 +01:00
Eli Bendersky 092af1fc5c Issue #14128: Exposing Element as an actual type from _elementtree, rather than a factory function.
This makes the C implementation more aligned with the Python implementation.
Also added some tests to ensure that Element is now a type and that it can
be subclassed.
2012-03-04 07:14:03 +02:00
Martin v. Löwis 7b77188e89 Create _attr/_attrNS lazily. 2012-02-19 20:55:05 +01:00
Martin v. Löwis 14aa280de2 Use __slots__ throughout instead of __dict__, to reduce the memory usage. 2012-02-19 20:25:12 +01:00
Florent Xicluna 1639505c38 fix the _namespace_map cleanup for cElementTree tests. 2012-02-16 23:28:35 +01:00
Florent Xicluna a72a98f24a Issue #13988: cElementTree is deprecated and the _elementtree accelerator is automatically used whenever available. 2012-02-13 11:03:30 +01:00
Florent Xicluna f4bdf4e478 Issue #13988: move the python bootstrap code to cElementTree.py, and remove obsolete code for Python 2.4 and 2.5. 2012-02-11 11:28:16 +01:00
Florent Xicluna 313b2ad1a8 Fix imports in xml.dom. 2011-12-10 21:14:53 +01:00
Ezio Melotti def4728fd6 #4147: merge with 3.2. 2011-11-18 17:36:07 +02:00
Ezio Melotti 8008f2aba0 #4147: minidom's toprettyxml no longer adds whitespace around a text node when it is the only child of an element. Initial patch by Dan Kenigsberg. 2011-11-18 17:34:26 +02:00
Florent Xicluna 91d5193b3a Closes #2892: preserve iterparse events in case of SyntaxError. 2011-11-01 23:31:09 +01:00
Florent Xicluna f24e7e6c41 Merge 3.2: issue #2892 2011-11-01 23:33:14 +01:00
R David Murray 1d30db459d merge #4147: minidom's toprettyxml no longer adds whitespace to text nodes. 2011-10-01 16:22:35 -04:00
R David Murray 791744b070 #4147: minidom's toprettyxml no longer adds whitespace to text nodes.
Patch by Dan Kenigsberg.
2011-10-01 16:19:51 -04:00
Victor Stinner 3663abab59 (merge 3.2) Issue #12451: xml.dom.pulldom: parse() now opens files in binary
mode instead of the text mode (using the locale encoding) to avoid encoding
issues.
2011-07-04 01:27:37 +02:00
Victor Stinner bbdc08ea6e Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
of the text mode (using the locale encoding) to avoid encoding issues.
2011-07-04 01:25:55 +02:00
Victor Stinner 3909da7fca (merge 3.2) Issue #12451: The XInclude default loader of xml.etree now decodes
files from UTF-8 instead of the locale encoding if the encoding is not
specified. It now also opens XML files for the parser in binary mode instead of
the text mode to avoid encoding issues.
2011-06-30 18:11:18 +02:00
Victor Stinner eaf399e335 Issue #12451: The XInclude default loader of xml.etree now decodes files from
UTF-8 instead of the locale encoding if the encoding is not specified. It now
also opens XML files for the parser in binary mode instead of the text mode to
avoid encoding issues.
2011-06-30 18:10:14 +02:00
Benjamin Peterson 8c6f88efa2 remove __version__s dependent on subversion keyword expansion (closes #12221) 2011-05-31 20:52:17 -05:00
Martin v. Löwis 867754e3e3 merge 11164 2011-05-09 08:10:38 +02:00
Martin v. Löwis 2f48d892d4 Stop trying to use _xmlplus in the xml module. Closes #11164.
Patch by Arfrever Frehtes Taifersar Arahesis.
2011-05-09 08:05:43 +02:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Georg Brandl 90b20675bd #10777: fix iteration over dict keys while mutating the dict. 2010-12-28 10:38:33 +00:00
Georg Brandl c95c91880a Guard against rogue tuples. 2010-12-09 18:26:02 +00:00
Georg Brandl b56c0e24d6 #10661: give QName a nicer repr. 2010-12-09 18:10:27 +00:00
Georg Brandl c524cff3d3 Merged revisions 85530,85532-85534,85538-85543,85546-85548 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r85530 | georg.brandl | 2010-10-15 17:32:05 +0200 (Fr, 15 Okt 2010) | 1 line

  Refrain from using inline suites.
........
  r85532 | georg.brandl | 2010-10-15 18:03:02 +0200 (Fr, 15 Okt 2010) | 1 line

  #7771: reference to documentation of dictview methods and operations.
........
  r85533 | georg.brandl | 2010-10-15 18:07:41 +0200 (Fr, 15 Okt 2010) | 1 line

  #9683: remove broken dead code dealing with nested arguments removed from Py3k, and update the docs and docstrings accordingly.
........
  r85534 | georg.brandl | 2010-10-15 18:19:43 +0200 (Fr, 15 Okt 2010) | 1 line

  #9801: document how list and dict proxies created by Managers behave w.r.t. mutable items.
........
  r85538 | georg.brandl | 2010-10-15 18:35:46 +0200 (Fr, 15 Okt 2010) | 1 line

  #7303: add documentation for useful pkgutil functions and classes.
........
  r85539 | georg.brandl | 2010-10-15 18:42:14 +0200 (Fr, 15 Okt 2010) | 1 line

  Fix issue references.
........
  r85540 | georg.brandl | 2010-10-15 18:42:37 +0200 (Fr, 15 Okt 2010) | 1 line

  #6798: fix wrong docs for the arguments to several trace events.
........
  r85541 | georg.brandl | 2010-10-15 18:53:24 +0200 (Fr, 15 Okt 2010) | 1 line

  #4968: updates to inspect.is* function docs.
........
  r85542 | georg.brandl | 2010-10-15 19:01:15 +0200 (Fr, 15 Okt 2010) | 1 line

  #7790: move table of struct_time members to the actual description of struct_time.
........
  r85543 | georg.brandl | 2010-10-15 19:03:02 +0200 (Fr, 15 Okt 2010) | 1 line

  #4785: document strict argument of JSONDecoder, plus add object_pairs_hook in the docstrings.
........
  r85546 | georg.brandl | 2010-10-15 19:58:45 +0200 (Fr, 15 Okt 2010) | 1 line

  #5762: fix handling of empty namespace in minidom, which would result in AttributeError on toxml().
........
  r85547 | georg.brandl | 2010-10-15 20:00:35 +0200 (Fr, 15 Okt 2010) | 1 line

  #6098: Refrain from claiming DOM level 3 conformance in minidom.
........
  r85548 | georg.brandl | 2010-10-15 21:46:19 +0200 (Fr, 15 Okt 2010) | 1 line

  #10072: assume a bit less knowledge of the FTP protocol in the ftplib docs.
........
2010-11-26 08:42:45 +00:00
Senthil Kumaran ec30b3dd8c Fix Issue10205 - XML QName error when different tags have same QName. 2010-11-09 02:36:59 +00:00
Benjamin Peterson 90b60a61d8 close the source's byte stream 2010-10-31 20:03:32 +00:00
Antoine Pitrou e033e06db0 Issue #10093: ResourceWarnings are now issued when files and sockets are
deallocated without explicit closing.  These warnings are silenced by
default, except in pydebug mode.
2010-10-29 10:38:18 +00:00
Antoine Pitrou 0619ae798d Merged revisions 85858 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85858 | antoine.pitrou | 2010-10-27 20:33:30 +0200 (mer., 27 oct. 2010) | 5 lines

  Issue #5027: The standard `xml` namespace is now understood by
  xml.sax.saxutils.XMLGenerator as being bound to
  http://www.w3.org/XML/1998/namespace.  Patch by Troy J. Farrell.
........
2010-10-27 18:37:51 +00:00
Antoine Pitrou 6b03ee6033 Issue #5027: The standard `xml` namespace is now understood by
xml.sax.saxutils.XMLGenerator as being bound to
http://www.w3.org/XML/1998/namespace.  Patch by Troy J. Farrell.
2010-10-27 18:33:30 +00:00
R. David Murray a90032a3fb #1343: Add short_empty_elements option to XMLGenerator.
Patch and tests by Neil Muller.
2010-10-17 22:46:45 +00:00
Georg Brandl 3844f0d7cd #6098: Refrain from claiming DOM level 3 conformance in minidom. 2010-10-15 18:00:35 +00:00
Georg Brandl b9cd72a9f7 #5762: fix handling of empty namespace in minidom, which would result in AttributeError on toxml(). 2010-10-15 17:58:45 +00:00
Georg Brandl 91d2a3fb0e #5355 followup: add unit test for new dictionaries, and provide submodules from xml.parsers.expat as advertised. 2010-10-15 15:25:23 +00:00
Georg Brandl 914a218fbe Merged revisions 82629,82632,82724,82757-82758,82760-82763,82798-82799,82801 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r82629 | georg.brandl | 2010-07-07 20:51:43 +0200 (Mi, 07 Jul 2010) | 1 line

  Make comment out of an awkward note.
........
  r82632 | georg.brandl | 2010-07-07 21:04:36 +0200 (Mi, 07 Jul 2010) | 1 line

  Turn more notes into comments.
........
  r82724 | georg.brandl | 2010-07-09 09:33:15 +0200 (Fr, 09 Jul 2010) | 1 line

  2.7 is now stable.
........
  r82757 | georg.brandl | 2010-07-10 10:58:37 +0200 (Sa, 10 Jul 2010) | 1 line

  Fix markup.
........
  r82758 | georg.brandl | 2010-07-10 12:23:40 +0200 (Sa, 10 Jul 2010) | 1 line

  Emphasize role of count for Pascal string.
........
  r82760 | georg.brandl | 2010-07-10 12:39:57 +0200 (Sa, 10 Jul 2010) | 1 line

  #3214: improve description of duck-typing in glossary.
........
  r82761 | georg.brandl | 2010-07-10 13:40:13 +0200 (Sa, 10 Jul 2010) | 1 line

  #1434090: properly append child in expatbuilder doctype handler.
........
  r82762 | georg.brandl | 2010-07-10 13:51:06 +0200 (Sa, 10 Jul 2010) | 1 line

  #8338: fix outdated class name.
........
  r82763 | georg.brandl | 2010-07-10 14:01:34 +0200 (Sa, 10 Jul 2010) | 1 line

  #8456: fix signature of sqlite3.connect().
........
  r82798 | georg.brandl | 2010-07-11 11:23:11 +0200 (So, 11 Jul 2010) | 1 line

  #6774: explain shutdown() behavior varying with platform.
........
  r82799 | georg.brandl | 2010-07-11 11:26:57 +0200 (So, 11 Jul 2010) | 1 line

  Fix typo.
........
  r82801 | georg.brandl | 2010-07-11 11:33:39 +0200 (So, 11 Jul 2010) | 1 line

  #9184: fix default value for "buffering" param of open().
........
2010-10-06 08:13:26 +00:00
Florent Xicluna ba8a98600e Fix xml.etree.ElementInclude to include the tail of the current node. Issue #6231 2010-08-08 23:08:41 +00:00
Florent Xicluna c17f17294f Issue #8047: Fix the xml.etree serializer to return bytes by default.
Use ``encoding="unicode"`` to generate a Unicode string.
2010-08-08 19:48:29 +00:00
Andrew M. Kuchling 688b9e384e #777884: make .normalize() do nothing for childless nodes, instead of raising an exception 2010-07-25 23:38:47 +00:00
Georg Brandl 297d97241a #1434090: properly append child in expatbuilder doctype handler. 2010-07-10 11:40:13 +00:00
Kristján Valur Jónsson 17173cfe7b http://bugs.python.org/issue8832
Issue minidom.unlink with a context manager
2010-06-09 08:13:42 +00:00
Florent Xicluna f15351d938 Merged revisions 78838-78839,78917,78919,78934,78937 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78838 | florent.xicluna | 2010-03-11 15:36:19 +0100 (jeu, 11 mar 2010) | 2 lines

  Issue #6472: The xml.etree package is updated to ElementTree 1.3.  The cElementTree module is updated too.
........
  r78839 | florent.xicluna | 2010-03-11 16:55:11 +0100 (jeu, 11 mar 2010) | 2 lines

  Fix repr of tree Element on windows.
........
  r78917 | florent.xicluna | 2010-03-13 12:18:49 +0100 (sam, 13 mar 2010) | 2 lines

  Move the xml test data to their own directory.
........
  r78919 | florent.xicluna | 2010-03-13 13:41:48 +0100 (sam, 13 mar 2010) | 2 lines

  Do not chdir when running test_xml_etree, and enhance the findfile helper.
........
  r78934 | florent.xicluna | 2010-03-13 18:56:19 +0100 (sam, 13 mar 2010) | 2 lines

  Update some parts of the xml.etree documentation.
........
  r78937 | florent.xicluna | 2010-03-13 21:30:15 +0100 (sam, 13 mar 2010) | 3 lines

  Add the keyword argument "method=None" to the .write() method and the tostring/tostringlist functions.
  Update the function, class and method signatures, according to the new convention.
........
2010-03-13 23:24:31 +00:00
Antoine Pitrou 99f69ee7a1 Merged revisions 78125 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78125 | antoine.pitrou | 2010-02-09 18:08:05 +0100 (mar., 09 févr. 2010) | 7 lines

  Issue #2746: Don't escape ampersands and angle brackets ("&", "<", ">")
  in XML processing instructions and comments.  These raw characters are
  allowed by the XML specification, and are necessary when outputting e.g.
  PHP code in a processing instruction.  Patch by Neil Muller.
........
2010-02-09 17:25:47 +00:00