aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHAMANO Kiyoto <[email protected]>2011-07-20 22:05:02 +0200
committerLars Magne Ingebrigtsen <[email protected]>2011-07-20 22:05:02 +0200
commit36881d164d73f53a1cbb390de8509506b14a2c89 (patch)
treed7636000bb78971d65c72ca15b1d095d99aed96a
parent1e98674d93976b78c3459c58cadece9565c53da2 (diff)
* xml.c (parse_region): If a document contains only comments, return that, too.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xml.c18
2 files changed, 20 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 86062435a5..02819607fd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-20 HAMANO Kiyoto <[email protected]>
+
+ * xml.c (parse_region): If a document contains only comments,
+ return that, too.
+
2011-07-20 Lars Magne Ingebrigtsen <[email protected]>
* xml.c (make_dom): Return comments, too.
diff --git a/src/xml.c b/src/xml.c
index 6dd52638b7..6d212b4405 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -125,9 +125,21 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
if (doc != NULL)
{
- node = xmlDocGetRootElement (doc);
- if (node != NULL)
- result = make_dom (node);
+ xmlNode *n = doc->children->next;
+ Lisp_Object r = Qnil;
+
+ while (n) {
+ if (r != Qnil)
+ result = Fcons (r, result);
+ r = make_dom (n);
+ n = n->next;
+ }
+
+ if (result == Qnil)
+ result = r;
+ else
+ result = Fnreverse (Fcons (r, result));
+
xmlFreeDoc (doc);
xmlCleanupParser ();
}