annotate src/xml.c @ 112397:a7191495c39c

Include entries from yesterdays checkins that were in an unsaved buffer.
author Ken Manheimer <ken.manheimer@gmail.com>
date Fri, 21 Jan 2011 11:36:24 -0500
parents 6378d1b57038
children
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.
112275
6378d1b57038 Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 111835
diff changeset
2 Copyright (C) 2010, 2011 Free Software Foundation, Inc.
110302
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 }
111835
05fc128a856f Return CDATA sections (like <style>foo</style>) as text nodes.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110692
diff changeset
65 else if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE)
110472
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|
111835
05fc128a856f Return CDATA sections (like <style>foo</style>) as text nodes.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110692
diff changeset
108 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
05fc128a856f Return CDATA sections (like <style>foo</style>) as text nodes.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110692
diff changeset
109 HTML_PARSE_NOBLANKS);
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
110 else
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
111 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
112 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
113 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
114 XML_PARSE_NOERROR);
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
115
110472
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
116 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
117 {
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
118 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
119 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
120 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
121 xmlFreeDoc (doc);
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
122 xmlCleanupParser ();
52590453d4f9 Rename libxml2 functions, and make parse tree format consistent with xml.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110359
diff changeset
123 }
110303
fdcc2e819a9b Remove some trailing white space.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110302
diff changeset
124
110302
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
125 return result;
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
126 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
127
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
128 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
129 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
130 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
131 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
132 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
133 (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
134 {
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
135 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
136 }
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
137
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
138 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
139 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
140 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
141 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
142 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
143 (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
144 {
110691
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
145 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
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 /***********************************************************************
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
150 Initialization
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
151 ***********************************************************************/
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
152 void
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
153 syms_of_xml (void)
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
154 {
110691
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_html_region);
4c93c1f8e379 xml.c: Rework the functions to take regions instead of strings,
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 110665
diff changeset
156 defsubr (&Slibxml_parse_xml_region);
110302
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
fd8902911ce3 Add support for the libxml2 library.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
159 #endif /* HAVE_LIBXML2 */