1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

- parser.c xmlIO.[ch]: fixed the problem of encoding support

when using in memory parsing. Need some cleanup.
- xmllint.c configure.in: added a --memory flag to test memory
  parsing
Daniel
This commit is contained in:
Daniel Veillard
2000-07-21 20:32:03 +00:00
parent 3665069745
commit 46e370e69f
8 changed files with 91 additions and 11 deletions

34
xmlIO.c
View File

@ -89,6 +89,11 @@ int xmlOutputCallbackInitialized = 0;
* *
************************************************************************/
int
xmlNop(void) {
return(0);
}
/**
* xmlFdMatch:
* @filename: the URI for matching
@ -1044,6 +1049,35 @@ xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) {
return(ret);
}
/**
* xmlParserInputBufferCreateMem:
* @mem: the memory input
* @size: the length of the memory block
* @enc: the charset encoding if known
*
* Create a buffered parser input for the progressive parsing for the input
* from a file descriptor
*
* Returns the new parser input or NULL
*/
xmlParserInputBufferPtr
xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
if (size <= 0) return(NULL);
if (mem == NULL) return(NULL);
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
ret->context = (void *) mem;
ret->readcallback = (xmlInputReadCallback) xmlNop;
ret->closecallback = NULL;
xmlBufferAdd(ret->buffer, (const xmlChar *) mem, size);
}
return(ret);
}
/**
* xmlOutputBufferCreateFd:
* @fd: a file descriptor number