From 503cd7a8cbb54719db115391de17ec265ea2b543 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 Aug 2015 23:47:47 +0200 Subject: Add support for "checked" end_element(), end_attribute() --- xml/serializer.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'xml/serializer.cxx') diff --git a/xml/serializer.cxx b/xml/serializer.cxx index 5ed5c5e..df31b09 100644 --- a/xml/serializer.cxx +++ b/xml/serializer.cxx @@ -173,6 +173,21 @@ namespace xml } void serializer:: + end_element (const string& ns, const string& name) + { + constUtf8 cns, cn; + genxStatus e; + if ((e = genxGetCurrentElement (s_, &cns, &cn)) || + reinterpret_cast (cn) != name || + (cns == 0 ? !ns.empty () : reinterpret_cast (cns) != ns)) + { + handle_error (e != GENX_SUCCESS ? e : GENX_SEQUENCE_ERROR); + } + + end_element (); + } + + void serializer:: element (const string& ns, const string& n, const string& v) { start_element (ns, n); @@ -197,6 +212,21 @@ namespace xml } void serializer:: + end_attribute (const string& ns, const string& name) + { + constUtf8 cns, cn; + genxStatus e; + if ((e = genxGetCurrentAttribute (s_, &cns, &cn)) || + reinterpret_cast (cn) != name || + (cns == 0 ? !ns.empty () : reinterpret_cast (cns) != ns)) + { + handle_error (e != GENX_SUCCESS ? e : GENX_SEQUENCE_ERROR); + } + + end_attribute (); + } + + void serializer:: attribute (const string& ns, const string& name, const string& value) -- cgit v1.1