XML writer: flush after newlines
This is useful for hydra-eval-jobs.
This commit is contained in:
parent
bfaa5635de
commit
ad328bea15
|
@ -9,7 +9,7 @@ namespace nix {
|
||||||
XMLWriter::XMLWriter(bool indent, std::ostream & output)
|
XMLWriter::XMLWriter(bool indent, std::ostream & output)
|
||||||
: output(output), indent(indent)
|
: output(output), indent(indent)
|
||||||
{
|
{
|
||||||
output << "<?xml version='1.0' encoding='utf-8'?>\n";
|
output << "<?xml version='1.0' encoding='utf-8'?>" << std::endl;
|
||||||
closed = false;
|
closed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ void XMLWriter::openElement(const string & name,
|
||||||
output << "<" << name;
|
output << "<" << name;
|
||||||
writeAttrs(attrs);
|
writeAttrs(attrs);
|
||||||
output << ">";
|
output << ">";
|
||||||
if (indent) output << "\n";
|
if (indent) output << std::endl;
|
||||||
pendingElems.push_back(name);
|
pendingElems.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void XMLWriter::closeElement()
|
||||||
assert(!pendingElems.empty());
|
assert(!pendingElems.empty());
|
||||||
indent_(pendingElems.size() - 1);
|
indent_(pendingElems.size() - 1);
|
||||||
output << "</" << pendingElems.back() << ">";
|
output << "</" << pendingElems.back() << ">";
|
||||||
if (indent) output << "\n";
|
if (indent) output << std::endl;
|
||||||
pendingElems.pop_back();
|
pendingElems.pop_back();
|
||||||
if (pendingElems.empty()) closed = true;
|
if (pendingElems.empty()) closed = true;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void XMLWriter::writeEmptyElement(const string & name,
|
||||||
output << "<" << name;
|
output << "<" << name;
|
||||||
writeAttrs(attrs);
|
writeAttrs(attrs);
|
||||||
output << " />";
|
output << " />";
|
||||||
if (indent) output << "\n";
|
if (indent) output << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue