18 """ Generates the reprenstation of the file designed by filename
19 in memory. Build a tree.
21 :param filename: name of the file to parse
22 :returns: the tree representing the file
24 parser = xml.sax.make_parser()
26 parser.setContentHandler(handler)
27 parser.parse(open(filename))
29 root_node = handler.get_root()
30 if root_node.format_version !=
"4":
37 """ ContentHandler to parse the Box interface XML file
41 xml.sax.handler.ContentHandler.__init__(self)
47 if name ==
'BoxInterface':
48 new_node = node_box_interface.BoxInterface(
50 elif name ==
'Bitmap':
52 elif name ==
'Parameter':
54 elif name ==
'Content':
62 parent_node = self.
_nodes.pop()
63 parent_node.attach_attribute(name, new_node)
64 parent_node.add_child(new_node)
65 self.
_nodes.append(parent_node)
67 self.
_nodes.append(new_node)
69 parent_node = self.
_nodes.pop()
70 parent_node.attach_attribute(name,
72 self.
_nodes.append(parent_node)
75 if (name ==
'BoxInterface'
76 or name ==
'Parameter'