aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/xml.c b/src/xml.c
index 8b485e73649..f0422875f7e 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -124,6 +124,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
124 124
125 if (doc != NULL) 125 if (doc != NULL)
126 { 126 {
127 /* If the document is just comments, then this should get us the
128 nodes anyway. */
127 xmlNode *n = doc->children->next; 129 xmlNode *n = doc->children->next;
128 Lisp_Object r = Qnil; 130 Lisp_Object r = Qnil;
129 131
@@ -134,9 +136,13 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
134 n = n->next; 136 n = n->next;
135 } 137 }
136 138
137 if (NILP (result)) 139 if (NILP (result)) {
138 result = r; 140 /* The document isn't just comments, so get the tree the
139 else 141 proper way. */
142 xmlNode *node = xmlDocGetRootElement (doc);
143 if (node != NULL)
144 result = make_dom (node);
145 } else
140 result = Fcons (intern ("top"), 146 result = Fcons (intern ("top"),
141 Fcons (Qnil, Fnreverse (Fcons (r, result)))); 147 Fcons (Qnil, Fnreverse (Fcons (r, result))));
142 148