Fred Drake | e85c350 | 2000-06-29 19:28:01 +0000 | [diff] [blame] | 1 | """Core XML support for Python. |
| 2 | |
Fredrik Lundh | 7e0aef0 | 2005-12-12 18:54:55 +0000 | [diff] [blame] | 3 | This package contains four sub-packages: |
Fred Drake | e85c350 | 2000-06-29 19:28:01 +0000 | [diff] [blame] | 4 | |
| 5 | dom -- The W3C Document Object Model. This supports DOM Level 1 + |
| 6 | Namespaces. |
| 7 | |
Fred Drake | 327e187 | 2000-08-01 00:05:16 +0000 | [diff] [blame] | 8 | parsers -- Python wrappers for XML parsers (currently only supports Expat). |
Fred Drake | e85c350 | 2000-06-29 19:28:01 +0000 | [diff] [blame] | 9 | |
| 10 | sax -- The Simple API for XML, developed by XML-Dev, led by David |
Fred Drake | 16f6329 | 2000-10-23 18:09:50 +0000 | [diff] [blame] | 11 | Megginson and ported to Python by Lars Marius Garshol. This |
Paul Prescod | 73678da | 2000-07-01 04:58:47 +0000 | [diff] [blame] | 12 | supports the SAX 2 API. |
Fredrik Lundh | 7e0aef0 | 2005-12-12 18:54:55 +0000 | [diff] [blame] | 13 | |
| 14 | etree -- The ElementTree XML library. This is a subset of the full |
| 15 | ElementTree XML release. |
| 16 | |
Fred Drake | e85c350 | 2000-06-29 19:28:01 +0000 | [diff] [blame] | 17 | """ |
Fred Drake | 327e187 | 2000-08-01 00:05:16 +0000 | [diff] [blame] | 18 | |
Fred Drake | c6730e1 | 2005-12-14 06:20:35 +0000 | [diff] [blame] | 19 | import sys |
| 20 | import xmlcore |
Fred Drake | 327e187 | 2000-08-01 00:05:16 +0000 | [diff] [blame] | 21 | |
Fredrik Lundh | 7e0aef0 | 2005-12-12 18:54:55 +0000 | [diff] [blame] | 22 | __all__ = ["dom", "parsers", "sax", "etree"] |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 23 | |
Martin v. Löwis | c9494ac | 2001-03-27 08:42:12 +0000 | [diff] [blame] | 24 | # When being checked-out without options, this has the form |
| 25 | # "<dollar>Revision: x.y </dollar>" |
| 26 | # When exported using -kv, it is "x.y". |
Martin v. Löwis | 764dad5 | 2001-03-27 21:38:15 +0000 | [diff] [blame] | 27 | __version__ = "$Revision$".split()[-2:][0] |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 28 | |
| 29 | |
Martin v. Löwis | 4b9059b | 2004-10-13 19:57:14 +0000 | [diff] [blame] | 30 | _MINIMUM_XMLPLUS_VERSION = (0, 8, 4) |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 31 | |
Fred Drake | 5750017 | 2000-08-04 03:14:55 +0000 | [diff] [blame] | 32 | try: |
| 33 | import _xmlplus |
| 34 | except ImportError: |
Fred Drake | c6730e1 | 2005-12-14 06:20:35 +0000 | [diff] [blame] | 35 | sys.modules[__name__] = xmlcore |
Fred Drake | 5750017 | 2000-08-04 03:14:55 +0000 | [diff] [blame] | 36 | else: |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 37 | try: |
| 38 | v = _xmlplus.version_info |
| 39 | except AttributeError: |
Walter Dörwald | f7f9b6c | 2004-11-25 12:23:23 +0000 | [diff] [blame] | 40 | # _xmlplus is too old; ignore it |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 41 | pass |
| 42 | else: |
| 43 | if v >= _MINIMUM_XMLPLUS_VERSION: |
Fred Drake | c6730e1 | 2005-12-14 06:20:35 +0000 | [diff] [blame] | 44 | _xmlplus.__path__.extend(xmlcore.__path__) |
Fred Drake | af57431 | 2000-09-25 17:30:17 +0000 | [diff] [blame] | 45 | sys.modules[__name__] = _xmlplus |
| 46 | else: |
| 47 | del v |