From 8aaeea8ee4831faa1c08f910c60533e9eb49f66c Mon Sep 17 00:00:00 2001 From: Tristan Roux Date: Thu, 5 Dec 2019 18:00:46 +0100 Subject: [PATCH] Initial commit --- include/xml.h | 21 +++++++++++++++++++++ include/xmlstate.h | 16 ++++++++++++++++ parseline.c | 13 +++++++++++++ xmlparser.c | 25 +++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 include/xml.h create mode 100644 include/xmlstate.h create mode 100644 parseline.c create mode 100644 xmlparser.c diff --git a/include/xml.h b/include/xml.h new file mode 100644 index 0000000..beb9770 --- /dev/null +++ b/include/xml.h @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2019 +** MUL_my_runner_2019 +** File description: +** xml +*/ + +#pragma once + +typedef struct dictionary +{ + char *property; + char *value; +} dictionary; + +typedef struct node +{ + char *name; + dictionary *properties; + node *child; +} node; \ No newline at end of file diff --git a/include/xmlstate.h b/include/xmlstate.h new file mode 100644 index 0000000..f3dd83d --- /dev/null +++ b/include/xmlstate.h @@ -0,0 +1,16 @@ +/* +** EPITECH PROJECT, 2019 +** MUL_my_runner_2019 +** File description: +** xmlstate +*/ + +#pragma once + +#include "xml.h" + +typedef struct xmlstate +{ + node valid; + node *current; +} xmlstate; \ No newline at end of file diff --git a/parseline.c b/parseline.c new file mode 100644 index 0000000..3057198 --- /dev/null +++ b/parseline.c @@ -0,0 +1,13 @@ +/* +** EPITECH PROJECT, 2019 +** MUL_my_runner_2019 +** File description: +** parseline +*/ + +#include "xmlstate.h" + +void xml_parseline(xmlstate state, char *line) +{ + if (line) +} \ No newline at end of file diff --git a/xmlparser.c b/xmlparser.c new file mode 100644 index 0000000..8e684c5 --- /dev/null +++ b/xmlparser.c @@ -0,0 +1,25 @@ +/* +** EPITECH PROJECT, 2019 +** MUL_my_runner_2019 +** File description: +** xmlparser +*/ + +#include "xml.h" +#include "xmlstate.h" +#include + +node *xmlparse(char *path) +{ + FILE *file = fopen(path, "r"); + char *line = NULL; + xmlstate state; + + if (!file) + return (NULL); + while ((line = getline(line, 0, file))) { + xml_parseline(state, line); + } + fclose(file); + return (state.valid); +} \ No newline at end of file