@@ -2,7 +2,6 @@
2#include <stdint.h>
2#include <stdint.h>
4typedef struct document document;
4typedef struct document document;
5−typedef struct node node;
7// Pair of indexes into the input string
6// Pair of indexes into the input string
8typedef struct
7typedef struct
@@ -17,6 +16,15 @@ typedef struct
17 str value;
16 str value;
21+ str name; // tag name, e.g. <[foo]>
22+ str inner; // inner text, <foo>[bar]</foo>
23+ str outer; // outer text, [<foo>bar</foo>]
24+ str attrs; // all the attributes, in the attribute buffer (not usable)
25+ str nodes; // all the nodes, in the node buffer (not usable)
20// Convention: if slen can be -1 for nul-terminated, or given explicitly
28// Convention: if slen can be -1 for nul-terminated, or given explicitly
22// Parse a document, returns a potentially invalid document - use document_error to check
30// Parse a document, returns a potentially invalid document - use document_error to check
@@ -36,10 +44,6 @@ char* document_error(document* d);
36// return the root node of the document - imagine the document is wrapped in <>$DOC</> tags
44// return the root node of the document - imagine the document is wrapped in <>$DOC</> tags
37node* document_node(document* d);
45node* document_node(document* d);
39−// Get the span of a node
40−str node_inner(node* n);
41−str node_outer(node* n);
43// List all items within a node
47// List all items within a node
44node* node_children(document* d, node* n, int* res);
48node* node_children(document* d, node* n, int* res);
45attr* node_attributes(document* d, node* n, int* res);
49attr* node_attributes(document* d, node* n, int* res);