From ec1018714f31913d68fb440ec9f9a885366df12d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 11 Mar 2008 23:04:35 +0000 Subject: More treebuilder (really 8.2.4.8 this time) Add tree handler entrypoint for creating elements with verbatim names svn path=/trunk/hubbub/; revision=3940 --- test/tree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/tree.c') diff --git a/test/tree.c b/test/tree.c index 76cf438..04ce026 100644 --- a/test/tree.c +++ b/test/tree.c @@ -37,6 +37,8 @@ static int create_doctype(void *ctx, const hubbub_string *qname, const hubbub_string *public_id, const hubbub_string *system_id, void **result); static int create_element(void *ctx, const hubbub_tag *tag, void **result); +static int create_element_verbatim(void *ctx, const uint8_t *name, size_t len, + void **result); static int create_text(void *ctx, const hubbub_string *data, void **result); static int ref_node(void *ctx, void *node); static int unref_node(void *ctx, void *node); @@ -51,6 +53,7 @@ static hubbub_tree_handler tree_handler = { create_comment, create_doctype, create_element, + create_element_verbatim, create_text, ref_node, unref_node, @@ -232,6 +235,22 @@ int create_element(void *ctx, const hubbub_tag *tag, void **result) return 0; } +int create_element_verbatim(void *ctx, const uint8_t *name, size_t len, + void **result) +{ + printf("Creating (%u) [element verbatim '%.*s']\n", + ++node_counter, len, name); + + GROW_REF + node_ref[node_counter] = 0; + + ref_node(ctx, (void *) node_counter); + + *result = (void *) node_counter; + + return 0; +} + int create_text(void *ctx, const hubbub_string *data, void **result) { printf("Creating (%u) [text '%.*s']\n", ++node_counter, -- cgit v1.2.3