annotate plugins/jabber/xmlparse.h @ 1769:68eddf56f419

[gaim-migrate @ 1779] notes on future UI stuff for PRPLs. also cleaning up rob's mess in server.c. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 28 Apr 2001 08:11:42 +0000
parents afa63ac2fd84
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1347
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 The contents of this file are subject to the Mozilla Public License
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 Version 1.1 (the "License"); you may not use this file except in
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 compliance with the License. You may obtain a copy of the License at
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 http://www.mozilla.org/MPL/
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 Software distributed under the License is distributed on an "AS IS"
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 License for the specific language governing rights and limitations
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 under the License.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 The Original Code is expat.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 The Initial Developer of the Original Code is James Clark.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 Portions created by James Clark are Copyright (C) 1998, 1999
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 James Clark. All Rights Reserved.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 Contributor(s):
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 Alternatively, the contents of this file may be used under the terms
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 of the GNU General Public License (the "GPL"), in which case the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 provisions of the GPL are applicable instead of those above. If you
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 wish to allow use of your version of this file only under the terms of
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 the GPL and not to allow others to use your version of this file under
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 the MPL, indicate your decision by deleting the provisions above and
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 replace them with the notice and other provisions required by the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 GPL. If you do not delete the provisions above, a recipient may use
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 your version of this file under either the MPL or the GPL.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #ifndef XmlParse_INCLUDED
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #define XmlParse_INCLUDED 1
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #ifdef __cplusplus
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 extern "C" {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #endif
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #ifndef XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #define XMLPARSEAPI /* as nothing */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #endif
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 typedef void *XML_Parser;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #ifdef XML_UNICODE_WCHAR_T
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 /* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 uses Unicode. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 /* Information is UTF-16 encoded as wchar_ts */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 #ifndef XML_UNICODE
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 #define XML_UNICODE
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 #endif
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 #include <stddef.h>
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 typedef wchar_t XML_Char;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 typedef wchar_t XML_LChar;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 #else /* not XML_UNICODE_WCHAR_T */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 #ifdef XML_UNICODE
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 /* Information is UTF-16 encoded as unsigned shorts */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 typedef unsigned short XML_Char;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 typedef char XML_LChar;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 #else /* not XML_UNICODE */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 /* Information is UTF-8 encoded. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 typedef char XML_Char;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 typedef char XML_LChar;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 #endif /* not XML_UNICODE */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 #endif /* not XML_UNICODE_WCHAR_T */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 /* Constructs a new parser; encoding is the encoding specified by the external
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 protocol or null if there is none specified. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 XML_Parser XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 XML_ParserCreate(const XML_Char *encoding);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 /* Constructs a new parser and namespace processor. Element type names
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 and attribute names that belong to a namespace will be expanded;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 unprefixed attribute names are never expanded; unprefixed element type
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 names are expanded only if there is a default namespace. The expanded
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 name is the concatenation of the namespace URI, the namespace separator character,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 and the local part of the name. If the namespace separator is '\0' then
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 the namespace URI and the local part will be concatenated without any
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 separator. When a namespace is not declared, the name and prefix will be
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 passed through without expansion. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 XML_Parser XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 /* atts is array of name/value pairs, terminated by 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 names and values are 0 terminated. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 typedef void (*XML_StartElementHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 const XML_Char *name,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 const XML_Char **atts);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 typedef void (*XML_EndElementHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 const XML_Char *name);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 /* s is not 0 terminated. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 typedef void (*XML_CharacterDataHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 const XML_Char *s,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 int len);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 /* target and data are 0 terminated */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 typedef void (*XML_ProcessingInstructionHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 const XML_Char *target,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 const XML_Char *data);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 /* data is 0 terminated */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 typedef void (*XML_StartCdataSectionHandler)(void *userData);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 typedef void (*XML_EndCdataSectionHandler)(void *userData);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 /* This is called for any characters in the XML document for
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 which there is no applicable handler. This includes both
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 characters that are part of markup which is of a kind that is
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 not reported (comments, markup declarations), or characters
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 that are part of a construct which could be reported but
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 for which no handler has been supplied. The characters are passed
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 exactly as they were in the XML document except that
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 they will be encoded in UTF-8. Line boundaries are not normalized.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 Note that a byte order mark character is not passed to the default handler.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 There are no guarantees about how characters are divided between calls
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 to the default handler: for example, a comment might be split between
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 multiple calls. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 typedef void (*XML_DefaultHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 const XML_Char *s,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 int len);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 /* This is called for a declaration of an unparsed (NDATA)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 entity. The base argument is whatever was set by XML_SetBase.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 The entityName, systemId and notationName arguments will never be null.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 The other arguments may be. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 const XML_Char *entityName,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 const XML_Char *base,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 const XML_Char *systemId,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 const XML_Char *publicId,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 const XML_Char *notationName);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 /* This is called for a declaration of notation.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 The base argument is whatever was set by XML_SetBase.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 The notationName will never be null. The other arguments can be. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 typedef void (*XML_NotationDeclHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 const XML_Char *notationName,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 const XML_Char *base,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 const XML_Char *systemId,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 const XML_Char *publicId);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 /* When namespace processing is enabled, these are called once for
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 each namespace declaration. The call to the start and end element
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 handlers occur between the calls to the start and end namespace
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 declaration handlers. For an xmlns attribute, prefix will be null.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 For an xmlns="" attribute, uri will be null. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 const XML_Char *prefix,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 const XML_Char *uri);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 const XML_Char *prefix);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 /* This is called if the document is not standalone (it has an
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 external subset or a reference to a parameter entity, but does not
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 have standalone="yes"). If this handler returns 0, then processing
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 will not continue, and the parser will return a
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 XML_ERROR_NOT_STANDALONE error. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 typedef int (*XML_NotStandaloneHandler)(void *userData);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 /* This is called for a reference to an external parsed general entity.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 The referenced entity is not automatically parsed.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 The application can parse it immediately or later using
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 XML_ExternalEntityParserCreate.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 The parser argument is the parser parsing the entity containing the reference;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 it can be passed as the parser argument to XML_ExternalEntityParserCreate.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 The systemId argument is the system identifier as specified in the entity declaration;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 it will not be null.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 The base argument is the system identifier that should be used as the base for
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 resolving systemId if systemId was relative; this is set by XML_SetBase;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 it may be null.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 The publicId argument is the public identifier as specified in the entity declaration,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 or null if none was specified; the whitespace in the public identifier
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 will have been normalized as required by the XML spec.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 The context argument specifies the parsing context in the format
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 expected by the context argument to
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 XML_ExternalEntityParserCreate; context is valid only until the handler
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 returns, so if the referenced entity is to be parsed later, it must be copied.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 The handler should return 0 if processing should not continue because of
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 a fatal error in the handling of the external entity.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 error.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 Note that unlike other handlers the first argument is the parser, not userData. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 const XML_Char *context,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 const XML_Char *base,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 const XML_Char *systemId,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 const XML_Char *publicId);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 /* This structure is filled in by the XML_UnknownEncodingHandler
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 to provide information to the parser about encodings that are unknown
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 to the parser.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 The map[b] member gives information about byte sequences
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 whose first byte is b.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 If map[b] is -1, then the byte sequence is malformed.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 sequence that encodes a single Unicode scalar value.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 The data member will be passed as the first argument to the convert function.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 The convert function is used to convert multibyte sequences;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 The convert function must return the Unicode scalar value
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 represented by this byte sequence or -1 if the byte sequence is malformed.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 The convert function may be null if the encoding is a single-byte encoding,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 that is if map[b] >= -1 for all bytes b.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 When the parser is finished with the encoding, then if release is not null,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 it will call release passing it the data member;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 once release has been called, the convert function will not be called again.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 Expat places certain restrictions on the encodings that are supported
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 using this mechanism.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 1. Every ASCII character that can appear in a well-formed XML document,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 other than the characters
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 $@\^`{}~
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 must be represented by a single byte, and that byte must be the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 same byte that represents that character in ASCII.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 2. No character may require more than 4 bytes to encode.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 3. All characters encoded must have Unicode scalar values <= 0xFFFF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 (ie characters that would be encoded by surrogates in UTF-16
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 are not allowed). Note that this restriction doesn't apply to
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 the built-in support for UTF-8 and UTF-16.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 4. No Unicode character may be encoded by more than one distinct sequence
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 of bytes. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 typedef struct {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 int map[256];
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 void *data;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 int (*convert)(void *data, const char *s);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 void (*release)(void *data);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 } XML_Encoding;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 /* This is called for an encoding that is unknown to the parser.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 The encodingHandlerData argument is that which was passed as the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 second argument to XML_SetUnknownEncodingHandler.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 The name argument gives the name of the encoding as specified in
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 the encoding declaration.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 If the callback can provide information about the encoding,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 it must fill in the XML_Encoding structure, and return 1.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 Otherwise it must return 0.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 If info does not describe a suitable encoding,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 then the parser will return an XML_UNKNOWN_ENCODING error. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 const XML_Char *name,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 XML_Encoding *info);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 XML_SetElementHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 XML_StartElementHandler start,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 XML_EndElementHandler end);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 XML_SetCharacterDataHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 XML_CharacterDataHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 XML_SetProcessingInstructionHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 XML_ProcessingInstructionHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 XML_SetCommentHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 XML_CommentHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 XML_SetCdataSectionHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 XML_StartCdataSectionHandler start,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 XML_EndCdataSectionHandler end);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 /* This sets the default handler and also inhibits expansion of internal entities.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 The entity reference will be passed to the default handler. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 XML_SetDefaultHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 XML_DefaultHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 /* This sets the default handler but does not inhibit expansion of internal entities.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 The entity reference will not be passed to the default handler. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 XML_SetDefaultHandlerExpand(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 XML_DefaultHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 XML_UnparsedEntityDeclHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 XML_SetNotationDeclHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 XML_NotationDeclHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 XML_SetNamespaceDeclHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 XML_StartNamespaceDeclHandler start,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 XML_EndNamespaceDeclHandler end);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 XML_SetNotStandaloneHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 XML_NotStandaloneHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 XML_SetExternalEntityRefHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 XML_ExternalEntityRefHandler handler);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 /* If a non-null value for arg is specified here, then it will be passed
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 as the first argument to the external entity ref handler instead
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 of the parser object. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 XML_SetUnknownEncodingHandler(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 XML_UnknownEncodingHandler handler,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 void *encodingHandlerData);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 /* This can be called within a handler for a start element, end element,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 processing instruction or character data. It causes the corresponding
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 markup to be passed to the default handler. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 /* This value is passed as the userData argument to callbacks. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 XML_SetUserData(XML_Parser parser, void *userData);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 /* Returns the last value set by XML_SetUserData or null. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 #define XML_GetUserData(parser) (*(void **)(parser))
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 /* This is equivalent to supplying an encoding argument
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 to XML_CreateParser. It must not be called after XML_Parse
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 or XML_ParseBuffer. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 int XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 /* If this function is called, then the parser will be passed
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 as the first argument to callbacks instead of userData.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 The userData will still be accessible using XML_GetUserData. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 XML_UseParserAsHandlerArg(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 /* Sets the base to be used for resolving relative URIs in system identifiers in
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 declarations. Resolving relative identifiers is left to the application:
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 this value will be passed through as the base argument to the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 XML_ExternalEntityRefHandler, XML_NotationDeclHandler
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 and XML_UnparsedEntityDeclHandler. The base argument will be copied.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 Returns zero if out of memory, non-zero otherwise. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 int XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 XML_SetBase(XML_Parser parser, const XML_Char *base);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 const XML_Char XMLPARSEAPI *
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 XML_GetBase(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 /* Returns the number of the attributes passed in last call to the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 XML_StartElementHandler that were specified in the start-tag rather
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 than defaulted. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 /* Parses some input. Returns 0 if a fatal error is detected.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 The last call to XML_Parse must have isFinal true;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 len may be zero for this call (or any other). */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 int XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 void XMLPARSEAPI *
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 XML_GetBuffer(XML_Parser parser, int len);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 int XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 /* Creates an XML_Parser object that can parse an external general entity;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 context is a '\0'-terminated string specifying the parse context;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 encoding is a '\0'-terminated string giving the name of the externally specified encoding,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 or null if there is no externally specified encoding.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 The context string consists of a sequence of tokens separated by formfeeds (\f);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 a token consisting of a name specifies that the general entity of the name
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 is open; a token of the form prefix=uri specifies the namespace for a particular
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 prefix; a token of the form =uri specifies the default namespace.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 This can be called at any point after the first call to an ExternalEntityRefHandler
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 so longer as the parser has not yet been freed.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 The new parser is completely independent and may safely be used in a separate thread.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411 The handlers and userData are initialized from the parser argument.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 XML_Parser XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 XML_ExternalEntityParserCreate(XML_Parser parser,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 const XML_Char *context,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 const XML_Char *encoding);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 enum XML_Error {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 XML_ERROR_NONE,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 XML_ERROR_NO_MEMORY,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421 XML_ERROR_SYNTAX,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 XML_ERROR_NO_ELEMENTS,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 XML_ERROR_INVALID_TOKEN,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 XML_ERROR_UNCLOSED_TOKEN,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 XML_ERROR_PARTIAL_CHAR,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 XML_ERROR_TAG_MISMATCH,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 XML_ERROR_DUPLICATE_ATTRIBUTE,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 XML_ERROR_PARAM_ENTITY_REF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 XML_ERROR_UNDEFINED_ENTITY,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 XML_ERROR_RECURSIVE_ENTITY_REF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 XML_ERROR_ASYNC_ENTITY,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 XML_ERROR_BAD_CHAR_REF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 XML_ERROR_BINARY_ENTITY_REF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 XML_ERROR_MISPLACED_XML_PI,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 XML_ERROR_UNKNOWN_ENCODING,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 XML_ERROR_INCORRECT_ENCODING,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 XML_ERROR_UNCLOSED_CDATA_SECTION,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 XML_ERROR_EXTERNAL_ENTITY_HANDLING,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 XML_ERROR_NOT_STANDALONE
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 };
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 returns information about the error. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 /* These functions return information about the current parse location.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 They may be called when XML_Parse or XML_ParseBuffer return 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 in this case the location is the location of the character at which
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 the error was detected.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 They may also be called from any other callback called to report
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454 some parse event; in this the location is the location of the first
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 of the sequence of characters that generated the event. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 /* Return the number of bytes in the current event.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 Returns 0 if the event is in an internal entity. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 /* For backwards compatibility with previous versions. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 /* Frees memory used by the parser. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 void XMLPARSEAPI
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 XML_ParserFree(XML_Parser parser);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 /* Returns a string describing the error. */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 #ifdef __cplusplus
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 #endif
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 #endif /* not XmlParse_INCLUDED */