Fix stream operators.
authorScott Cantor <cantor.2@osu.edu>
Wed, 24 Jan 2007 21:15:55 +0000 (21:15 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 24 Jan 2007 21:15:55 +0000 (21:15 +0000)
xmltooling/util/XMLHelper.cpp
xmltooling/util/XMLHelper.h

index 50f450e..bf52d5b 100644 (file)
@@ -268,7 +268,7 @@ namespace {
     };
 };
 
-void XMLHelper::serialize(const DOMNode* n, std::ostream& out)
+ostream& XMLHelper::serialize(const DOMNode* n, ostream& out)
 {
     static const XMLCh impltype[] = { chLatin_L, chLatin_S, chNull };
     static const XMLCh UTF8[]={ chLatin_U, chLatin_T, chLatin_F, chDigit_8, chNull };
@@ -279,15 +279,15 @@ void XMLHelper::serialize(const DOMNode* n, std::ostream& out)
     StreamFormatTarget target(out);
     if (!serializer->writeNode(&target,*n))
         throw XMLParserException("unable to serialize XML");
+    return out;
 }
 
 ostream& xmltooling::operator<<(ostream& ostr, const DOMNode& node)
 {
-    XMLHelper::serialize(&node, ostr);
-    return ostr;
+    return XMLHelper::serialize(&node, ostr);
 }
 
 ostream& xmltooling::operator<<(ostream& ostr, const XMLObject& obj)
 {
-    return ostr << obj.marshall();
+    return ostr << *(obj.marshall());
 }
index eaa7832..41b2e88 100644 (file)
@@ -239,8 +239,9 @@ namespace xmltooling {
          * 
          * @param n     node to serialize
          * @param out   stream to serialize element into
+         * @return reference to output stream
          */
-        static void serialize(const DOMNode* n, std::ostream& out);
+        static std::ostream& serialize(const DOMNode* n, std::ostream& out);
     };
 
     /**