1 /* libxml2 - Library for parsing XML documents
2  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3  *
4  * This file is not part of the GNU gettext program, but is used with
5  * GNU gettext.
6  *
7  * The original copyright notice is as follows:
8  */
9 
10 /*
11  * Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is fur-
18  * nished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25  * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29  * THE SOFTWARE.
30  *
31  * Author: Daniel Veillard
32  */
33 
34 /*
35  * Summary: specific APIs to process HTML tree, especially serialization
36  * Description: this module implements a few function needed to process
37  *              tree in an HTML specific way.
38  */
39 
40 #ifndef __HTML_TREE_H__
41 #define __HTML_TREE_H__
42 
43 #include <stdio.h>
44 #include <libxml/xmlversion.h>
45 #include <libxml/tree.h>
46 #include <libxml/HTMLparser.h>
47 
48 #ifdef LIBXML_HTML_ENABLED
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 
55 /**
56  * HTML_TEXT_NODE:
57  *
58  * Macro. A text node in a HTML document is really implemented
59  * the same way as a text node in an XML document.
60  */
61 #define HTML_TEXT_NODE		XML_TEXT_NODE
62 /**
63  * HTML_ENTITY_REF_NODE:
64  *
65  * Macro. An entity reference in a HTML document is really implemented
66  * the same way as an entity reference in an XML document.
67  */
68 #define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
69 /**
70  * HTML_COMMENT_NODE:
71  *
72  * Macro. A comment in a HTML document is really implemented
73  * the same way as a comment in an XML document.
74  */
75 #define HTML_COMMENT_NODE	XML_COMMENT_NODE
76 /**
77  * HTML_PRESERVE_NODE:
78  *
79  * Macro. A preserved node in a HTML document is really implemented
80  * the same way as a CDATA section in an XML document.
81  */
82 #define HTML_PRESERVE_NODE	XML_CDATA_SECTION_NODE
83 /**
84  * HTML_PI_NODE:
85  *
86  * Macro. A processing instruction in a HTML document is really implemented
87  * the same way as a processing instruction in an XML document.
88  */
89 #define HTML_PI_NODE		XML_PI_NODE
90 
91 XMLPUBFUN htmlDocPtr XMLCALL
92 		htmlNewDoc		(const xmlChar *URI,
93 					 const xmlChar *ExternalID);
94 XMLPUBFUN htmlDocPtr XMLCALL
95 		htmlNewDocNoDtD		(const xmlChar *URI,
96 					 const xmlChar *ExternalID);
97 XMLPUBFUN const xmlChar * XMLCALL
98 		htmlGetMetaEncoding	(htmlDocPtr doc);
99 XMLPUBFUN int XMLCALL
100 		htmlSetMetaEncoding	(htmlDocPtr doc,
101 					 const xmlChar *encoding);
102 #ifdef LIBXML_OUTPUT_ENABLED
103 XMLPUBFUN void XMLCALL
104 		htmlDocDumpMemory	(xmlDocPtr cur,
105 					 xmlChar **mem,
106 					 int *size);
107 XMLPUBFUN void XMLCALL
108 		htmlDocDumpMemoryFormat	(xmlDocPtr cur,
109 					 xmlChar **mem,
110 					 int *size,
111 					 int format);
112 XMLPUBFUN int XMLCALL
113 		htmlDocDump		(FILE *f,
114 					 xmlDocPtr cur);
115 XMLPUBFUN int XMLCALL
116 		htmlSaveFile		(const char *filename,
117 					 xmlDocPtr cur);
118 XMLPUBFUN int XMLCALL
119 		htmlNodeDump		(xmlBufferPtr buf,
120 					 xmlDocPtr doc,
121 					 xmlNodePtr cur);
122 XMLPUBFUN void XMLCALL
123 		htmlNodeDumpFile	(FILE *out,
124 					 xmlDocPtr doc,
125 					 xmlNodePtr cur);
126 XMLPUBFUN int XMLCALL
127 		htmlNodeDumpFileFormat	(FILE *out,
128 					 xmlDocPtr doc,
129 					 xmlNodePtr cur,
130 					 const char *encoding,
131 					 int format);
132 XMLPUBFUN int XMLCALL
133 		htmlSaveFileEnc		(const char *filename,
134 					 xmlDocPtr cur,
135 					 const char *encoding);
136 XMLPUBFUN int XMLCALL
137 		htmlSaveFileFormat	(const char *filename,
138 					 xmlDocPtr cur,
139 					 const char *encoding,
140 					 int format);
141 
142 XMLPUBFUN void XMLCALL
143 		htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
144 					 xmlDocPtr doc,
145 					 xmlNodePtr cur,
146 					 const char *encoding,
147 					 int format);
148 XMLPUBFUN void XMLCALL
149 		htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
150 					 xmlDocPtr cur,
151 					 const char *encoding);
152 XMLPUBFUN void XMLCALL
153 		htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
154 					 xmlDocPtr cur,
155 					 const char *encoding,
156 					 int format);
157 XMLPUBFUN void XMLCALL
158 		htmlNodeDumpOutput	(xmlOutputBufferPtr buf,
159 					 xmlDocPtr doc,
160 					 xmlNodePtr cur,
161 					 const char *encoding);
162 
163 #endif /* LIBXML_OUTPUT_ENABLED */
164 
165 XMLPUBFUN int XMLCALL
166 		htmlIsBooleanAttr	(const xmlChar *name);
167 
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* LIBXML_HTML_ENABLED */
174 
175 #endif /* __HTML_TREE_H__ */
176 
177