def start_element(ns_uri, prefix, name, attr_map)
if (ns_uri == XMLNS_MAP_URI) then
@depth += 1
case (@depth)
when 1
if (name != 'map') then
raise WidgetMappingError, "invalid top level element of map: #{name.inspect}"
end
when 2
if (FACTORY_MAP.include? name) then
unless (attr_map['name']) then
raise WidgetMappingError, "undefined name attribute: #{name.inspect}"
end
widget_id = attr_map['name']
@curr_properties = FACTORY_MAP[name].new(widget_id, @page_context, @running_context)
if (@properties_map.include? widget_id) then
raise WidgetMappingError, "duplicated name: #{widget_id.inspect}"
end
@curr_properties.mapped(attr_map)
@properties_map[widget_id] = @curr_properties
@string_map[widget_id] = @curr_properties if (name == 'string')
else
raise WidgetMappingError, "unknown widget: #{name.inspect}"
end
when 3
@curr_attr_map = attr_map
@curr_value = ''
else
raise WidgetMappingError, "too deep element: #{name.inspect}"
end
else
if (@depth >= 3) then
raise WidgetMappingError, "not allowed element: #{name.inspect}"
end
end
nil
end