aboutsummaryrefslogtreecommitdiff
path: root/xml/parser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xml/parser.cxx')
-rw-r--r--xml/parser.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/xml/parser.cxx b/xml/parser.cxx
index d9d2fcb..6d5ab23 100644
--- a/xml/parser.cxx
+++ b/xml/parser.cxx
@@ -283,6 +283,42 @@ namespace xml
qname_type (ns, n).string () + "' expected");
}
+ string parser::
+ element ()
+ {
+ content (simple);
+ string r;
+
+ // The content of the element can be empty in which case there
+ // will be no characters event.
+ //
+ event_type e (next ());
+ if (e == characters)
+ {
+ r.swap (value ());
+ e = next ();
+ }
+
+ // We cannot really get anything other than end_element since
+ // the simple content validation won't allow it.
+ //
+ assert (e == end_element);
+
+ return r;
+ }
+
+ string parser::
+ element (const qname_type& qn, const string& dv)
+ {
+ if (peek () == start_element && qname () == qn)
+ {
+ next ();
+ return element ();
+ }
+
+ return dv;
+ }
+
const parser::element_entry* parser::
get_element_ () const
{