aboutsummaryrefslogtreecommitdiff
path: root/xml/parser.ixx
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.ixx
parent8234b273aea9a662b8675190d3e73c90ce159f1a (diff)
Add helpers for parsing elements with simple content
Diffstat (limited to 'xml/parser.ixx')
-rw-r--r--xml/parser.ixx48
1 files changed, 48 insertions, 0 deletions
diff --git a/xml/parser.ixx b/xml/parser.ixx
index e58d2cf..c0fe256 100644
--- a/xml/parser.ixx
+++ b/xml/parser.ixx
@@ -125,6 +125,54 @@ namespace xml
content (c);
}
+ template <typename T>
+ inline T parser::
+ element ()
+ {
+ return value_traits<T>::parse (element (), *this);
+ }
+
+ inline std::string parser::
+ element (const std::string& n)
+ {
+ next_expect (start_element, n);
+ return element ();
+ }
+
+ inline std::string parser::
+ element (const qname_type& qn)
+ {
+ next_expect (start_element, qn);
+ return element ();
+ }
+
+ template <typename T>
+ inline T parser::
+ element (const std::string& n)
+ {
+ return value_traits<T>::parse (element (n), *this);
+ }
+
+ template <typename T>
+ inline T parser::
+ element (const qname_type& qn)
+ {
+ return value_traits<T>::parse (element (qn), *this);
+ }
+
+ inline std::string parser::
+ element (const std::string& n, const std::string& dv)
+ {
+ return element (qname_type (n), dv);
+ }
+
+ template <typename T>
+ inline T parser::
+ element (const std::string& n, const T& dv)
+ {
+ return element<T> (qname_type (n), dv);
+ }
+
inline const parser::element_entry* parser::
get_element () const
{