aboutsummaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/tree/serialization.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-11-19 14:50:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-11-19 14:50:07 +0200
commitf501505709341f61744fb8d1568702eedad5e520 (patch)
tree03725efdedc4176ae09b5423f2d7ffb4714913a3 /libxsd/xsd/cxx/tree/serialization.txx
parent6f69b7c48e2e005bf108b849d4fbe6e47c33bad0 (diff)
Do not set element text if it is empty
Diffstat (limited to 'libxsd/xsd/cxx/tree/serialization.txx')
-rw-r--r--libxsd/xsd/cxx/tree/serialization.txx10
1 files changed, 6 insertions, 4 deletions
diff --git a/libxsd/xsd/cxx/tree/serialization.txx b/libxsd/xsd/cxx/tree/serialization.txx
index b8c8631..5bb0d28 100644
--- a/libxsd/xsd/cxx/tree/serialization.txx
+++ b/libxsd/xsd/cxx/tree/serialization.txx
@@ -32,7 +32,9 @@ namespace XERCES_CPP_NAMESPACE
operator<< (xercesc::DOMElement& e, const C* s)
{
xsd::cxx::xml::dom::clear<char> (e);
- e.setTextContent (xsd::cxx::xml::string (s).c_str ());
+
+ if (*s != C (0))
+ e.setTextContent (xsd::cxx::xml::string (s).c_str ());
}
template <typename C>
@@ -51,7 +53,9 @@ namespace XERCES_CPP_NAMESPACE
operator<< (xercesc::DOMElement& e, const std::basic_string<C>& s)
{
xsd::cxx::xml::dom::clear<char> (e);
- e.setTextContent (xsd::cxx::xml::string (s).c_str ());
+
+ if (!s.empty ())
+ e.setTextContent (xsd::cxx::xml::string (s).c_str ());
}
template <typename C>
@@ -131,8 +135,6 @@ namespace xsd
void
operator<< (xercesc::DOMElement& e, const list<T, C, ST, fund>& v)
{
- xml::dom::clear<char> (e);
-
std::basic_ostringstream<C> os;
list_stream<C> ls (os, e);