Eneboo - Documentación para desarrolladores
Clases | 'defines' | 'typedefs' | Funciones
Referencia del Archivo src/libdigidoc/libxml2/encoding.c
#include "libxml.h"
#include <string.h>
#include <libxml/encoding.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include "elfgcchack.h"

Clases

struct  _xmlCharEncodingAlias

'defines'

#define IN_LIBXML

'typedefs'

typedef struct
_xmlCharEncodingAlias 
xmlCharEncodingAlias
typedef xmlCharEncodingAliasxmlCharEncodingAliasPtr

Funciones

int isolat1ToUTF8 (unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
xmlCharEncoding xmlDetectCharEncoding (const unsigned char *in, int len)
void xmlCleanupEncodingAliases (void)
const char * xmlGetEncodingAlias (const char *alias)
. Existing alias

will be overwritten.

Returns 0 in case of success, -1 in case of error

int xmlAddEncodingAlias (const char *name, const char *alias)
int xmlDelEncodingAlias (const char *alias)
: the encoding name, in UTF-8 format (ASCII actually)

xmlNewCharEncodingHandler:

: the xmlCharEncodingInputFunc to read that encoding : the xmlCharEncodingOutputFunc to write that encoding

Create and registers an xmlCharEncodingHandler.

Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).

xmlCharEncodingHandlerPtr xmlNewCharEncodingHandler (const char *name, xmlCharEncodingInputFunc input, xmlCharEncodingOutputFunc output)
void xmlInitCharEncodingHandlers (void)
void xmlCleanupCharEncodingHandlers (void)
void xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler)
xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler (xmlCharEncoding enc)

: the encoding name as parsed, in UTF-8 format (ASCII actually)

xmlParseCharEncoding:

Compare the string to the encoding schemes already known. Note that the comparison is case insensitive accordingly to the section [XML] 4.3.3 Character Encoding in Entities.

Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE if not recognized.

#define MAX_ENCODING_HANDLERS   50
xmlCharEncoding xmlParseCharEncoding (const char *name)
const char * xmlGetCharEncodingName (xmlCharEncoding enc)

: a string describing the char encoding.

xmlFindCharEncodingHandler:

Search in the registered set the handler able to read/write that encoding.

Returns the handler or NULL if not found

#define bottom_encoding
xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler (const char *name)
int xmlCharEncFirstLineInt (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in, int len)
int xmlCharEncFirstLine (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
int xmlCharEncInFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
int xmlCharEncOutFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler)
long xmlByteConsumed (xmlParserCtxtPtr ctxt)

Documentación de los 'defines'

#define bottom_encoding
#define IN_LIBXML
#define MAX_ENCODING_HANDLERS   50

Documentación de los 'typedefs'


Documentación de las funciones

int isolat1ToUTF8 ( unsigned char *  out,
int outlen,
const unsigned char *  in,
int inlen 
)

isolat1ToUTF8: : a pointer to an array of bytes to store the result : the length of : a pointer to an array of ISO Latin 1 chars : the length of

Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 block of chars out. Returns the number of bytes written if success, or -1 otherwise The value of after return is the number of octets consumed if the return value is positive, else unpredictable. The value of after return is the number of octets consumed.

int xmlAddEncodingAlias ( const char *  name,
const char *  alias 
)
long xmlByteConsumed ( xmlParserCtxtPtr  ctxt)

xmlByteConsumed: : an XML parser context

This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in byte of the file if parsing a file. The function is of constant cost if the input is UTF-8 but can be costly if run on non-UTF-8 input.

Returns the index in bytes from the beginning of the entity or -1 in case the index could not be computed.

int xmlCharEncCloseFunc ( xmlCharEncodingHandler handler)

xmlCharEncCloseFunc: : char enconding transformation data structure

Generic front-end for encoding handler close function

Returns 0 if success, or -1 in case of error

int xmlCharEncFirstLine ( xmlCharEncodingHandler handler,
xmlBufferPtr  out,
xmlBufferPtr  in 
)

xmlCharEncFirstLine: : char enconding transformation data structure : an xmlBuffer for the output. : an xmlBuffer for the input

Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.

Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

int xmlCharEncFirstLineInt ( xmlCharEncodingHandler handler,
xmlBufferPtr  out,
xmlBufferPtr  in,
int  len 
)

xmlCharEncFirstLineInt: : char enconding transformation data structure : an xmlBuffer for the output. : an xmlBuffer for the input : number of bytes to convert for the first line, or -1

Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.

Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

int xmlCharEncInFunc ( xmlCharEncodingHandler handler,
xmlBufferPtr  out,
xmlBufferPtr  in 
)

xmlCharEncInFunc: : char encoding transformation data structure : an xmlBuffer for the output. : an xmlBuffer for the input

Generic front-end for the encoding handler input function

Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

int xmlCharEncOutFunc ( xmlCharEncodingHandler handler,
xmlBufferPtr  out,
xmlBufferPtr  in 
)

xmlCharEncOutFunc: : char enconding transformation data structure : an xmlBuffer for the output. : an xmlBuffer for the input

Generic front-end for the encoding handler output function a first call with == NULL has to be made firs to initiate the output in case of non-stateless encoding needing to initiate their state or the output (like the BOM in UTF16). In case of UTF8 sequence conversion errors for the given encoder, the content will be automatically remapped to a CharRef sequence.

Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

void xmlCleanupCharEncodingHandlers ( void  )

xmlCleanupCharEncodingHandlers:

Cleanup the memory allocated for the char encoding support, it unregisters all the encoding handlers and the aliases.

void xmlCleanupEncodingAliases ( void  )

xmlCleanupEncodingAliases:

Unregisters all aliases

int xmlDelEncodingAlias ( const char *  alias)

xmlDelEncodingAlias: : the alias name as parsed, in UTF-8 format (ASCII actually)

Unregisters an encoding alias

Returns 0 in case of success, -1 in case of error

xmlCharEncoding xmlDetectCharEncoding ( const unsigned char *  in,
int  len 
)

xmlDetectCharEncoding: : a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). : pointer to the length of the buffer

Guess the encoding of the entity using the first bytes of the entity content according to the non-normative appendix F of the XML-1.0 recommendation.

Returns one of the XML_CHAR_ENCODING_... values.

xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler ( const char *  name)
xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler ( xmlCharEncoding  enc)

xmlGetCharEncodingHandler: : an xmlCharEncoding value.

Search in the registered set the handler able to read/write that encoding.

Returns the handler or NULL if not found

const char* xmlGetCharEncodingName ( xmlCharEncoding  enc)

xmlGetCharEncodingName: : the encoding

The "canonical" name for XML encoding. C.f. http://www.w3.org/TR/REC-xml#charencoding Section 4.3.3 Character Encoding in Entities

Returns the canonical name for the given encoding

const char* xmlGetEncodingAlias ( const char *  alias)

xmlGetEncodingAlias: : the alias name as parsed, in UTF-8 format (ASCII actually)

Lookup an encoding name for the given alias.

Returns NULL if not found, otherwise the original name

void xmlInitCharEncodingHandlers ( void  )

xmlInitCharEncodingHandlers:

Initialize the char encoding support, it registers the default encoding supported. NOTE: while public, this function usually doesn't need to be called in normal processing.

xmlCharEncodingHandlerPtr xmlNewCharEncodingHandler ( const char *  name,
xmlCharEncodingInputFunc  input,
xmlCharEncodingOutputFunc  output 
)
xmlCharEncoding xmlParseCharEncoding ( const char *  name)
void xmlRegisterCharEncodingHandler ( xmlCharEncodingHandlerPtr  handler)

xmlRegisterCharEncodingHandler: : the xmlCharEncodingHandlerPtr handler block

Register the char encoding handler, surprising, isn't it ?

 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'