Parser callback for XML attributes.

This commit is contained in:
Yorick Peterse committed 2015-03-21 01:22:59 +01:00
1 parent a023b35e78
commit f94407ee9d
1 file changed
+11 -6
+11 -6
View File
@@ -175,12 +175,8 @@ attribute_follow
;
attribute_name
= T_ATTR { Attribute.new(:name => val[0]) }
| T_ATTR_NS T_ATTR
{
Attribute.new(:namespace_name => val[0], :name => val[1])
}
= T_ATTR { on_attribute(val[0]) }
| T_ATTR_NS T_ATTR { on_attribute(val[1], val[0]) }
;
# XML declarations
@@ -383,4 +379,13 @@ string_body_follow
def after_element(element)
return element
end
##
# @param [String] name
# @param [String] ns_name
# @return [Oga::XML::Attribute]
#
def on_attribute(name, ns_name = nil)
return Attribute.new(:namespace_name => ns_name, :name => name)
end
}