1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

Move some HTML functions to correct header file

This commit is contained in:
Nick Wellnhofer
2022-08-24 16:35:58 +02:00
parent ca3807d946
commit 34a050cdee
11 changed files with 127 additions and 124 deletions

View File

@@ -42,6 +42,7 @@ typedef enum <a href="#htmlStatus">htmlStatus</a>;
int <a href="#UTF8ToHtml">UTF8ToHtml</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
<a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> <a href="#htmlAttrAllowed">htmlAttrAllowed</a> (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * attr, <br> int legacy);
int <a href="#htmlAutoCloseTag">htmlAutoCloseTag</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreateFileParserCtxt">htmlCreateFileParserCtxt</a> (const char * filename, <br> const char * encoding);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreateMemoryParserCtxt">htmlCreateMemoryParserCtxt</a> (const char * buffer, <br> int size);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreatePushParserCtxt">htmlCreatePushParserCtxt</a> (<a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * user_data, <br> const char * chunk, <br> int size, <br> const char * filename, <br> <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadDoc">htmlCtxtReadDoc</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br> const char * URL, <br> const char * encoding, <br> int options);
@@ -58,6 +59,7 @@ const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a h
const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a href="#htmlEntityValueLookup">htmlEntityValueLookup</a> (unsigned int value);
void <a href="#htmlFreeParserCtxt">htmlFreeParserCtxt</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
int <a href="#htmlHandleOmittedElem">htmlHandleOmittedElem</a> (int val);
void <a href="#htmlInitAutoClose">htmlInitAutoClose</a> (void);
int <a href="#htmlIsAutoClosed">htmlIsAutoClosed</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
int <a href="#htmlIsScriptAttribute">htmlIsScriptAttribute</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlNewParserCtxt">htmlNewParserCtxt</a> (void);
@@ -386,6 +388,31 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * <a href=
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreateFileParserCtxt"></a>htmlCreateFileParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreateFileParserCtxt (const char * filename, <br> const char * encoding)<br>
</pre>
<p>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the filename</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>a free form C string describing the HTML document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the new parser context or NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreateMemoryParserCtxt"></a>htmlCreateMemoryParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreateMemoryParserCtxt (const char * buffer, <br> int size)<br>
</pre>
@@ -851,6 +878,14 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * <a href=
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlInitAutoClose"></a>htmlInitAutoClose ()</h3>
<pre class="programlisting">void htmlInitAutoClose (void)<br>
</pre>
<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. This is a no-op now.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlIsAutoClosed"></a>htmlIsAutoClosed ()</h3>
<pre class="programlisting">int htmlIsAutoClosed (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem)<br>
</pre>

View File

@@ -54,8 +54,6 @@
#define <a href="#XML_SUBSTITUTE_NONE">XML_SUBSTITUTE_NONE</a>;
#define <a href="#XML_SUBSTITUTE_PEREF">XML_SUBSTITUTE_PEREF</a>;
#define <a href="#XML_SUBSTITUTE_REF">XML_SUBSTITUTE_REF</a>;
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreateFileParserCtxt">htmlCreateFileParserCtxt</a> (const char * filename, <br> const char * encoding);
void <a href="#htmlInitAutoClose">htmlInitAutoClose</a> (void);
<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> <a href="#inputPop">inputPop</a> (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt);
int <a href="#inputPush">inputPush</a> (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br> <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> value);
const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#namePop">namePop</a> (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt);
@@ -620,39 +618,6 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a> (<a href="libxml2-tr
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreateFileParserCtxt"></a>htmlCreateFileParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreateFileParserCtxt (const char * filename, <br> const char * encoding)<br>
</pre>
<p>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the filename</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>a free form C string describing the HTML document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the new parser context or NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlInitAutoClose"></a>htmlInitAutoClose ()</h3>
<pre class="programlisting">void htmlInitAutoClose (void)<br>
</pre>
<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. This is a no-op now.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="inputPop"></a>inputPop ()</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> inputPop (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
</pre>

View File

@@ -1966,7 +1966,7 @@
<keyword type="function" name="hasInternalSubset ()" link="libxml2-SAX.html#hasInternalSubset"/>
<keyword type="function" name="htmlAttrAllowed ()" link="libxml2-HTMLparser.html#htmlAttrAllowed"/>
<keyword type="function" name="htmlAutoCloseTag ()" link="libxml2-HTMLparser.html#htmlAutoCloseTag"/>
<keyword type="function" name="htmlCreateFileParserCtxt ()" link="libxml2-parserInternals.html#htmlCreateFileParserCtxt"/>
<keyword type="function" name="htmlCreateFileParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreateFileParserCtxt"/>
<keyword type="function" name="htmlCreateMemoryParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreateMemoryParserCtxt"/>
<keyword type="function" name="htmlCreatePushParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreatePushParserCtxt"/>
<keyword type="function" name="htmlCtxtReadDoc ()" link="libxml2-HTMLparser.html#htmlCtxtReadDoc"/>
@@ -1990,7 +1990,7 @@
<keyword type="function" name="htmlFreeParserCtxt ()" link="libxml2-HTMLparser.html#htmlFreeParserCtxt"/>
<keyword type="function" name="htmlGetMetaEncoding ()" link="libxml2-HTMLtree.html#htmlGetMetaEncoding"/>
<keyword type="function" name="htmlHandleOmittedElem ()" link="libxml2-HTMLparser.html#htmlHandleOmittedElem"/>
<keyword type="function" name="htmlInitAutoClose ()" link="libxml2-parserInternals.html#htmlInitAutoClose"/>
<keyword type="function" name="htmlInitAutoClose ()" link="libxml2-HTMLparser.html#htmlInitAutoClose"/>
<keyword type="function" name="htmlIsAutoClosed ()" link="libxml2-HTMLparser.html#htmlIsAutoClosed"/>
<keyword type="function" name="htmlIsBooleanAttr ()" link="libxml2-HTMLtree.html#htmlIsBooleanAttr"/>
<keyword type="function" name="htmlIsScriptAttribute ()" link="libxml2-HTMLparser.html#htmlIsScriptAttribute"/>

View File

@@ -43,6 +43,7 @@
<exports symbol='UTF8ToHtml' type='function'/>
<exports symbol='htmlAttrAllowed' type='function'/>
<exports symbol='htmlAutoCloseTag' type='function'/>
<exports symbol='htmlCreateFileParserCtxt' type='function'/>
<exports symbol='htmlCreateMemoryParserCtxt' type='function'/>
<exports symbol='htmlCreatePushParserCtxt' type='function'/>
<exports symbol='htmlCtxtReadDoc' type='function'/>
@@ -59,6 +60,7 @@
<exports symbol='htmlEntityValueLookup' type='function'/>
<exports symbol='htmlFreeParserCtxt' type='function'/>
<exports symbol='htmlHandleOmittedElem' type='function'/>
<exports symbol='htmlInitAutoClose' type='function'/>
<exports symbol='htmlIsAutoClosed' type='function'/>
<exports symbol='htmlIsScriptAttribute' type='function'/>
<exports symbol='htmlNewParserCtxt' type='function'/>
@@ -898,8 +900,6 @@
<exports symbol='xmlStringComment' type='variable'/>
<exports symbol='xmlStringText' type='variable'/>
<exports symbol='xmlStringTextNoenc' type='variable'/>
<exports symbol='htmlCreateFileParserCtxt' type='function'/>
<exports symbol='htmlInitAutoClose' type='function'/>
<exports symbol='inputPop' type='function'/>
<exports symbol='inputPush' type='function'/>
<exports symbol='namePop' type='function'/>
@@ -7397,7 +7397,7 @@ Could we use @subtypes for this?'/>
<arg name='name' type='const xmlChar *' info='The tag name'/>
<arg name='elem' type='htmlNodePtr' info='the HTML element'/>
</function>
<function name='htmlCreateFileParserCtxt' file='parserInternals' module='HTMLparser'>
<function name='htmlCreateFileParserCtxt' file='HTMLparser' module='HTMLparser'>
<cond>defined(LIBXML_HTML_ENABLED)</cond>
<info>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</info>
<return type='htmlParserCtxtPtr' info='the new parser context or NULL'/>
@@ -7587,7 +7587,7 @@ Could we use @subtypes for this?'/>
<return type='int' info='the last value for 0 for no handling, 1 for auto insertion.'/>
<arg name='val' type='int' info='int 0 or 1'/>
</function>
<function name='htmlInitAutoClose' file='parserInternals' module='HTMLparser'>
<function name='htmlInitAutoClose' file='HTMLparser' module='HTMLparser'>
<cond>defined(LIBXML_HTML_ENABLED)</cond>
<info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library. This is a no-op now.</info>
<return type='void'/>

View File

@@ -94,8 +94,8 @@
<symbol file="SAX">startElement</symbol>
<symbol file="SAX">unparsedEntityDecl</symbol>
<symbol file="SAX2">xmlDefaultSAXHandlerInit</symbol>
<symbol file="parserInternals">htmlCreateFileParserCtxt</symbol>
<symbol file="parserInternals">htmlInitAutoClose</symbol>
<symbol file="HTMLparser">htmlCreateFileParserCtxt</symbol>
<symbol file="HTMLparser">htmlInitAutoClose</symbol>
<symbol file="parserInternals">inputPop</symbol>
<symbol file="parserInternals">inputPush</symbol>
<symbol file="parserInternals">namePop</symbol>

View File

@@ -83,6 +83,9 @@ struct _htmlEntityDesc {
/*
* There is only few public functions.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
htmlInitAutoClose (void);
XMLPUBFUN const htmlElemDesc * XMLCALL
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
@@ -125,6 +128,9 @@ XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
const char *encoding,

View File

@@ -571,16 +571,6 @@ XMLPUBFUN int XMLCALL xmlCopyChar (int len,
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
#endif
/*
* Specific function to keep track of entities references
* and used by the XSLT debugger.

View File

@@ -119,9 +119,11 @@ LIBXML2_2.4.30 {
# SAX2
xmlDefaultSAXHandlerInit;
# parserInternals
# HTMLparser
htmlCreateFileParserCtxt;
htmlInitAutoClose;
# parserInternals
inputPop;
inputPush;
namePop;

View File

@@ -57,6 +57,7 @@
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/HTMLparser.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>

140
testapi.c
View File

@@ -1457,6 +1457,47 @@ test_htmlAutoCloseTag(void) {
}
static int
test_htmlCreateFileParserCtxt(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
htmlParserCtxtPtr ret_val;
const char * filename; /* the filename */
int n_filename;
char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
int n_encoding;
for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
mem_base = xmlMemBlocks();
filename = gen_fileoutput(n_filename, 0);
encoding = gen_const_char_ptr(n_encoding, 1);
ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
desret_htmlParserCtxtPtr(ret_val);
call_tests++;
des_fileoutput(n_filename, filename, 0);
des_const_char_ptr(n_encoding, (const char *)encoding, 1);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_filename);
printf(" %d", n_encoding);
printf("\n");
}
}
}
function_tests++;
#endif
return(test_ret);
}
static int
test_htmlCreateMemoryParserCtxt(void) {
int test_ret = 0;
@@ -2076,6 +2117,31 @@ test_htmlHandleOmittedElem(void) {
}
static int
test_htmlInitAutoClose(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
mem_base = xmlMemBlocks();
htmlInitAutoClose();
call_tests++;
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in htmlInitAutoClose",
xmlMemBlocks() - mem_base);
test_ret++;
printf("\n");
}
function_tests++;
#endif
return(test_ret);
}
static int
test_htmlIsAutoClosed(void) {
int test_ret = 0;
@@ -2824,10 +2890,11 @@ static int
test_HTMLparser(void) {
int test_ret = 0;
if (quiet == 0) printf("Testing HTMLparser : 33 of 39 functions ...\n");
if (quiet == 0) printf("Testing HTMLparser : 35 of 41 functions ...\n");
test_ret += test_UTF8ToHtml();
test_ret += test_htmlAttrAllowed();
test_ret += test_htmlAutoCloseTag();
test_ret += test_htmlCreateFileParserCtxt();
test_ret += test_htmlCreateMemoryParserCtxt();
test_ret += test_htmlCreatePushParserCtxt();
test_ret += test_htmlCtxtReadDoc();
@@ -2841,6 +2908,7 @@ test_HTMLparser(void) {
test_ret += test_htmlEntityLookup();
test_ret += test_htmlEntityValueLookup();
test_ret += test_htmlHandleOmittedElem();
test_ret += test_htmlInitAutoClose();
test_ret += test_htmlIsAutoClosed();
test_ret += test_htmlIsScriptAttribute();
test_ret += test_htmlNewParserCtxt();
@@ -14733,72 +14801,6 @@ test_parser(void) {
return(test_ret);
}
static int
test_htmlCreateFileParserCtxt(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
htmlParserCtxtPtr ret_val;
const char * filename; /* the filename */
int n_filename;
char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
int n_encoding;
for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
mem_base = xmlMemBlocks();
filename = gen_fileoutput(n_filename, 0);
encoding = gen_const_char_ptr(n_encoding, 1);
ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
desret_htmlParserCtxtPtr(ret_val);
call_tests++;
des_fileoutput(n_filename, filename, 0);
des_const_char_ptr(n_encoding, (const char *)encoding, 1);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_filename);
printf(" %d", n_encoding);
printf("\n");
}
}
}
function_tests++;
#endif
return(test_ret);
}
static int
test_htmlInitAutoClose(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
mem_base = xmlMemBlocks();
htmlInitAutoClose();
call_tests++;
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in htmlInitAutoClose",
xmlMemBlocks() - mem_base);
test_ret++;
printf("\n");
}
function_tests++;
#endif
return(test_ret);
}
static int
test_inputPop(void) {
int test_ret = 0;
@@ -16049,9 +16051,7 @@ static int
test_parserInternals(void) {
int test_ret = 0;
if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
test_ret += test_htmlCreateFileParserCtxt();
test_ret += test_htmlInitAutoClose();
if (quiet == 0) printf("Testing parserInternals : 31 of 88 functions ...\n");
test_ret += test_inputPop();
test_ret += test_inputPush();
test_ret += test_namePop();

View File

@@ -204,8 +204,10 @@ htmlAttrAllowed
htmlAutoCloseTag
#endif
#ifdef LIBXML_HTML_ENABLED
#ifdef LIBXML_HTML_ENABLED
htmlCreateFileParserCtxt
#endif
#endif
#ifdef LIBXML_HTML_ENABLED
htmlCreateMemoryParserCtxt
#endif
@@ -276,8 +278,10 @@ htmlGetMetaEncoding
htmlHandleOmittedElem
#endif
#ifdef LIBXML_HTML_ENABLED
#ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose
#endif
#endif
#ifdef LIBXML_HTML_ENABLED
htmlIsAutoClosed
#endif