23 lines
551 B
C++
23 lines
551 B
C++
#include "XmlWriter.h"
|
|
|
|
#include "XmlDocument.h"
|
|
#include "XmlAttribute.h"
|
|
|
|
Status XmlWriter::toString(XmlDocument* document, String& output)
|
|
{
|
|
if (auto prolog = document->getProlog())
|
|
{
|
|
output += "<?xml";
|
|
for (const auto& [key, attribute] : prolog->getAttributes())
|
|
{
|
|
output += _s(" ") + attribute->getName() + _s("=\"") + attribute->getValue() + _s("\"");
|
|
}
|
|
output += "?>\n";
|
|
}
|
|
|
|
if (auto root = document->getRoot())
|
|
{
|
|
output += root->toString();
|
|
}
|
|
return {};
|
|
}
|