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

doc: Improve documentation

This commit is contained in:
Nick Wellnhofer 2024-07-02 02:18:03 +02:00
parent 0b0dd98983
commit 9a4770ef84
2 changed files with 79 additions and 20 deletions

View File

@ -331,6 +331,9 @@ xmlDetectCharEncoding(const unsigned char* in, int len)
/**
* xmlCleanupEncodingAliases:
*
* DEPRECATED: This function modifies global state and is not
* thread-safe.
*
* Unregisters all aliases
*/
void
@ -356,6 +359,8 @@ xmlCleanupEncodingAliases(void) {
* xmlGetEncodingAlias:
* @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
*
* DEPRECATED: This function is not thread-safe.
*
* Lookup an encoding name for the given alias.
*
* Returns NULL if not found, otherwise the original name
@ -393,6 +398,9 @@ xmlGetEncodingAlias(const char *alias) {
* @name: the encoding name as parsed, in UTF-8 format (ASCII actually)
* @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
*
* DEPRECATED: This function modifies global state and is not
* thread-safe.
*
* Registers an alias @alias for an encoding named @name. Existing alias
* will be overwritten.
*
@ -465,6 +473,9 @@ xmlAddEncodingAlias(const char *name, const char *alias) {
* xmlDelEncodingAlias:
* @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
*
* DEPRECATED: This function modifies global state and is not
* thread-safe.
*
* Unregisters an encoding alias @alias
*
* Returns 0 in case of success, -1 in case of error
@ -558,7 +569,6 @@ xmlGetCharEncodingName(xmlCharEncoding enc) {
if ((enc <= 0) || ((size_t) enc >= NUM_DEFAULT_HANDLERS))
return(NULL);
return(defaultHandlers[enc].name);
}
@ -574,6 +584,9 @@ xmlGetCharEncodingName(xmlCharEncoding enc) {
* @input: the xmlCharEncodingInputFunc to read that encoding
* @output: the xmlCharEncodingOutputFunc to write that encoding
*
* DEPRECATED: This function modifies global state and is not
* thread-safe.
*
* Create and registers an xmlCharEncodingHandler.
*
* Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
@ -701,7 +714,10 @@ xmlCleanupCharEncodingHandlers(void) {
* xmlRegisterCharEncodingHandler:
* @handler: the xmlCharEncodingHandlerPtr handler block
*
* Register the char encoding handler, surprising, isn't it ?
* DEPRECATED: This function modifies global state and is not
* thread-safe.
*
* Register the char encoding handler.
*/
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
@ -850,15 +866,23 @@ done:
* @enc: an xmlCharEncoding value.
* @out: pointer to result
*
* Find or create a handler matching the encoding. If no default or
* registered handler could be found, try to create a handler using
* iconv or ICU if supported.
* Find or create a handler matching the encoding. The following
* converters are looked up in order:
*
* - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII)
* - User-registered global handler (deprecated)
* - iconv if enabled
* - ICU if enabled
*
* The handler must be closed with xmlCharEncCloseFunc.
*
* If the encoding is UTF-8, a NULL handler and no error code will
* be returned.
*
* Available since 2.13.0.
*
* Returns an xmlParserErrors error code.
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlLookupCharEncodingHandler(xmlCharEncoding enc,
@ -916,18 +940,24 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
* @implCtxt: user data for conversion implementation (optional)
* @out: pointer to result
*
* Find or create a handler matching the encoding. If no default or
* registered handler could be found, try to create a handler using
* iconv or ICU if supported.
* Find or create a handler matching the encoding. The following
* converters are looked up in order:
*
* - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII)
* - Custom implementation if provided
* - User-registered global handler (deprecated)
* - iconv if enabled
* - ICU if enabled
*
* The handler must be closed with xmlCharEncCloseFunc.
*
* If the encoding is UTF-8, a NULL handler and no error code will
* be returned.
*
* Available since 2.13.0.
* Available since 2.14.0.
*
* Returns an xmlParserErrors error code.
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlCreateCharEncodingHandler(const char *name, int output,
@ -972,9 +1002,13 @@ xmlCreateCharEncodingHandler(const char *name, int output,
* @output: boolean, use handler for output
* @out: pointer to result
*
* Find or create a handler matching the encoding. If no default or
* registered handler could be found, try to create a handler using
* iconv or ICU if supported.
* Find or create a handler matching the encoding. The following
* converters are looked up in order:
*
* - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII)
* - User-registered global handler (deprecated)
* - iconv if enabled
* - ICU if enabled
*
* The handler must be closed with xmlCharEncCloseFunc.
*
@ -983,7 +1017,8 @@ xmlCreateCharEncodingHandler(const char *name, int output,
*
* Available since 2.13.0.
*
* Returns an xmlParserErrors error code.
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlOpenCharEncodingHandler(const char *name, int output,
@ -998,6 +1033,9 @@ xmlOpenCharEncodingHandler(const char *name, int output,
* DEPRECATED: Use xmlOpenCharEncodingHandler which has better error
* reporting.
*
* If the encoding is UTF-8, this will return a no-op handler that
* shouldn't be used.
*
* Returns the handler or NULL if no handler was found or an error
* occurred.
*/

View File

@ -1659,6 +1659,8 @@ xmlFreeInputStream(xmlParserInputPtr input) {
* xmlNewInputStream:
* @ctxt: an XML parser context
*
* DEPRECATED: Use xmlInputCreateUrl or similar functions.
*
* Create a new input stream structure.
*
* Returns the new input stream or NULL
@ -2143,6 +2145,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr ent) {
* @ctxt: an XML parser context
* @buffer: an memory buffer
*
* DEPRECATED: Use xmlInputCreateString.
*
* Create a new input stream based on a memory buffer.
*
* Returns the new input stream
@ -2333,6 +2337,18 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
*
* The flag XML_INPUT_NETWORK allows network access.
*
* The following resource loaders will be called if they were
* registered (in order of precedence):
*
* - the per-thread xmlParserInputBufferCreateFilenameFunc set with
* xmlParserInputBufferCreateFilenameDefault (deprecated)
* - the default loader which will return
* - the result from a matching global input callback set with
* xmlRegisterInputCallbacks (deprecated)
* - a HTTP resource if support is compiled in.
* - a file opened from the filesystem, with automatic detection
* of compressed files if support is compiled in.
*
* Available since 2.14.0.
*
* Returns an xmlParserErrors code.
@ -2382,6 +2398,8 @@ xmlInputCreateUrl(const char *filename, int flags, xmlParserInputPtr *out) {
* @ctxt: an XML parser context
* @filename: the filename to use as entity
*
* DEPRECATED: Use xmlInputCreateUrl.
*
* Create a new input stream based on a file or an URL.
*
* Returns the new input stream or NULL in case of error
@ -2607,17 +2625,20 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
* @ID is an optional XML public ID, typically from a doctype
* declaration. It is used for catalog lookups.
*
* The following resource loaders will be called if they were
* registered (in order of precedence):
* If catalog lookup is enabled (default is yes) and URL or ID are
* found in system or local XML catalogs, URL is replaced with the
* result. Then the following resource loaders will be called if
* they were registered (in order of precedence):
*
* - the resource loader set with xmlCtxtSetResourceLoader
* - the global external entity loader set with
* xmlSetExternalEntityLoader
* xmlSetExternalEntityLoader (without catalog resolution,
* deprecated)
* - the per-thread xmlParserInputBufferCreateFilenameFunc set with
* xmlParserInputBufferCreateFilenameDefault
* xmlParserInputBufferCreateFilenameDefault (deprecated)
* - the default loader which will return
* - the result from a matching global input callback set with
* xmlRegisterInputCallbacks
* xmlRegisterInputCallbacks (deprecated)
* - a HTTP resource if support is compiled in.
* - a file opened from the filesystem, with automatic detection
* of compressed files if support is compiled in.