mirror of
https://github.com/zoriya/xmlParser.git
synced 2025-12-19 17:15:11 +00:00
Initial commit
This commit is contained in:
21
include/xml.h
Normal file
21
include/xml.h
Normal file
@@ -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;
|
||||
16
include/xmlstate.h
Normal file
16
include/xmlstate.h
Normal file
@@ -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;
|
||||
13
parseline.c
Normal file
13
parseline.c
Normal file
@@ -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)
|
||||
}
|
||||
25
xmlparser.c
Normal file
25
xmlparser.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2019
|
||||
** MUL_my_runner_2019
|
||||
** File description:
|
||||
** xmlparser
|
||||
*/
|
||||
|
||||
#include "xml.h"
|
||||
#include "xmlstate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user