2022-01-01 18:46:31 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include "XmlParser.h"
|
|
|
|
#include "XmlWriter.h"
|
|
|
|
#include "File.h"
|
|
|
|
|
2022-11-29 18:00:19 +00:00
|
|
|
#include "TestFramework.h"
|
|
|
|
|
|
|
|
TEST_CASE(TestXmlParser, "web")
|
2022-01-01 18:46:31 +00:00
|
|
|
{
|
|
|
|
XmlParser parser;
|
|
|
|
|
|
|
|
std::ifstream xml_file;
|
|
|
|
xml_file.open("/home/jmsgrogan/test.xml", std::ifstream::in);
|
|
|
|
while(xml_file.good())
|
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
std::getline(xml_file, line);
|
|
|
|
parser.ProcessLine(line);
|
|
|
|
}
|
|
|
|
xml_file.close();
|
|
|
|
|
|
|
|
auto outFile = std::make_unique<File>("test_out.xml");
|
|
|
|
outFile->SetAccessMode(File::AccessMode::Write);
|
|
|
|
outFile->Open();
|
|
|
|
|
|
|
|
XmlWriter writer;
|
|
|
|
auto content = writer.ToString(parser.GetDocument().get());
|
|
|
|
outFile->WriteText(content);
|
|
|
|
}
|