libxml2_xmlio.h File Reference

Typedef xmlInputMatchCallback

typedef int(*xmlInputMatchCallback

xmlInputMatchCallback: Callback used in the I/O Input API to detect if the current handler can provide input fonctionnalities for this resource.

Returns 1 if yes and 0 if another Input module should be used

Typedef xmlInputOpenCallback

typedef void *(*xmlInputOpenCallback

xmlInputOpenCallback: Callback used in the I/O Input API to open the resource

Returns an Input context or NULL in case or error

Typedef xmlInputReadCallback

typedef int(*xmlInputReadCallback

xmlInputReadCallback: Callback used in the I/O Input API to read the resource

Returns the number of bytes read or -1 in case of error

Typedef xmlInputCloseCallback

typedef int(*xmlInputCloseCallback

xmlInputCloseCallback: Callback used in the I/O Input API to close the resource

Returns 0 or -1 in case of error

xmlCleanupInputCallbacks ( void )

XMLPUBFUN void XMLCALLxmlCleanupInputCallbacks(void)

xmlCleanupInputCallbacks:

clears the entire input callback table. this includes the compiled-in I/O.

OOM: never

xmlPopInputCallbacks ( void )

XMLPUBFUN int XMLCALLxmlPopInputCallbacks(void)

xmlPopInputCallback:

Clear the top input callback from the input stack. this includes the compiled-in I/O.

Returns the number of input callback registered or -1 in case of error.

xmlRegisterDefaultInputCallbacks ( void )

XMLPUBFUN void XMLCALLxmlRegisterDefaultInputCallbacks(void)

xmlRegisterDefaultInputCallbacks:

Registers the default compiled-in I/O handlers.

OOM: never

xmlAllocParserInputBuffer ( xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlAllocParserInputBuffer(xmlCharEncodingenc)

xmlAllocParserInputBuffer: Create a buffered parser input for progressive parsing

Returns the new parser input or NULL

OOM: possible --> NULL returned and OOM flag is set

Parameters
encthe charset encoding if known

xmlParserInputBufferCreateFilename ( const char *, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncodingenc
)

xmlParserInputBufferCreateFilename: Create a buffered parser input for the progressive parsing of a file If filename is "-' then we use stdin as the input. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. Do an encoding check if enc == XML_CHAR_ENCODING_NONE

Returns the new parser input or NULL

Parameters
URIa C string containing the URI or filename
encthe charset encoding if known

xmlParserInputBufferCreateFile ( FILE *, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateFile(FILE *file,
xmlCharEncodingenc
)

xmlParserInputBufferCreateFile: Create a buffered parser input for the progressive parsing of a FILE * buffered C I/O

Returns the new parser input or NULL

Parameters
filea FILE*
encthe charset encoding if known

xmlParserInputBufferCreateFd ( int, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateFd(intfd,
xmlCharEncodingenc
)

xmlParserInputBufferCreateFd: Create a buffered parser input for the progressive parsing for the input from a file descriptor

Returns the new parser input or NULL

Parameters
fda file descriptor number
encthe charset encoding if known

xmlParserInputBufferCreateMem ( const char *, int, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateMem(const char *mem,
intsize,
xmlCharEncodingenc
)

xmlParserInputBufferCreateMem: Create a buffered parser input for the progressive parsing for the input from a memory area.

Returns the new parser input or NULL

OOM: possible --> sets OOM flag, returns NULL for mem!=NULL && size>0

Parameters
memthe memory input
sizethe length of the memory block
encthe charset encoding if known

xmlParserInputBufferCreateStatic ( const char *, int, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateStatic(const char *mem,
intsize,
xmlCharEncodingenc
)

xmlParserInputBufferCreateStatic: Create a buffered parser input for the progressive parsing for the input from an immutable memory area. This will not copy the memory area to the buffer, but the memory is expected to be available until the end of the parsing, this is useful for example when using mmap'ed file.

Returns the new parser input or NULL

Parameters
memthe memory input
sizethe length of the memory block
encthe charset encoding if known

xmlParserInputBufferCreateIO ( xmlInputReadCallback, xmlInputCloseCallback, void *, xmlCharEncoding )

XMLPUBFUN xmlParserInputBufferPtr XMLCALLxmlParserInputBufferCreateIO(xmlInputReadCallbackioread,
xmlInputCloseCallbackioclose,
void *ioctx,
xmlCharEncodingenc
)

xmlParserInputBufferCreateIO: Create a buffered parser input for the progressive parsing for the input from an I/O handler

Returns the new parser input or NULL

Parameters
ioreadan I/O read function
ioclosean I/O close function
ioctxan I/O handler
encthe charset encoding if known

xmlParserInputBufferRead ( xmlParserInputBufferPtr, int )

XMLPUBFUN int XMLCALLxmlParserInputBufferRead(xmlParserInputBufferPtrin,
intlen
)

xmlParserInputBufferRead: Refresh the content of the input buffer, the old data are considered consumed This routine handle the I18N transcoding to internal UTF-8

Returns the number of chars read and stored in the buffer, or -1 in case of error.

Parameters
ina buffered parser input
lenindicative value of the amount of chars to read

xmlParserInputBufferGrow ( xmlParserInputBufferPtr, int )

XMLPUBFUN int XMLCALLxmlParserInputBufferGrow(xmlParserInputBufferPtrin,
intlen
)

xmlParserInputBufferGrow: Grow up the content of the input buffer, the old data are preserved This routine handle the I18N transcoding to internal UTF-8 This routine is used when operating the parser in normal (pull) mode

Returns the number of chars read and stored in the buffer, or -1 in case of error.

OOM: possible --> sets OOM flag when returns 0

Parameters
ina buffered parser input
lenindicative value of the amount of chars to read

xmlParserInputBufferPush ( xmlParserInputBufferPtr, int, const char * )

XMLPUBFUN int XMLCALLxmlParserInputBufferPush(xmlParserInputBufferPtrin,
intlen,
const char *buf
)

xmlParserInputBufferPush: Push the content of the array in the input buffer This routine handle the I18N transcoding to internal UTF-8 This is used when operating the parser in progressive (push) mode.

Returns the number of chars read and stored in the buffer, or -1 in case of error.

OOM: possible -->

Parameters
ina buffered parser input
lenthe size in bytes of the array.
bufan char array

xmlFreeParserInputBuffer ( xmlParserInputBufferPtr )

XMLPUBFUN void XMLCALLxmlFreeParserInputBuffer(xmlParserInputBufferPtrin)

xmlFreeParserInputBuffer: Free up the memory used by a buffered parser input

OOM: never

Parameters
ina buffered parser input

xmlParserGetDirectory ( const char * )

XMLPUBFUN char *XMLCALLxmlParserGetDirectory(const char *filename)

xmlParserGetDirectory: lookup the directory for that file

Returns a new allocated string containing the directory, or NULL.

Parameters
filenamethe path to a file

xmlRegisterInputCallbacks ( xmlInputMatchCallback, xmlInputOpenCallback, xmlInputReadCallback, xmlInputCloseCallback )

XMLPUBFUN int XMLCALLxmlRegisterInputCallbacks(xmlInputMatchCallbackmatchFunc,
xmlInputOpenCallbackopenFunc,
xmlInputReadCallbackreadFunc,
xmlInputCloseCallbackcloseFunc
)

xmlRegisterInputCallbacks: Register a new set of I/O callback for handling parser input.

Returns the registered handler number or -1 in case of error

OOM: never

Parameters
matchFuncthe xmlInputMatchCallback
openFuncthe xmlInputOpenCallback
readFuncthe xmlInputReadCallback
closeFuncthe xmlInputCloseCallback

xmlCheckHTTPInput ( xmlParserCtxtPtr, xmlParserInputPtr )

XMLPUBFUN xmlParserInputPtr XMLCALLxmlCheckHTTPInput(xmlParserCtxtPtrctxt,
xmlParserInputPtrret
)

xmlCheckHTTPInput: Check an input in case it was created from an HTTP stream, in that case it will handle encoding and update of the base URL in case of redirection. It also checks for HTTP errors in which case the input is cleanly freed up and an appropriate error is raised in context

Returns the input or NULL in case of HTTP error.

Parameters
ctxtan XML parser context
retan XML parser input

xmlNoNetExternalEntityLoader ( const char *, const char *, xmlParserCtxtPtr )

XMLPUBFUN xmlParserInputPtr XMLCALLxmlNoNetExternalEntityLoader(const char *URL,
const char *ID,
xmlParserCtxtPtrctxt
)

xmlNoNetExternalEntityLoader: A specific entity loader disabling network accesses, though still allowing local catalog accesses for resolution.

Returns a new allocated xmlParserInputPtr, or NULL.

Parameters
URLthe URL for the entity to load
IDthe System ID for the entity to load
ctxtthe context in which the entity is called or NULL

xmlCheckFilename ( const char * )

XMLPUBFUN int XMLCALLxmlCheckFilename(const char *path)

xmlCheckFilename: function checks to see if path is a valid source (file, socket...) for XML.

if stat is not available on the target machine, returns 1. if stat fails, returns 0 (if calling stat on the filename fails, it can't be right). if stat succeeds and the file is a directory, returns 2. otherwise returns 1.

Parameters
paththe path to check

xmlFileMatch ( const char * )

XMLPUBFUN int XMLCALLxmlFileMatch(const char *filename)

Default 'file://' protocol callbacks

xmlFileOpen ( const char * )

XMLPUBFUN void *XMLCALLxmlFileOpen(const char *filename)

xmlFileOpen: Wrapper around xmlFileOpen_real that try it with an unescaped version of filename, if this fails fallback to filename

Returns a handler or NULL in case or failure

Parameters
filenamethe URI for matching

xmlFileRead ( void *, char *, int )

XMLPUBFUN int XMLCALLxmlFileRead(void *context,
char *buffer,
intlen
)

xmlFileRead: Read len bytes to buffer from the I/O channel.

Returns the number of bytes written

Parameters
contextthe I/O context
bufferwhere to drop data
lennumber of bytes to write

xmlFileClose ( void * )

XMLPUBFUN int XMLCALLxmlFileClose(void *context)

xmlFileClose: Close an I/O channel

Returns 0 or -1 in case of error

Parameters
contextthe I/O context