|
def tag_start name, attrs
@tag_stack.push name
attributes = {}
attrs.each { |n,v| attributes[n] = v }
# find the observers for namespaces
procs = get_procs( start_prefix_mapping:start_prefix_mapping, name )
listeners = get_listeners( start_prefix_mapping:start_prefix_mapping, name )
if procs or listeners
# break out the namespace declarations
nsdecl.collect! { |n, value| [ n[6..-1], value ] }
@namespace_stack.push({})
nsdecl.each do |n,v|
@namespace_stack[-1][n] = v
# notify observers of namespaces
procs.each { |ob| ob.call( n, v ) } if procs
listeners.each { |ob| ob.start_prefix_mapping(n, v) } if listeners
end
end
name =~ Namespace::NAMESPLIT
prefix = $1
local = $2
uri = get_namespace prefix
# find the observers for start_element
procs = get_procs( start_element:start_element, name )
listeners = get_listeners( start_element:start_element, name )
# notify observers
procs.each { |ob| ob.call( uri, local, name, attributes ) } if procs
listeners.each { |ob| ob.start_element( uri, local, name, attributes ) } if listeners
end
|