Persistence: Test cases for content dump

It turned our that the document could not be dumped as the xml specifier was used as first element. As the dumping added the <content> element around it was invalid. However, content is required to read properties. Hence the xml element generation was moved.
This commit is contained in:
ickby
2018-10-17 18:16:13 +02:00
committed by wmayer
parent 13bcf5fae4
commit d5cbee5543
3 changed files with 32 additions and 7 deletions

View File

@@ -1327,11 +1327,6 @@ std::string Document::getTransientDirectoryName(const std::string& uuid, const s
void Document::Save (Base::Writer &writer) const
{
writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<!--" << endl
<< " FreeCAD Document, see http://www.freecadweb.org for more information..." << endl
<< "-->" << endl;
writer.Stream() << "<Document SchemaVersion=\"4\" ProgramVersion=\""
<< App::Application::Config()["BuildVersionMajor"] << "."
<< App::Application::Config()["BuildVersionMinor"] << "R"
@@ -1696,6 +1691,10 @@ bool Document::saveToFile(const char* filename) const
if (hGrp->GetBool("SaveBinaryBrep", false))
writer.setMode("BinaryBrep");
writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<!--" << endl
<< " FreeCAD Document, see http://www.freecadweb.org for more information..." << endl
<< "-->" << endl;
Document::Save(writer);
// Special handling for Gui document.