34 lines
790 B
C
34 lines
790 B
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "common.h"
|
|
#include "file.h"
|
|
|
|
#define XML_NODE_CHILD_MAX 32
|
|
#define XML_NODE_NAME_MAX 32
|
|
#define XML_NODE_ATTRIBUTES_MAX 32
|
|
|
|
#define XML_STATE_NOTHING 0x00
|
|
#define XML_STATE_PARSING_NAME 0x01
|
|
#define XML_STATE_PARSING_ATTRIBUTES 0x02
|
|
|
|
typedef struct {
|
|
char *start;
|
|
char *internal;
|
|
char name[XML_NODE_NAME_MAX];
|
|
|
|
char *attributeNames[XML_NODE_ATTRIBUTES_MAX];
|
|
uint8_t attributeNameLengths[XML_NODE_ATTRIBUTES_MAX];
|
|
char *attributeValues[XML_NODE_ATTRIBUTES_MAX];
|
|
uint8_t attributeValueLengths[XML_NODE_ATTRIBUTES_MAX];
|
|
uint8_t attributeCount;
|
|
} xmlnode_t;
|
|
|
|
|
|
|
|
void xmlParseElement(xmlnode_t *node, char *string); |