Mercurial > pidgin
comparison libpurple/protocols/jabber/parser.c @ 23424:1b3aea146613
Added a structured error handler callback to the xmlSAXHandler struct.
This callback is used preferentially over the warning/error/fatal_error
callbacks (whcih we don't implement, anyways) for 'modules which support the
new error reporting mechanism'. This should help us detect parsing errors.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Fri, 04 Jul 2008 15:41:26 +0000 |
parents | ada1640fa260 |
children | 0eca6c183d60 |
comparison
equal
deleted
inserted
replaced
23423:a2f63b74fe31 | 23424:1b3aea146613 |
---|---|
128 | 128 |
129 if(!text || !text_len) | 129 if(!text || !text_len) |
130 return; | 130 return; |
131 | 131 |
132 xmlnode_insert_data(js->current, (const char*) text, text_len); | 132 xmlnode_insert_data(js->current, (const char*) text, text_len); |
133 } | |
134 | |
135 static void | |
136 jabber_parser_structured_error_handler(void *user_data, xmlErrorPtr error) | |
137 { | |
138 JabberStream *js = user_data; | |
139 | |
140 purple_debug_error("jabber", "XML parser error for JabberStream %p: " | |
141 "Domain %i, code %i, level %i: %s\n", | |
142 js, | |
143 error->domain, error->code, error->level, | |
144 (error->message ? error->message : "(null)")); | |
133 } | 145 } |
134 | 146 |
135 static xmlSAXHandler jabber_parser_libxml = { | 147 static xmlSAXHandler jabber_parser_libxml = { |
136 NULL, /*internalSubset*/ | 148 NULL, /*internalSubset*/ |
137 NULL, /*isStandalone*/ | 149 NULL, /*isStandalone*/ |
162 NULL, /*externalSubset*/ | 174 NULL, /*externalSubset*/ |
163 XML_SAX2_MAGIC, /*initialized*/ | 175 XML_SAX2_MAGIC, /*initialized*/ |
164 NULL, /*_private*/ | 176 NULL, /*_private*/ |
165 jabber_parser_element_start_libxml, /*startElementNs*/ | 177 jabber_parser_element_start_libxml, /*startElementNs*/ |
166 jabber_parser_element_end_libxml, /*endElementNs*/ | 178 jabber_parser_element_end_libxml, /*endElementNs*/ |
167 NULL /*serror*/ | 179 jabber_parser_structured_error_handler /*serror*/ |
168 }; | 180 }; |
169 | 181 |
170 void | 182 void |
171 jabber_parser_setup(JabberStream *js) | 183 jabber_parser_setup(JabberStream *js) |
172 { | 184 { |