Annotation of XML/HTMLparser.h, revision 1.10
1.1 daniel 1: /*
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__
1.8 daniel 11: #include <libxml/parser.h>
1.1 daniel 12:
1.4 daniel 13: #ifdef __cplusplus
1.5 daniel 14: extern "C" {
1.4 daniel 15: #endif
16:
1.1 daniel 17: /*
18: * Most of the back-end structures from XML and HTML are shared
19: */
20: typedef xmlParserCtxt htmlParserCtxt;
21: typedef xmlParserCtxtPtr htmlParserCtxtPtr;
22: typedef xmlParserNodeInfo htmlParserNodeInfo;
23: typedef xmlSAXHandler htmlSAXHandler;
24: typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
25: typedef xmlParserInput htmlParserInput;
26: typedef xmlParserInputPtr htmlParserInputPtr;
27: typedef xmlDocPtr htmlDocPtr;
28: typedef xmlNodePtr htmlNodePtr;
29:
30: /*
31: * Internal description of an HTML element
32: */
1.7 daniel 33: typedef struct _htmlElemDesc htmlElemDesc;
34: typedef htmlElemDesc *htmlElemDescPtr;
35: struct _htmlElemDesc {
1.2 daniel 36: const char *name; /* The tag name */
1.1 daniel 37: int startTag; /* Whether the start tag can be implied */
38: int endTag; /* Whether the end tag can be implied */
39: int empty; /* Is this an empty element ? */
40: int depr; /* Is this a deprecated element ? */
41: int dtd; /* 1: only in Loose DTD, 2: only Frameset one */
42: const char *desc; /* the description */
1.7 daniel 43: };
1.1 daniel 44:
45: /*
46: * Internal description of an HTML entity
47: */
1.7 daniel 48: typedef struct _htmlEntityDesc htmlEntityDesc;
49: typedef htmlEntityDesc *htmlEntityDescPtr;
50: struct _htmlEntityDesc {
1.1 daniel 51: int value; /* the UNICODE value for the character */
1.2 daniel 52: const char *name; /* The entity name */
1.1 daniel 53: const char *desc; /* the description */
1.7 daniel 54: };
1.1 daniel 55:
56: /*
57: * There is only few public functions.
58: */
1.5 daniel 59: htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
60: htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
1.10 ! veillard 61: htmlEntityDescPtr htmlEntityValueLookup(int value);
1.1 daniel 62:
1.5 daniel 63: int htmlIsAutoClosed(htmlDocPtr doc,
64: htmlNodePtr elem);
65: int htmlAutoCloseTag(htmlDocPtr doc,
66: const xmlChar *name,
67: htmlNodePtr elem);
68: htmlEntityDescPtr htmlParseEntityRef(htmlParserCtxtPtr ctxt,
69: xmlChar **str);
70: int htmlParseCharRef(htmlParserCtxtPtr ctxt);
71: void htmlParseElement(htmlParserCtxtPtr ctxt);
72:
73: htmlDocPtr htmlSAXParseDoc (xmlChar *cur,
74: const char *encoding,
75: htmlSAXHandlerPtr sax,
76: void *userData);
77: htmlDocPtr htmlParseDoc (xmlChar *cur,
78: const char *encoding);
79: htmlDocPtr htmlSAXParseFile(const char *filename,
80: const char *encoding,
81: htmlSAXHandlerPtr sax,
82: void *userData);
83: htmlDocPtr htmlParseFile (const char *filename,
84: const char *encoding);
1.9 veillard 85: int UTF8ToHtml (unsigned char* out,
86: int *outlen,
87: const unsigned char* in,
88: int *inlen);
1.4 daniel 89:
1.6 daniel 90: /**
91: * Interfaces for the Push mode
92: */
93: void htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
94: htmlParserCtxtPtr htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
95: void *user_data,
96: const char *chunk,
97: int size,
98: const char *filename,
99: xmlCharEncoding enc);
100: int htmlParseChunk (htmlParserCtxtPtr ctxt,
101: const char *chunk,
102: int size,
103: int terminate);
1.4 daniel 104: #ifdef __cplusplus
105: }
106: #endif
1.1 daniel 107:
108: #endif /* __HTML_PARSER_H__ */
Webmaster