annotate src/xml.c @ 111247:0d62b248cade

* admin/notes/bugtracker: Mention "found".
author Glenn Morris <rgm@gnu.org>
date Sat, 30 Oct 2010 17:38:13 -0700
parents 5687cf9288cf
children 05fc128a856f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 /* Interface to libxml2.
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
2 Copyright (C) 2010 Free Software Foundation, Inc.
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
3
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
6 GNU Emacs is free software: you can redistribute it and/or modify
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8 the Free Software Foundation, either version 3 of the License, or
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9 (at your option) any later version.
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
14 GNU General Public License for more details.
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
15
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19 #include <config.h>
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
21 #ifdef HAVE_LIBXML2
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
22
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
23 #include <setjmp.h>
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
24 #include <libxml/tree.h>
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25 #include <libxml/parser.h>
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26 #include <libxml/HTMLparser.h>
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
27
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
28 #include "lisp.h"
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
29 #include "buffer.h"
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
30
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
31 Lisp_Object make_dom (xmlNode *node)
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
32 {
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
33 if (node->type == XML_ELEMENT_NODE)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
34 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
35 Lisp_Object result = Fcons (intern (node->name), Qnil);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
36 xmlNode *child;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
37 xmlAttr *property;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
38 Lisp_Object plist = Qnil;
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
39
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
40 /* First add the attributes. */
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
41 property = node->properties;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
42 while (property != NULL)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
43 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
44 if (property->children &&
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
45 property->children->content)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
46 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
47 plist = Fcons (Fcons (intern (property->name),
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
48 build_string (property->children->content)),
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
49 plist);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
50 }
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
51 property = property->next;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
52 }
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
53 result = Fcons (Fnreverse (plist), result);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
54
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
55 /* Then add the children of the node. */
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
56 child = node->children;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
57 while (child != NULL)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
58 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
59 result = Fcons (make_dom (child), result);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
60 child = child->next;
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
61 }
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
62
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
63 return Fnreverse (result);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
64 }
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
65 else if (node->type == XML_TEXT_NODE)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
66 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
67 if (node->content)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
68 return build_string (node->content);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
69 else
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
70 return Qnil;
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
71 }
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
72 else
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
73 return Qnil;
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
74 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
75
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
76 static Lisp_Object
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
77 parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp)
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
78 {
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
79 xmlDoc *doc;
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
80 xmlNode *node;
110359
a828354ee483 * xml.c (parse_string): Renamed to parse_string(), since that's
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110331
diff changeset
81 Lisp_Object result = Qnil;
110665
49d445615c07 * src/xml.c (parse_string): Use const.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 110472
diff changeset
82 const char *burl = "";
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
83 EMACS_INT bytes;
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
84 EMACS_INT istart, iend;
110303
fdcc2e819a9b Remove some trailing white space.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110302
diff changeset
85
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
86 LIBXML_TEST_VERSION;
110303
fdcc2e819a9b Remove some trailing white space.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110302
diff changeset
87
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
88 validate_region (&start, &end);
110692
5687cf9288cf Clean up trailing whitespace.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110691
diff changeset
89
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
90 istart = XINT (start);
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
91 iend = XINT (end);
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
92
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
93 if (istart < GPT && GPT < iend)
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
94 move_gap (iend);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
95
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
96 if (! NILP (base_url))
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
97 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
98 CHECK_STRING (base_url);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
99 burl = SDATA (base_url);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
100 }
110303
fdcc2e819a9b Remove some trailing white space.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110302
diff changeset
101
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
102 bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
110692
5687cf9288cf Clean up trailing whitespace.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110691
diff changeset
103
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
104 if (htmlp)
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
105 doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
106 bytes, burl, "utf-8",
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
107 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
108 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR);
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
109 else
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
110 doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
111 bytes, burl, "utf-8",
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
112 XML_PARSE_NONET|XML_PARSE_NOWARNING|
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
113 XML_PARSE_NOERROR);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
114
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
115 if (doc != NULL)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
116 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
117 node = xmlDocGetRootElement (doc);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
118 if (node != NULL)
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
119 result = make_dom (node);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
120 xmlFreeDoc (doc);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
121 xmlCleanupParser ();
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
122 }
110303
fdcc2e819a9b Remove some trailing white space.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110302
diff changeset
123
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
124 return result;
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
125 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
126
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
127 DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
128 Slibxml_parse_html_region,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
129 2, 3, 0,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
130 doc: /* Parse the region as an HTML document and return the parse tree.
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
131 If BASE-URL is non-nil, it is used to expand relative URLs. */)
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
132 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
133 {
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
134 return parse_region (start, end, base_url, 1);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
135 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
136
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
137 DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
138 Slibxml_parse_xml_region,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
139 2, 3, 0,
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
140 doc: /* Parse the region as an XML document and return the parse tree.
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
141 If BASE-URL is non-nil, it is used to expand relative URLs. */)
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
142 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
143 {
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
144 return parse_region (start, end, base_url, 0);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
145 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
146
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
147
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
148 /***********************************************************************
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
149 Initialization
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
150 ***********************************************************************/
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
151 void
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
152 syms_of_xml (void)
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
153 {
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
154 defsubr (&Slibxml_parse_html_region);
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
155 defsubr (&Slibxml_parse_xml_region);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
156 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
157
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
158 #endif /* HAVE_LIBXML2 */