1
2
3
4
5
6
7
8
9
10
11
12
13 """
14 Apply local overrides to the current map.
15 Overrides defined in a xml document.
16 """
17
18 import libxml2
19 import errors
20
21
23 """
24 Apply local overrides to the current map. Overrides defined in a xml document.
25 """
26 - def __init__(self, map_root, override_file, icvn, vriic, fic):
27 map_file = None
28 try:
29 reader = libxml2.newTextReaderFilename(map_file)
30 except:
31 raise errors.EngineError, 'Map file not found: %s' % (map_file)
32
33 NodeType = {'element_start': 1, 'element_end': 15, 'attrib': 2, \
34 'text': 3, 'CData': 4, 'entity_ref': 5, 'entity_decl':6, \
35 'pi': 7, 'comment': 8, 'doc': 9, 'dtd': 10, 'doc_frag': 11, \
36 'notation': 12}
37
38 while reader.Read():
39
40 if reader.NodeType() == NodeType['element_start'] and reader.Name() == 'version':
41 while reader.MoveToNextAttribute():
42 if reader.Name() == 'icvn':
43 icvn = reader.Value()
44
45 if reader.NodeType() == NodeType['element_end'] and reader.Name() == 'version':
46 icvn = None
47
48 if reader.NodeType() == NodeType['element_start'] and reader.Name() == 'map':
49 file_name = ''
50 while reader.MoveToNextAttribute():
51 if reader.Name() == 'vriic':
52 vriic = reader.Value()
53 elif reader.Name() == 'fic':
54 fic = reader.Value()
55
56 if reader.NodeType() == NodeType['element_end'] and reader.Name() == 'map':
57
58 vriic = None
59 fic = None
60 file_name = None
61
62 if reader.NodeType() == NodeType['text']:
63 file_name = reader.Value()
64
65 - def _set_value(self, map_root, path, variable, value):
67
70
71 - def _reset_list(self, map_root, path, variable, value):
73