aboutsummaryrefslogtreecommitdiff
path: root/xml/parser.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-05-08 17:02:55 -0700
committerBoris Kolpackov <boris@codesynthesis.com>2014-05-08 17:02:55 -0700
commita6e24513d89067c16a3df214a7e2679e1f1675f1 (patch)
treeb622213d673b73005bcd6002e67b121714c9c55b /xml/parser.txx
parent8234b273aea9a662b8675190d3e73c90ce159f1a (diff)
Add helpers for parsing elements with simple content
Diffstat (limited to 'xml/parser.txx')
-rw-r--r--xml/parser.txx13
1 files changed, 13 insertions, 0 deletions
diff --git a/xml/parser.txx b/xml/parser.txx
index e882c82..0167522 100644
--- a/xml/parser.txx
+++ b/xml/parser.txx
@@ -27,4 +27,17 @@ namespace xml
return dv;
}
+
+ template <typename T>
+ T parser::
+ element (const qname_type& qn, const T& dv)
+ {
+ if (peek () == start_element && qname () == qn)
+ {
+ next ();
+ return element<T> ();
+ }
+
+ return dv;
+ }
}