#include <iostream>
#include <fstream>

#include "XmlParser.h"
#include "XmlWriter.h"
#include "File.h"

int main(int argc, char *argv[])
{
    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);

    return 0;
}
