[xml] Unable to create huge text nodes with libxml2 2.7.7

Hi list,

I (actually a very important customer ;-) was bit by the 10MB size limit introduced in libxml2 2.7.3. Actually, we are using 2.7.7...

The code basically does the following (error handling omitted for clarity, actual code is more complex):

----- snip -----
xmlDocPtr        doc    = NULL;
xmlNodePtr       node   = NULL;
xmlTextWriterPtr writer = NULL;
char             huge[ 100*1024*1024 ] = { 'a' };
int              written;

doc = xmlNewDoc( (xmlChar *) "1.0" );
node = xmlNewDocNode( doc, NULL, (xmlChar *)"node", NULL );
xmlDocSetRootElement( doc, node );
writer = xmlNewTextWriterTree( doc, node, 0 );
xmlTextWriterStartElement( writer, BAD_CAST "huge" );
written = xmlTextWriterWriteBinHex( writer, huge, 0, sizeof( huge ) );
----- snip -----

With libxml2 V2.7.7 xmlTextWriterWriteBinHex() always returns -1 and error analysis reveals that the SAX2 parser hit the 10MB limit.

I was bypassing this by eliminating the size limit check in SAX2.c and recompiling libxml2 but I do not really like this "solution".

So the question is if there is a standard way of passing the XML_PARSE_HUGE option to the SAX2 parser used under the hood of the xmlTextWriter-family functions.

I have done extensive research but was not able to find anything useful. I have checked but did not find a compile-time option to eliminate the 10MB size limit.

Thanks and best regards,
Michael Kwasigroch________________________________________________________________
INTERCOPE International Communication Products Engineering GmbH
Himmelstrasse 12-16, 22299 Hamburg, Germany
Managing Directors: Reinhart Laumer, Frank Kollender
Commercial Registry: Amtsgericht Hamburg, HRB 31 638
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]