[tracker/rss-enclosures] tracker-extract-html: Improve <script> bypassing.



commit 484e8214d79d0af99aa4b3cc19536b661e5518aa
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 19 16:37:56 2010 +0200

    tracker-extract-html: Improve <script> bypassing.

 src/tracker-extract/tracker-extract-html.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-html.c b/src/tracker-extract/tracker-extract-html.c
index 7092411..55a9732 100644
--- a/src/tracker-extract/tracker-extract-html.c
+++ b/src/tracker-extract/tracker-extract-html.c
@@ -185,6 +185,19 @@ parser_start_element (void           *data,
 }
 
 static void
+parser_end_element (void           *data,
+                    const xmlChar  *name_)
+{
+	parser_data *pd = data;
+	const gchar *name = (const gchar*) name_;
+
+        if (g_ascii_strcasecmp (name, "title") == 0 ||
+            g_ascii_strcasecmp (name, "script") == 0) {
+                    pd->current = -1;
+        }
+}
+
+static void
 parser_characters (void          *data,
                    const xmlChar *ch,
                    int            len)
@@ -220,8 +233,6 @@ parser_characters (void          *data,
 		}
 		break;
 	}
-
-	pd->current = -1;
 }
 
 static void
@@ -249,7 +260,7 @@ extract_html (const gchar          *uri,
 		NULL, /* startDocument */
 		NULL, /* endDocument */
 		parser_start_element, /* startElement */
-		NULL, /* endElement */
+		parser_end_element, /* endElement */
 		NULL, /* reference */
 		parser_characters, /* characters */
 		NULL, /* ignorableWhitespace */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]