blob: 7393c66aa2bc9343f18d6355d9bfaabe62057652 [file] [log] [blame]
Fred Drakee85c3502000-06-29 19:28:01 +00001"""Core XML support for Python.
2
Fredrik Lundh7e0aef02005-12-12 18:54:55 +00003This package contains four sub-packages:
Fred Drakee85c3502000-06-29 19:28:01 +00004
5dom -- The W3C Document Object Model. This supports DOM Level 1 +
6 Namespaces.
7
Fred Drake327e1872000-08-01 00:05:16 +00008parsers -- Python wrappers for XML parsers (currently only supports Expat).
Fred Drakee85c3502000-06-29 19:28:01 +00009
10sax -- The Simple API for XML, developed by XML-Dev, led by David
Fred Drake16f63292000-10-23 18:09:50 +000011 Megginson and ported to Python by Lars Marius Garshol. This
Paul Prescod73678da2000-07-01 04:58:47 +000012 supports the SAX 2 API.
Fredrik Lundh7e0aef02005-12-12 18:54:55 +000013
14etree -- The ElementTree XML library. This is a subset of the full
15 ElementTree XML release.
16
Fred Drakee85c3502000-06-29 19:28:01 +000017"""
Fred Drake327e1872000-08-01 00:05:16 +000018
Fred Drakec6730e12005-12-14 06:20:35 +000019import sys
20import xmlcore
Fred Drake327e1872000-08-01 00:05:16 +000021
Fredrik Lundh7e0aef02005-12-12 18:54:55 +000022__all__ = ["dom", "parsers", "sax", "etree"]
Fred Drakeaf574312000-09-25 17:30:17 +000023
Martin v. Löwisc9494ac2001-03-27 08:42:12 +000024# 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öwis764dad52001-03-27 21:38:15 +000027__version__ = "$Revision$".split()[-2:][0]
Fred Drakeaf574312000-09-25 17:30:17 +000028
29
Martin v. Löwis4b9059b2004-10-13 19:57:14 +000030_MINIMUM_XMLPLUS_VERSION = (0, 8, 4)
Fred Drakeaf574312000-09-25 17:30:17 +000031
Fred Drake57500172000-08-04 03:14:55 +000032try:
33 import _xmlplus
34except ImportError:
Fred Drakec6730e12005-12-14 06:20:35 +000035 sys.modules[__name__] = xmlcore
Fred Drake57500172000-08-04 03:14:55 +000036else:
Fred Drakeaf574312000-09-25 17:30:17 +000037 try:
38 v = _xmlplus.version_info
39 except AttributeError:
Walter Dörwaldf7f9b6c2004-11-25 12:23:23 +000040 # _xmlplus is too old; ignore it
Fred Drakeaf574312000-09-25 17:30:17 +000041 pass
42 else:
43 if v >= _MINIMUM_XMLPLUS_VERSION:
Fred Drakec6730e12005-12-14 06:20:35 +000044 _xmlplus.__path__.extend(xmlcore.__path__)
Fred Drakeaf574312000-09-25 17:30:17 +000045 sys.modules[__name__] = _xmlplus
46 else:
47 del v