From 707387b10340c7b95db35c8b791e57a2d02ccbaf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Mar 2013 20:13:04 +0200 Subject: Make attribute map valid throughout at "element level" --- cutl/xml/parser.txx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'cutl/xml/parser.txx') diff --git a/cutl/xml/parser.txx b/cutl/xml/parser.txx index cf27f2c..e5286f8 100644 --- a/cutl/xml/parser.txx +++ b/cutl/xml/parser.txx @@ -12,19 +12,22 @@ namespace cutl T parser:: attribute (const qname_type& qn, const T& dv) const { - attribute_map::const_iterator i (attr_map_.find (qn)); - - if (i != attr_map_.end ()) + if (const element_entry* e = get_element ()) { - if (!i->second.handled) + attribute_map::const_iterator i (e->attr_map_.find (qn)); + + if (i != e->attr_map_.end ()) { - i->second.handled = true; - attr_unhandled_--; + if (!i->second.handled) + { + i->second.handled = true; + e->attr_unhandled_--; + } + return value_traits::parse (i->second.value, *this); } - return value_traits::parse (i->second.value, *this); } - else - return dv; + + return dv; } } } -- cgit v1.1