r13600 dsilvers - /trunk/libdom/examples/dom-structure-dump.c

netsurf at semichrome.net netsurf at semichrome.net
Sat Mar 24 16:28:35 GMT 2012


Author: dsilvers
Date: Sat Mar 24 11:28:35 2012
New Revision: 13600

URL: http://source.netsurf-browser.org?rev=13600&view=rev
Log:
Dump the title to prove dom_node_get_text_content

Modified:
    trunk/libdom/examples/dom-structure-dump.c

Modified: trunk/libdom/examples/dom-structure-dump.c
URL: http://source.netsurf-browser.org/trunk/libdom/examples/dom-structure-dump.c?rev=13600&r1=13599&r2=13600&view=diff
==============================================================================
--- trunk/libdom/examples/dom-structure-dump.c (original)
+++ trunk/libdom/examples/dom-structure-dump.c Sat Mar 24 11:28:35 2012
@@ -239,6 +239,17 @@
 	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);




More information about the netsurf-commits mailing list