summaryrefslogtreecommitdiff
path: root/examples/dom-structure-dump.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2012-03-24 16:28:35 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2012-03-24 16:28:35 +0000
commit4b496cb8ca478669f875c97941f5fcbb801ae474 (patch)
tree76365fd40a23d2b572cdfdce6f3d462088a695f4 /examples/dom-structure-dump.c
parenta9eab223e339eabdf8c02157ecdeeb38a1d73ab3 (diff)
downloadlibdom-4b496cb8ca478669f875c97941f5fcbb801ae474.tar.gz
libdom-4b496cb8ca478669f875c97941f5fcbb801ae474.tar.bz2
Dump the title to prove dom_node_get_text_content
svn path=/trunk/libdom/; revision=13600
Diffstat (limited to 'examples/dom-structure-dump.c')
-rw-r--r--examples/dom-structure-dump.c11
1 files changed, 11 insertions, 0 deletions
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);