blob: a90b217a12f90bc0e090b9231d2842c9ba78d8f4 [file] [log] [blame]
Daniel Veillardbe70ff71999-07-05 16:50:46 +00001/*
2 * HTMLparser.h : inf=terface for an HTML 4.0 non-verifying parser
3 *
4 * See Copyright for the status of this software.
5 *
6 * Daniel.Veillard@w3.org
7 */
8
9#ifndef __HTML_PARSER_H__
10#define __HTML_PARSER_H__
11#include "parser.h"
12
Daniel Veillardf600e251999-12-18 15:32:46 +000013#ifdef __cplusplus
Daniel Veillard5cb5ab81999-12-21 15:35:29 +000014extern "C" {
Daniel Veillardf600e251999-12-18 15:32:46 +000015#endif
16
Daniel Veillard5233ffc1999-07-06 22:25:25 +000017/*
18 * Most of the back-end structures from XML and HTML are shared
19 */
Daniel Veillardbe70ff71999-07-05 16:50:46 +000020typedef xmlParserCtxt htmlParserCtxt;
21typedef xmlParserCtxtPtr htmlParserCtxtPtr;
22typedef xmlParserNodeInfo htmlParserNodeInfo;
23typedef xmlSAXHandler htmlSAXHandler;
24typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
25typedef xmlParserInput htmlParserInput;
26typedef xmlParserInputPtr htmlParserInputPtr;
27typedef xmlDocPtr htmlDocPtr;
28typedef xmlNodePtr htmlNodePtr;
29
Daniel Veillard5233ffc1999-07-06 22:25:25 +000030/*
31 * Internal description of an HTML element
32 */
33typedef struct htmlElemDesc {
Daniel Veillardb96e6431999-08-29 21:02:19 +000034 const char *name; /* The tag name */
Daniel Veillard5233ffc1999-07-06 22:25:25 +000035 int startTag; /* Whether the start tag can be implied */
36 int endTag; /* Whether the end tag can be implied */
37 int empty; /* Is this an empty element ? */
38 int depr; /* Is this a deprecated element ? */
39 int dtd; /* 1: only in Loose DTD, 2: only Frameset one */
40 const char *desc; /* the description */
41} htmlElemDesc, *htmlElemDescPtr;
42
43/*
44 * Internal description of an HTML entity
45 */
46typedef struct htmlEntityDesc {
47 int value; /* the UNICODE value for the character */
Daniel Veillardb96e6431999-08-29 21:02:19 +000048 const char *name; /* The entity name */
Daniel Veillard5233ffc1999-07-06 22:25:25 +000049 const char *desc; /* the description */
50} htmlEntityDesc, *htmlEntityDescPtr;
51
52/*
53 * There is only few public functions.
54 */
Daniel Veillard5cb5ab81999-12-21 15:35:29 +000055htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
56htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
Daniel Veillard82150d81999-07-07 07:32:15 +000057
Daniel Veillard5cb5ab81999-12-21 15:35:29 +000058int htmlIsAutoClosed(htmlDocPtr doc,
59 htmlNodePtr elem);
60int htmlAutoCloseTag(htmlDocPtr doc,
61 const xmlChar *name,
62 htmlNodePtr elem);
63htmlEntityDescPtr htmlParseEntityRef(htmlParserCtxtPtr ctxt,
64 xmlChar **str);
65int htmlParseCharRef(htmlParserCtxtPtr ctxt);
66void htmlParseElement(htmlParserCtxtPtr ctxt);
Daniel Veillardbe70ff71999-07-05 16:50:46 +000067
Daniel Veillard5cb5ab81999-12-21 15:35:29 +000068htmlDocPtr htmlSAXParseDoc (xmlChar *cur,
69 const char *encoding,
70 htmlSAXHandlerPtr sax,
71 void *userData);
72htmlDocPtr htmlParseDoc (xmlChar *cur,
73 const char *encoding);
74htmlDocPtr htmlSAXParseFile(const char *filename,
75 const char *encoding,
76 htmlSAXHandlerPtr sax,
77 void *userData);
78htmlDocPtr htmlParseFile (const char *filename,
79 const char *encoding);
Daniel Veillardbe70ff71999-07-05 16:50:46 +000080
Daniel Veillardf600e251999-12-18 15:32:46 +000081#ifdef __cplusplus
82}
83#endif
84
Daniel Veillardbe70ff71999-07-05 16:50:46 +000085#endif /* __HTML_PARSER_H__ */