|
1 # Copyright (C) 2005, Giovanni Bajo |
|
2 # Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc. |
|
3 # |
|
4 # This program is free software; you can redistribute it and/or |
|
5 # modify it under the terms of the GNU General Public License |
|
6 # as published by the Free Software Foundation; either version 2 |
|
7 # of the License, or (at your option) any later version. |
|
8 # |
|
9 # This program is distributed in the hope that it will be useful, |
|
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 # GNU General Public License for more details. |
|
13 # |
|
14 # You should have received a copy of the GNU General Public License |
|
15 # along with this program; if not, write to the Free Software |
|
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|
17 |
|
18 import string |
|
19 attrs = [('Node', 0), |
|
20 ('INDEX_SIZE_ERR', 1), |
|
21 ('DOMSTRING_SIZE_ERR', 2), |
|
22 ('HIERARCHY_REQUEST_ERR', 3), |
|
23 ('WRONG_DOCUMENT_ERR', 4), |
|
24 ('INVALID_CHARACTER_ERR ', 5), |
|
25 ('NO_DATA_ALLOWED_ERR', 6), |
|
26 ('NO_MODIFICATION_ALLOWED_ERR', 7), |
|
27 ('NOT_FOUND_ERR', 8), |
|
28 ('NOT_SUPPORTED_ERR', 9), |
|
29 ('INUSE_ATTRIBUTE_ERR', 10), |
|
30 ('INVALID_STATE_ERR', 11), |
|
31 ('SYNTAX_ERR', 12), |
|
32 ('INVALID_MODIFICATION_ERR', 13), |
|
33 ('NAMESPACE_ERR', 14), |
|
34 ('INVALID_ACCESS_ERR', 15), |
|
35 ('DOMException', 0), |
|
36 ('IndexSizeErr', 0), |
|
37 ('DomstringSizeErr', 0), |
|
38 ('HierarchyRequestErr', 0), |
|
39 ('WrongDocumentErr', 0), |
|
40 ('InvalidCharacterErr', 0), |
|
41 ('NoDataAllowedErr', 0), |
|
42 ('NoModificationAllowedErr', 0), |
|
43 ('NotFoundErr', 0), |
|
44 ('NotSupportedErr', 0), |
|
45 ('InuseAttributeErr', 0), |
|
46 ('InvalidStateErr', 0), |
|
47 ('SyntaxErr', 0), |
|
48 ('InvalidModificationErr', 0), |
|
49 ('NamespaceErr', 0), |
|
50 ('InvalidAccessErr', 0), |
|
51 ('getDOMImplementation', 0), |
|
52 ('registerDOMImplementation', 0), |
|
53 ] |
|
54 |
|
55 def hook(mod): |
|
56 if string.find(mod.__file__, '_xmlplus') > -1: |
|
57 mod.UNSPECIFIED_EVENT_TYPE_ERR = 0 |
|
58 mod.FT_EXCEPTION_BASE = 1000 |
|
59 mod.XML_PARSE_ERR = 1001 |
|
60 mod.BAD_BOUNDARYPOINTS_ERR = 1 |
|
61 mod.INVALID_NODE_TYPE_ERR = 2 |
|
62 mod.EventException = None |
|
63 mod.RangeException = None |
|
64 mod.FtException = None |
|
65 if hasattr(mod, 'DomstringSizeErr'): |
|
66 del mod.DomstringSizeErr |
|
67 mod.DOMStringSizeErr = None |
|
68 mod.UnspecifiedEventTypeErr = None |
|
69 mod.XmlParseErr = None |
|
70 mod.BadBoundaryPointsErr = None |
|
71 mod.InvalidNodeTypeErr = None |
|
72 mod.DOMImplementation = None |
|
73 mod.implementation = None |
|
74 mod.XML_NAMESPACE = None |
|
75 mod.XMLNS_NAMESPACE = None |
|
76 mod.XHTML_NAMESPACE = None |
|
77 mod.DOMExceptionStrings = None |
|
78 mod.EventExceptionStrings = None |
|
79 mod.FtExceptionStrings = None |
|
80 mod.RangeExceptionStrings = None |
|
81 return mod |