//sort array by type
        private static void QuicksortByType(IParsee[] source, int left, int right)
        {
            int     i = left, j = right;
            IParsee pivot = source[(left + right) / 2];

            while (i <= j)
            {
                while (source[i].GetType().FullName.CompareTo(pivot.GetType().FullName) < 0)
                {
                    i++;
                }
                while (source[j].GetType().FullName.CompareTo(pivot.GetType().FullName) > 0)
                {
                    j--;
                }
                if (i <= j)
                {
                    IParsee tmp = source[i];
                    source[i] = source[j];
                    source[j] = tmp;

                    i++;
                    j--;
                }
            }

            if (left < j)
            {
                QuicksortByType(source, left, j);
            }
            if (i < right)
            {
                QuicksortByType(source, i, right);
            }
        }
        //defines folders to which xml files are written
        public static void SaveToXml(IParsee input)
        {
            Directory.CreateDirectory(xmlloc + "\\" + input.GetType().Name);
            String path = String.Format("{0}\\{1}\\{2}{3}.xml", xmlloc, input.GetType().Name, input.FileName, "");

            int i = 1;

            while (File.Exists(path))
            {
                path = String.Format("{0}\\{1}\\{2}{3}.xml", xmlloc, input.GetType().Name, input.FileName, "(" + i + ")");
                i++;
            }
            var       stream = new FileStream(path, FileMode.Create);
            XmlWriter xw     = XmlWriter.Create(stream);

            input.WriteXml(xw);
            xw.Flush();
            stream.Dispose();
        }