From 1d3d9dfb7b11da8e398f6f9c638291a0539f7bf0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 27 Mar 2013 08:00:25 +0200 Subject: Add attribute_present() function to XML parser --- cutl/xml/parser.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cutl/xml/parser.cxx') diff --git a/cutl/xml/parser.cxx b/cutl/xml/parser.cxx index f57d9fd..42ce9ce 100644 --- a/cutl/xml/parser.cxx +++ b/cutl/xml/parser.cxx @@ -237,6 +237,27 @@ namespace cutl return dv; } + bool parser:: + attribute_present (const qname_type& qn) const + { + if (const element_entry* e = get_element ()) + { + attribute_map::const_iterator i (e->attr_map_.find (qn)); + + if (i != e->attr_map_.end ()) + { + if (!i->second.handled) + { + i->second.handled = true; + e->attr_unhandled_--; + } + return true; + } + } + + return false; + } + void parser:: next_expect (event_type e) { -- cgit v1.1