浏览代码

gh-577 standalone ecl with -xml formatting issues

Fix some anomolies in how xml is output from standalone ECL programs,
to make regression testing easier (and to make the output easier to
read).

Fixes gh-577

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 年之前
父节点
当前提交
f0130c5a54
共有 3 个文件被更改,包括 10 次插入11 次删除
  1. 5 5
      common/workunit/workunit.cpp
  2. 1 1
      ecl/eclagent/eclagent.cpp
  3. 4 5
      ecl/hthor/hthor.cpp

+ 5 - 5
common/workunit/workunit.cpp

@@ -6663,18 +6663,18 @@ IStringVal& CLocalWUResult::getResultXml(IStringVal &str) const
     p->getPropBin("Value", raw);
     const char * name = p->queryProp("@name");
     if (name)
-        xml.appendf("<Dataset name=\"%s\">", name);
+        xml.appendf("<Dataset name=\'%s\'>\n", name);
     else
-        xml.append("<Dataset>");
+        xml.append("<Dataset>\n");
 
     unsigned __int64 numrows = getResultRowCount();
     while (numrows--)
     {
-        xml.append("<Row>");
+        xml.append(" <Row>");
         readRow(xml, raw, types, names);
-        xml.append("</Row>");
+        xml.append("</Row>\n");
     }
-    xml.append("</Dataset>");
+    xml.append("</Dataset>\n");
     str.set(xml.str());
     return str;
 }

+ 1 - 1
ecl/eclagent/eclagent.cpp

@@ -791,7 +791,7 @@ void EclAgent::outputFormattedResult(const char * name, unsigned sequence, bool
         }
     }
     if (close)
-        outputSerializer->close(sequence, outputFmt != ofRAW);
+        outputSerializer->close(sequence, false);
 }
 
 void EclAgent::setResultInt(const char * name, unsigned sequence, __int64 val)

+ 4 - 5
ecl/hthor/hthor.cpp

@@ -5716,12 +5716,11 @@ void CHThorWorkUnitWriteActivity::execute()
         StringBuffer sb;
         const char *name = helper.queryName();
         if (name && *name)
-            sb.appendf("<Dataset name='%s'>", name);
+            sb.appendf("<Dataset name='%s'>\n", name);
         else
-            sb.appendf("<Dataset name='Result %d'>", seq+1);
+            sb.appendf("<Dataset name='Result %d'>\n", seq+1);
         agent.queryOutputSerializer()->fwrite(seq, (const void*)sb.str(), 1, sb.length());
     }
-    CommonXmlWriter xmlwrite(0,1);
     loop
     {
         if ((unsigned __int64)rows >= agent.queryStopAfter())
@@ -5766,11 +5765,11 @@ void CHThorWorkUnitWriteActivity::execute()
             }
             else if (agent.queryOutputFmt() == ofXML)
             {
+                CommonXmlWriter xmlwrite(0,1);
                 xmlwrite.outputBeginNested("Row", false);
                 helper.serializeXml((byte *) nextrec.get(), xmlwrite);
                 xmlwrite.outputEndNested("Row");
                 agent.queryOutputSerializer()->fwrite(seq, (const void*)xmlwrite.str(), 1, xmlwrite.length());
-                xmlwrite.clear();
             }
         }
         rows++;
@@ -5789,7 +5788,7 @@ void CHThorWorkUnitWriteActivity::execute()
         if (agent.queryOutputFmt() == ofXML)
         {
             StringBuffer sb;
-            sb.appendf("</Dataset>");
+            sb.appendf("</Dataset>\n");
             agent.queryOutputSerializer()->fwrite(seq, (const void*)sb.str(), 1, sb.length());
         }
         else if (agent.queryOutputFmt() != ofSTD)