From 4b496cb8ca478669f875c97941f5fcbb801ae474 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 24 Mar 2012 16:28:35 +0000 Subject: Dump the title to prove dom_node_get_text_content svn path=/trunk/libdom/; revision=13600 --- examples/dom-structure-dump.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'examples') diff --git a/examples/dom-structure-dump.c b/examples/dom-structure-dump.c index 3e52930..e307f0f 100644 --- a/examples/dom-structure-dump.c +++ b/examples/dom-structure-dump.c @@ -239,6 +239,17 @@ bool dump_dom_element(dom_node *node, int depth) string = dom_string_data(node_name); length = dom_string_byte_length(node_name); printf("[%.*s]", (int)length, string); + + if (length == 5 && strncmp(string, "title", 5) == 0) { + /* Title tag, gather the title */ + dom_string *str; + exc = dom_node_get_text_content(node, &str); + if (exc == DOM_NO_ERR && str != NULL) { + printf(" $%.*s$", (int)dom_string_byte_length(str), + dom_string_data(str)); + dom_string_unref(str); + } + } /* Finished with the node_name dom_string */ dom_string_unref(node_name); -- cgit v1.2.3