diff --git a/doc/devhelp/libxml2-HTMLparser.html b/doc/devhelp/libxml2-HTMLparser.html index 60a3e23f..778753c6 100644 --- a/doc/devhelp/libxml2-HTMLparser.html +++ b/doc/devhelp/libxml2-HTMLparser.html @@ -42,6 +42,7 @@ typedef enum htmlStatus; int UTF8ToHtml (unsigned char * out,
int * outlen,
const unsigned char * in,
int * inlen); htmlStatus htmlAttrAllowed (const htmlElemDesc * elt,
const xmlChar * attr,
int legacy); int htmlAutoCloseTag (htmlDocPtr doc,
const xmlChar * name,
htmlNodePtr elem); +htmlParserCtxtPtr htmlCreateFileParserCtxt (const char * filename,
const char * encoding); htmlParserCtxtPtr htmlCreateMemoryParserCtxt (const char * buffer,
int size); htmlParserCtxtPtr htmlCreatePushParserCtxt (htmlSAXHandlerPtr sax,
void * user_data,
const char * chunk,
int size,
const char * filename,
xmlCharEncoding enc); htmlDocPtr htmlCtxtReadDoc (htmlParserCtxtPtr ctxt,
const xmlChar * cur,
const char * URL,
const char * encoding,
int options); @@ -58,6 +59,7 @@ const htmlEntityDesc * htmlEntityDesc * htmlEntityValueLookup (unsigned int value); void htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); int htmlHandleOmittedElem (int val); +void htmlInitAutoClose (void); int htmlIsAutoClosed (htmlDocPtr doc,
htmlNodePtr elem); int htmlIsScriptAttribute (const xmlChar * name); htmlParserCtxtPtr htmlNewParserCtxt (void); @@ -386,6 +388,31 @@ const htmlElemDesc *

+htmlCreateFileParserCtxt ()

+
htmlParserCtxtPtr	htmlCreateFileParserCtxt	(const char * filename, 
const char * encoding)
+
+

Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

+
++ + + + + + + + + + + + + + +
filename:the filename
encoding:a free form C string describing the HTML document encoding, or NULL
Returns:the new parser context or NULL
+
+
+
+

htmlCreateMemoryParserCtxt ()

htmlParserCtxtPtr	htmlCreateMemoryParserCtxt	(const char * buffer, 
int size)
@@ -851,6 +878,14 @@ const htmlElemDesc *

+htmlInitAutoClose ()

+
void	htmlInitAutoClose		(void)
+
+

DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library. This is a no-op now.

+
+
+
+

htmlIsAutoClosed ()

int	htmlIsAutoClosed		(htmlDocPtr doc, 
htmlNodePtr elem)
diff --git a/doc/devhelp/libxml2-parserInternals.html b/doc/devhelp/libxml2-parserInternals.html index 2e990df5..b119aa46 100644 --- a/doc/devhelp/libxml2-parserInternals.html +++ b/doc/devhelp/libxml2-parserInternals.html @@ -54,8 +54,6 @@ #define XML_SUBSTITUTE_NONE; #define XML_SUBSTITUTE_PEREF; #define XML_SUBSTITUTE_REF; -htmlParserCtxtPtr htmlCreateFileParserCtxt (const char * filename,
const char * encoding); -void htmlInitAutoClose (void); xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value); const xmlChar * namePop (xmlParserCtxtPtr ctxt); @@ -620,39 +618,6 @@ int xmlSwitchToEncoding (

-htmlCreateFileParserCtxt ()

-
htmlParserCtxtPtr	htmlCreateFileParserCtxt	(const char * filename, 
const char * encoding)
-
-

Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

-
-- - - - - - - - - - - - - - -
filename:the filename
encoding:a free form C string describing the HTML document encoding, or NULL
Returns:the new parser context or NULL
-
-
-
-

-htmlInitAutoClose ()

-
void	htmlInitAutoClose		(void)
-
-

DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library. This is a no-op now.

-
-
-
-

inputPop ()

xmlParserInputPtr	inputPop	(xmlParserCtxtPtr ctxt)
diff --git a/doc/devhelp/libxml2.devhelp2 b/doc/devhelp/libxml2.devhelp2 index 515d0654..3f6459e9 100644 --- a/doc/devhelp/libxml2.devhelp2 +++ b/doc/devhelp/libxml2.devhelp2 @@ -1966,7 +1966,7 @@ - + @@ -1990,7 +1990,7 @@ - + diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 22a5184c..2813950b 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -43,6 +43,7 @@ + @@ -59,6 +60,7 @@ + @@ -898,8 +900,6 @@ - - @@ -7397,7 +7397,7 @@ Could we use @subtypes for this?'/> - + defined(LIBXML_HTML_ENABLED) Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. @@ -7587,7 +7587,7 @@ Could we use @subtypes for this?'/> - + defined(LIBXML_HTML_ENABLED) DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library. This is a no-op now. diff --git a/doc/symbols.xml b/doc/symbols.xml index 4a311fda..2266c100 100644 --- a/doc/symbols.xml +++ b/doc/symbols.xml @@ -94,8 +94,8 @@ startElement unparsedEntityDecl xmlDefaultSAXHandlerInit - htmlCreateFileParserCtxt - htmlInitAutoClose + htmlCreateFileParserCtxt + htmlInitAutoClose inputPop inputPush namePop diff --git a/include/libxml/HTMLparser.h b/include/libxml/HTMLparser.h index 29316abf..93d7fb4a 100644 --- a/include/libxml/HTMLparser.h +++ b/include/libxml/HTMLparser.h @@ -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, diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 656ee462..dcf12685 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -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. diff --git a/libxml2.syms b/libxml2.syms index 7da59a19..9c41d141 100644 --- a/libxml2.syms +++ b/libxml2.syms @@ -119,9 +119,11 @@ LIBXML2_2.4.30 { # SAX2 xmlDefaultSAXHandlerInit; -# parserInternals +# HTMLparser htmlCreateFileParserCtxt; htmlInitAutoClose; + +# parserInternals inputPop; inputPush; namePop; diff --git a/parser.c b/parser.c index 73ff5bc1..ae1c196b 100644 --- a/parser.c +++ b/parser.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include diff --git a/testapi.c b/testapi.c index e4c25c9d..df186c01 100644 --- a/testapi.c +++ b/testapi.c @@ -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(); diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index d28fd50d..96735a91 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -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