Re: [xml] about xmlReadMemory()
- From: nicolas bats <sl1200mk2 gmail com>
- To: Nick Wellnhofer <wellnhofer aevum de>
- Cc: xml gnome org
- Subject: Re: [xml] about xmlReadMemory()
- Date: Wed, 3 Mar 2021 09:30:44 +0100
Hi Nick,
I've experimented with xmlReadIO and it's cool.
this message just to check I'm doing right:
-I register an xmlInputReadCallback of type: size_t myCallback(void* context, char* buffer, int length)
-I do my stuff in the callback and if data I use exceed the length of the buffer, I realloc it.
Is this schema good?
Do I need to set size_t as the return type of myCallback?
thank you for your enlightenment .
best regards,
nicolas
Thank you Nick for your answer, I'll give a try to
xmlReadIO.thanks again.
On 02/03/2021 16:28, nicolas bats via xml wrote:
> Hi,
> is there's a reason why xmlReadMemory
> <http://xmlsoft.org/html/libxml-parser.html#xmlReadMemory>() accepts int as
> the size of the array to transform to xmlDocPtr.
> no doubt there's one...
That's simply a design mistake. The API was created 20 years ago when 64-bit
systems were rare.
> and in that case how could I retrieve a xmlDocPtr from
> memory where size is type of size_t?
If you want to process memory buffers larger than INT_MAX, you can use
xmlReadIO with a custom read callback that uses a size_t to store the offset.
Nick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]