From 3c2317e89100833812a7194c0d9d39ae0f52cb33 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 6 Dec 2010 17:59:52 +0100 Subject: [PATCH] Return CDATA sections (like ) as text nodes. Also ignore blank HTML nodes. --- src/ChangeLog | 6 ++++++ src/xml.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e05855a4abf..47dd5c650c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-12-06 Lars Magne Ingebrigtsen + + * xml.c (parse_region): Ignore blank HTML nodes. + (make_dom): Return CDATA sections (like ) as + text nodes. + 2010-12-06 Stefan Monnier * lread.c (read1): Allow newstyle unquote outside of backquote. diff --git a/src/xml.c b/src/xml.c index a686e55f0b0..fde9d4d382a 100644 --- a/src/xml.c +++ b/src/xml.c @@ -62,7 +62,7 @@ Lisp_Object make_dom (xmlNode *node) return Fnreverse (result); } - else if (node->type == XML_TEXT_NODE) + else if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) { if (node->content) return build_string (node->content); @@ -105,7 +105,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), bytes, burl, "utf-8", HTML_PARSE_RECOVER|HTML_PARSE_NONET| - HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); + HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| + HTML_PARSE_NOBLANKS); else doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), bytes, burl, "utf-8", -- 2.39.5