2 * Copyright (C) 2001 Ximian Inc.
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
23 * DO NOT USE THIS CODE OUTSIDE OF CAMEL
25 * IT IS SUBJECT TO CHANGE OR MAY VANISH AT ANY TIME
28 #ifndef _CAMEL_HTML_PARSER_H
29 #define _CAMEL_HTML_PARSER_H
31 #include <camel/camel-object.h>
33 #define CAMEL_HTML_PARSER(obj) CAMEL_CHECK_CAST (obj, camel_html_parser_get_type (), CamelHTMLParser)
34 #define CAMEL_HTML_PARSER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_html_parser_get_type (), CamelHTMLParserClass)
35 #define CAMEL_IS_HTML_PARSER(obj) CAMEL_CHECK_TYPE (obj, camel_html_parser_get_type ())
39 typedef struct _CamelHTMLParserClass CamelHTMLParserClass;
40 typedef struct _CamelHTMLParser CamelHTMLParser;
42 /* Parser/tokeniser states */
43 typedef enum _camel_html_parser_t {
44 CAMEL_HTML_PARSER_DATA, /* raw data */
45 CAMEL_HTML_PARSER_ENT, /* entity in data */
46 CAMEL_HTML_PARSER_ELEMENT, /* element (tag + attributes scanned) */
47 CAMEL_HTML_PARSER_TAG, /* tag */
48 CAMEL_HTML_PARSER_DTDENT, /* dtd entity? <! blah blah > */
49 CAMEL_HTML_PARSER_COMMENT0, /* start of comment */
50 CAMEL_HTML_PARSER_COMMENT, /* body of comment */
51 CAMEL_HTML_PARSER_ATTR0, /* start of attribute */
52 CAMEL_HTML_PARSER_ATTR, /* attribute */
53 CAMEL_HTML_PARSER_VAL0, /* start of value */
54 CAMEL_HTML_PARSER_VAL, /* value */
55 CAMEL_HTML_PARSER_VAL_ENT, /* entity in value */
56 CAMEL_HTML_PARSER_EOD, /* end of current data */
57 CAMEL_HTML_PARSER_EOF, /* end of file */
58 } camel_html_parser_t;
60 struct _CamelHTMLParser {
63 struct _CamelHTMLParserPrivate *priv;
66 struct _CamelHTMLParserClass {
67 CamelObjectClass parent_class;
70 CamelType camel_html_parser_get_type (void);
71 CamelHTMLParser *camel_html_parser_new (void);
73 void camel_html_parser_set_data(CamelHTMLParser *hp, const char *start, int len, int last);
74 camel_html_parser_t camel_html_parser_step(CamelHTMLParser *hp, const char **datap, int *lenp);
75 const char *camel_html_parser_left(CamelHTMLParser *hp, int *lenp);
76 const char *camel_html_parser_tag(CamelHTMLParser *hp);
77 const char *camel_html_parser_attr(CamelHTMLParser *hp, const char *name);
78 const GPtrArray *camel_html_parser_attr_list(CamelHTMLParser *hp, const GPtrArray **values);
82 #endif /* ! _CAMEL_HTML_PARSER_H */