From: HAMANO Kiyoto Date: Wed, 20 Jul 2011 20:05:02 +0000 (+0200) Subject: * xml.c (parse_region): If a document contains only comments, return that, too. X-Git-Tag: emacs-pretest-24.0.90~104^2~184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=36881d164d73f53a1cbb390de8509506b14a2c89;p=emacs.git * xml.c (parse_region): If a document contains only comments, return that, too. --- diff --git a/src/ChangeLog b/src/ChangeLog index 86062435a5d..02819607fd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-07-20 HAMANO Kiyoto + + * xml.c (parse_region): If a document contains only comments, + return that, too. + 2011-07-20 Lars Magne Ingebrigtsen * xml.c (make_dom): Return comments, too. diff --git a/src/xml.c b/src/xml.c index 6dd52638b7d..6d212b44059 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 (); }