From 927b97baaaf69e318ff7a0ce76d096375ec09da2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Mar 2013 08:22:58 +0200 Subject: Add support for returning XML attributes as map --- cutl/xml/parser.txx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cutl/xml/parser.txx (limited to 'cutl/xml/parser.txx') diff --git a/cutl/xml/parser.txx b/cutl/xml/parser.txx new file mode 100644 index 0000000..cf27f2c --- /dev/null +++ b/cutl/xml/parser.txx @@ -0,0 +1,30 @@ +// file : cutl/xml/parser.txx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +namespace cutl +{ + namespace xml + { + template + 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 (!i->second.handled) + { + i->second.handled = true; + attr_unhandled_--; + } + return value_traits::parse (i->second.value, *this); + } + else + return dv; + } + } +} -- cgit v1.1