Beispiel #1
0
        public xml_file(file_text_reader reader) : base(reader)
        {
            XmlNamespaceManager mngr = new XmlNamespaceManager(new NameTable());

            mngr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
            mngr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
            xml_parse_context_ = new XmlParserContext(null, mngr, null, XmlSpace.None);
        }
Beispiel #2
0
        private static log_parser_base create_file_parser(file_text_reader reader)
        {
            string file_name = reader.name.ToLower();

            var file_type = reader.settings.file_type.get();

            if (file_type == file_log_type.best_guess)
            {
                file_type = guess_file_type(file_name);
            }

            switch (file_type)
            {
            case file_log_type.line_by_line:
                return(new text_file_line_by_line(reader));

            case file_log_type.part_to_line:
                return(new text_file_part_on_single_line(reader));

            case file_log_type.xml:
                return(new xml_file(reader));

            case file_log_type.csv:
                return(new csv_file(reader));

            case file_log_type.best_guess:
                // best guess
                break;

            default:
                Debug.Assert(false);
                break;
            }

            if (file_name.EndsWith(".xml"))
            {
                return(new xml_file(reader));
            }
            if (file_name.EndsWith(".csv"))
            {
                return(new csv_file(reader));
            }

            string syntax = reader.settings.syntax;

            if (syntax == "" || syntax == find_log_syntax.UNKNOWN_SYNTAX)
            {
                if (text_file_part_on_single_line.is_single_line(reader.name, reader.settings))
                {
                    return(new text_file_part_on_single_line(reader));
                }
            }

            return(new text_file_line_by_line(reader));
        }
Beispiel #3
0
        private static log_parser_base create_file_parser(file_text_reader reader)
        {
            string file_name = reader.name.ToLower();

            var file_type = reader.settings.get("file_type");

            switch (file_type)
            {
            case "line-by-line":
                return(new text_file_line_by_line(reader));

            case "part-by-line":
                return(new text_file_part_on_single_line(reader));

            case "xml":
                return(new xml_file(reader));

            case "csv":
                return(new csv_file(reader));

            case "":
                // best guess
                break;

            default:
                Debug.Assert(false);
                break;
            }

            if (file_name.EndsWith(".xml"))
            {
                return(new xml_file(reader));
            }
            if (file_name.EndsWith(".csv"))
            {
                return(new csv_file(reader));
            }

            string syntax = reader.settings.get("syntax");

            if (syntax == "" || syntax == find_log_syntax.UNKNOWN_SYNTAX)
            {
                if (text_file_part_on_single_line.is_single_line(reader.name, reader.settings))
                {
                    return(new text_file_part_on_single_line(reader));
                }
            }

            return(new text_file_line_by_line(reader));
        }
Beispiel #4
0
 public file_parser_base(file_text_reader reader) : base(reader.settings)
 {
     reader_ = reader;
 }
 public text_file_part_on_single_line(file_text_reader reader) : base(reader)
 {
 }
Beispiel #6
0
 public csv_file(file_text_reader reader) : base(reader)
 {
 }
Beispiel #7
0
 public json_file(file_text_reader reader) : base(reader)
 {
 }