Browse Source

HPCC-3060 Fix formatting and other minor issues

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck 11 years ago
parent
commit
4e52a68076
2 changed files with 13 additions and 6 deletions
  1. 9 4
      common/fileview2/fvresultset.cpp
  2. 4 2
      common/thorhelper/thorxmlwrite.cpp

+ 9 - 4
common/fileview2/fvresultset.cpp

@@ -1544,7 +1544,8 @@ void CResultSetCursor::getXmlText(StringBuffer & out, int columnIndex, const cha
         }
         return;
     case FVFFendrecord:
-        appendXMLCloseTag(out, name);
+        if (name && *name)
+            appendXMLCloseTag(out, name);
         return;
     }
 
@@ -3809,10 +3810,14 @@ extern FILEVIEW_API IStringVal& getFullWorkUnitResultsXML(const char *username,
     SCMStringBuffer wuid;
     cw->getWuid(wuid);
 
-    Owned<CommonXmlWriter> writer = CreateCommonXmlWriter(0);
+    Owned<CommonXmlWriter> writer = CreateCommonXmlWriter(XWFexpandempty);
     writeFullWorkUnitResults(username, password, cw, *writer, flags, minSeverity, "Result");
 
-    str.set(writer->str());
+    const char *xml = writer->str();
+    unsigned len = writer->length();
+    if (len && xml[len-1]=='\n')
+        len--;
+    str.setLen(xml, len);
     return str;
 }
 
@@ -3821,7 +3826,7 @@ extern FILEVIEW_API IStringVal& getFullWorkUnitResultsJSON(const char *username,
     SCMStringBuffer wuid;
     cw->getWuid(wuid);
 
-    Owned<CommonJsonWriter> writer = new CommonJsonWriter(0, 0, 0);
+    Owned<CommonJsonWriter> writer = new CommonJsonWriter(0);
     writer->outputBeginRoot();
     writeFullWorkUnitResults(username, password, cw, *writer, flags, minSeverity, "Results");
     writer->outputEndRoot();

+ 4 - 2
common/thorhelper/thorxmlwrite.cpp

@@ -243,7 +243,9 @@ void CommonXmlWriter::outputUtf8(unsigned len, const char *field, const char *fi
 
 void CommonXmlWriter::outputBeginDataset(const char *dsname, bool nestChildren)
 {
-    outputBeginNested("Dataset", nestChildren, false); //no indent for backward compatibility
+    outputBeginNested("Dataset", nestChildren, false); //indent row, not dataset for backward compatibility
+    if (nestChildren && indent==0)
+        indent++;
     if (!dsname || !*dsname)
         return;
     out.append(" name='"); //single quote for backward compatibility
@@ -303,7 +305,7 @@ void CommonXmlWriter::outputEndNested(const char *fieldname, bool doIndent)
     }
     else
     {
-        if (!nestLimit)
+        if (!nestLimit && doIndent)
             out.pad(indent-1);
         out.append("</").append(fieldname).append('>');
     }