iconv: Bail out of the loop when an illegal sequence of bytes occurs.
[elinks/elinks-j605.git] / src / dom / sgml / sgml.c
blob145d894d701bb81c1c0ae0954a394791de418c3d
1 /* SGML generics */
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
7 #include <stdlib.h>
8 #include <string.h>
10 #include "elinks.h"
12 #include "dom/node.h"
13 #include "dom/sgml/sgml.h"
14 #include "dom/string.h"
15 #include "util/error.h"
17 /* Backend includes: */
19 #include "dom/sgml/docbook/docbook.h"
20 #include "dom/sgml/html/html.h"
21 #include "dom/sgml/rss/rss.h"
22 #include "dom/sgml/xbel/xbel.h"
25 int
26 sgml_info_strcmp(const void *key_, const void *node_)
28 struct dom_node *key = (struct dom_node *) key_;
29 struct sgml_node_info *node = (struct sgml_node_info *) node_;
31 return dom_string_casecmp(&key->string, &node->string);
34 struct sgml_info *sgml_info[SGML_DOCTYPES] = {
35 &sgml_docbook_info,
36 &sgml_html_info,
37 &sgml_rss_info,
38 &sgml_xbel_info,
41 struct sgml_info *
42 get_sgml_info(enum sgml_document_type doctype)
44 return doctype < SGML_DOCTYPES ? sgml_info[doctype] : NULL;