diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-12 00:02:47 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-12 00:02:47 +0200 |
commit | e34acc39f93526e6ff9ade7539600539be6f5055 (patch) | |
tree | 239ff235a34828fd6c79537509bcc598a30d189a /xml/serializer.cxx | |
parent | 503cd7a8cbb54719db115391de17ec265ea2b543 (diff) |
Add support for querying current element, attribute
Diffstat (limited to 'xml/serializer.cxx')
-rw-r--r-- | xml/serializer.cxx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/xml/serializer.cxx b/xml/serializer.cxx index df31b09..700243f 100644 --- a/xml/serializer.cxx +++ b/xml/serializer.cxx @@ -122,7 +122,7 @@ namespace xml } void serializer:: - handle_error (genxStatus e) + handle_error (genxStatus e) const { switch (e) { @@ -287,7 +287,7 @@ namespace xml } bool serializer:: - lookup_namespace_prefix (const string& ns, string& p) + lookup_namespace_prefix (const string& ns, string& p) const { // Currently Genx will create a namespace mapping if one doesn't // already exist. @@ -304,6 +304,28 @@ namespace xml return true; } + qname serializer:: + current_element () const + { + constUtf8 ns, n; + if (genxStatus e = genxGetCurrentElement (s_, &ns, &n)) + handle_error (e); + + return qname (ns != 0 ? reinterpret_cast<const char*> (ns) : "", + reinterpret_cast<const char*> (n)); + } + + qname serializer:: + current_attribute () const + { + constUtf8 ns, n; + if (genxStatus e = genxGetCurrentAttribute (s_, &ns, &n)) + handle_error (e); + + return qname (ns != 0 ? reinterpret_cast<const char*> (ns) : "", + reinterpret_cast<const char*> (n)); + } + void serializer:: suspend_indentation () { |