public static string GetXMLFileFromLines(string[] lines, out XMLFile xml)
        {
            string success = "";

            xml = new XMLFile(new XMLPrologue(), new XMLTag("Error", "Couldn't get XMLFile at GetXMLFileFromLines.", new XMLTag[0], new XMLAttribute[0]));
            String      stream = string.Join(string.Empty, lines);
            XMLPrologue prologue;
            string      StreamLeft;

            if (GetXMLProlog(stream, out prologue, out StreamLeft))
            {
                xml.Prologue = prologue;
            }
            else
            {
                StreamLeft = stream;
            }
            XMLTag[] tags;
            success = GetTags(StreamLeft, out tags);
            if (success == "")
            {
                if (tags.Length == 1)
                {
                    xml.Root = tags[0];
                }
                else
                {
                    success = "Error! XML should have one, and just one root tag!";
                }
            }
            return(success);
        }
        public static string GetXMLFile(string path, out XMLFile xml)
        {
            string success = ""; //Empty equals success, error contains error message

            String[] lines = IOManager.GetFile(path);
            return(GetXMLFileFromLines(lines, out xml));
        }
        public static void SaveXMLFile(string path, XMLFile xml)
        {
            List <string> lines = new List <string>();

            if (xml.Prologue != null)
            {
                lines.Add(xml.Prologue.ToXmlPrologueText());
            }
            lines.AddRange(xml.Root.ToXmlText());
            IOManager.WriteFile(path, lines.ToArray());
        }
        public static void SaveExample(string path)
        {
            XMLPrologue prologue = new XMLPrologue();
            XMLTag      root     = new XMLTag("Person", string.Empty);
            XMLTag      nome     = new XMLTag("Name", "João da Silva");

            nome.SetAttribute(new XMLAttribute("Compound", "Yes"));
            root.AddChild(nome);
            root.AddChild(new XMLTag("Age", "15"));
            root.AddChild(new XMLTag("Cidade", "São Paulo"));
            root.SetAttribute(new XMLAttribute("Raca", "Pardo"));
            XMLFile file = new XMLFile(prologue, root);

            XMLManager.SaveXMLFile(path, file);
        }