23 from .
import gen_xml, parse_xml
27 return gen.encode(obj)
29 attribute_type_dict = {
30 'abstract_type':
'string',
36 'atlas_name':
'string',
39 'burn_speed':
'float',
45 'description':
'string',
50 'fruitname':
'string',
52 'future_seconds':
'float',
79 'stamp_contains':
'float',
82 'time_string':
'string',
92 def encode_attribute(self, indent, name, str_type, str_value):
93 attribute_type_dict[name] = str_type
94 return '%s<%s>%s</%s>' % \
95 (indent, name, str_value, name)
100 def unknown_starttag(self, tag, attributes):
101 method_name =
"start_" + attribute_type_dict.get(tag,
"")
102 if hasattr(self, method_name):
103 method = getattr(self, method_name)
104 attributes[
"name"] = tag
105 return method(attributes)
106 raise XmlException(
"Unknown tag: "+tag)
108 def unknown_endtag(self, tag):
109 method_name =
"end_" + attribute_type_dict.get(tag,
"")
110 if hasattr(self, method_name):
111 method = getattr(self, method_name)
113 raise XmlException(
"Unknown tag: "+tag)
118 xml2_msg_parser.setup()
119 return xml2_msg_parser