aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/xml.c b/src/xml.c
index 63041c96b24..a8a4d8122da 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -71,6 +71,14 @@ make_dom (xmlNode *node)
71 else 71 else
72 return Qnil; 72 return Qnil;
73 } 73 }
74 else if (node->type == XML_COMMENT_NODE)
75 {
76 if (node->content)
77 return list3 (intern ("comment"), Qnil,
78 build_string ((char *) node->content));
79 else
80 return Qnil;
81 }
74 else 82 else
75 return Qnil; 83 return Qnil;
76} 84}
@@ -117,9 +125,22 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
117 125
118 if (doc != NULL) 126 if (doc != NULL)
119 { 127 {
120 node = xmlDocGetRootElement (doc); 128 xmlNode *n = doc->children->next;
121 if (node != NULL) 129 Lisp_Object r = Qnil;
122 result = make_dom (node); 130
131 while (n) {
132 if (r != Qnil)
133 result = Fcons (r, result);
134 r = make_dom (n);
135 n = n->next;
136 }
137
138 if (result == Qnil)
139 result = r;
140 else
141 result = Fcons (intern ("top"),
142 Fcons (Qnil, Fnreverse (Fcons (r, result))));
143
123 xmlFreeDoc (doc); 144 xmlFreeDoc (doc);
124 xmlCleanupParser (); 145 xmlCleanupParser ();
125 } 146 }