diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2015-05-23 23:31:20 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-05-26 11:09:21 -0400 |
commit | 6cf5cc717f522bcd9e8286a864068d09012dad41 (patch) | |
tree | d5bebc5ca9c98bd52691d2994fbac51a86510617 /Source/CTest | |
parent | ed42c203ed4b258091bd6eeaa1fe567c6f9b120a (diff) | |
download | cmake-6cf5cc717f522bcd9e8286a864068d09012dad41.tar.gz |
cmCTestUploadHandler: Port to cmXMLWriter
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestUploadHandler.cxx | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index 579190a2a7..5c6b2290ff 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -13,7 +13,7 @@ #include "cmGeneratedFileStream.h" #include "cmVersion.h" -#include "cmXMLSafe.h" +#include "cmXMLWriter.h" //---------------------------------------------------------------------------- cmCTestUploadHandler::cmCTestUploadHandler() @@ -47,32 +47,36 @@ int cmCTestUploadHandler::ProcessHandler() std::string buildname = cmCTest::SafeBuildIdField( this->CTest->GetCTestConfiguration("BuildName")); cmCTest::SetOfStrings::const_iterator it; - ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" - << "<?xml-stylesheet type=\"text/xsl\" " + + cmXMLWriter xml(ofs); + xml.StartDocument(); + xml.ProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" " "href=\"Dart/Source/Server/XSL/Build.xsl " - "<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n" - << "<Site BuildName=\"" - << buildname - << "\" BuildStamp=\"" - << this->CTest->GetCurrentTag() << "-" - << this->CTest->GetTestModelString() << "\" Name=\"" - << this->CTest->GetCTestConfiguration("Site") << "\" Generator=\"ctest" - << cmVersion::GetCMakeVersion() - << "\">\n"; - this->CTest->AddSiteProperties(ofs); - ofs << "<Upload>\n"; + "<file:///Dart/Source/Server/XSL/Build.xsl> \""); + xml.StartElement("Site"); + xml.Attribute("BuildName", buildname); + xml.Attribute("BuildStamp", + this->CTest->GetCurrentTag() + "-" + this->CTest->GetTestModelString()); + xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site")); + xml.Attribute("Generator", + std::string("ctest") + cmVersion::GetCMakeVersion()); + this->CTest->AddSiteProperties(xml); + xml.StartElement("Upload"); for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { cmCTestOptionalLog(this->CTest, OUTPUT, "\tUpload file: " << *it << std::endl, this->Quiet); - ofs << "<File filename=\"" << cmXMLSafe(*it) << "\">\n" - << "<Content encoding=\"base64\">\n"; - ofs << this->CTest->Base64EncodeFile(*it); - ofs << "\n</Content>\n" - << "</File>\n"; + xml.StartElement("File"); + xml.Attribute("filename", *it); + xml.StartElement("Content"); + xml.Attribute("encoding", "base64"); + xml.Content(this->CTest->Base64EncodeFile(*it)); + xml.EndElement(); // Content + xml.EndElement(); // File } - ofs << "</Upload>\n" - << "</Site>\n"; + xml.EndElement(); // Upload + xml.EndElement(); // Site + xml.EndDocument(); return 0; } |