summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-03-11 23:04:35 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-03-11 23:04:35 +0000
commitec1018714f31913d68fb440ec9f9a885366df12d (patch)
treea1f6128b8e35069b389bbc403b5c9b18a5233f80 /test
parent04e5f38a5e8e471db41dd010e2c7c0ae9b016601 (diff)
downloadlibhubbub-ec1018714f31913d68fb440ec9f9a885366df12d.tar.gz
libhubbub-ec1018714f31913d68fb440ec9f9a885366df12d.tar.bz2
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
Diffstat (limited to 'test')
-rw-r--r--test/tree.c19
1 files changed, 19 insertions, 0 deletions
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,