annotate Lib/xml.py @ 39042:c02fa187e0f4 legacy-trunk

Part of SF patch #1484695. This removes dead code. The chksum was already verified in .frombuf() on the lines above. If there was a problem an exception is raised, so there was no way this condition could have been true.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 10 Jul 2006 00:23:17 +0000
parents bfd6a6fc70ea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 """Core XML support for Python.
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2
36008
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
3 This package contains four sub-packages:
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 dom -- The W3C Document Object Model. This supports DOM Level 1 +
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 Namespaces.
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7
13779
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
8 parsers -- Python wrappers for XML parsers (currently only supports Expat).
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10 sax -- The Simple API for XML, developed by XML-Dev, led by David
15307
f8721e849424 Make reindent.py happy (lots of trailing whitespace removed).
Fred Drake <fdrake@acm.org>
parents: 14847
diff changeset
11 Megginson and ported to Python by Lars Marius Garshol. This
13284
5102effb0c4b Reference cycle fixes
Paul Prescod <prescod@prescod.net>
parents: 13142
diff changeset
12 supports the SAX 2 API.
36008
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
13
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
14 etree -- The ElementTree XML library. This is a subset of the full
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
15 ElementTree XML release.
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
16
13142
f86ea5a69c5e Package docstring.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 """
13779
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
18
36020
bfd6a6fc70ea move the xml package implementation to xmlcore, and adjust the tests to
Fred Drake <fdrake@acm.org>
parents: 36013
diff changeset
19 import sys
bfd6a6fc70ea move the xml package implementation to xmlcore, and adjust the tests to
Fred Drake <fdrake@acm.org>
parents: 36013
diff changeset
20 import xmlcore
13779
ab42d4542424 Add magic to replace the xml package with _xmlplus at import time.
Fred Drake <fdrake@acm.org>
parents: 13307
diff changeset
21
36008
102140c3a361 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
Fredrik Lundh <fredrik@pythonware.com>
parents: 34031
diff changeset
22 __all__ = ["dom", "parsers", "sax", "etree"]
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
23
17231
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
24 # When being checked-out without options, this has the form
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
25 # "<dollar>Revision: x.y </dollar>"
bf4cc99d711d Use Guido's trick for always extracting the version number from a
Martin v. Löwis <martin@v.loewis.de>
parents: 16519
diff changeset
26 # When exported using -kv, it is "x.y".
17236
141230956325 Arghh. Fix typo.
Martin v. Löwis <martin@v.loewis.de>
parents: 17231
diff changeset
27 __version__ = "$Revision$".split()[-2:][0]
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
28
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
29
33753
92e05b634997 Require minimally PyXML 0.8.4.
Martin v. Löwis <martin@v.loewis.de>
parents: 27395
diff changeset
30 _MINIMUM_XMLPLUS_VERSION = (0, 8, 4)
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
31
13849
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
32 try:
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
33 import _xmlplus
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
34 except ImportError:
36020
bfd6a6fc70ea move the xml package implementation to xmlcore, and adjust the tests to
Fred Drake <fdrake@acm.org>
parents: 36013
diff changeset
35 sys.modules[__name__] = xmlcore
13849
098825e74a05 Remove the outer test for __name__; not necessary.
Fred Drake <fdrake@acm.org>
parents: 13779
diff changeset
36 else:
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
37 try:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
38 v = _xmlplus.version_info
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
39 except AttributeError:
34031
5be31a207d86 Fix typo in comment.
Walter Dörwald <walter@livinglogic.de>
parents: 33753
diff changeset
40 # _xmlplus is too old; ignore it
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
41 pass
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
42 else:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
43 if v >= _MINIMUM_XMLPLUS_VERSION:
36020
bfd6a6fc70ea move the xml package implementation to xmlcore, and adjust the tests to
Fred Drake <fdrake@acm.org>
parents: 36013
diff changeset
44 _xmlplus.__path__.extend(xmlcore.__path__)
14847
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
45 sys.modules[__name__] = _xmlplus
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
46 else:
f6e501fc32c7 Include the version-detecting code to allow PyXML to override the "standard"
Fred Drake <fdrake@acm.org>
parents: 13849
diff changeset
47 del v