Re: [xml] Parsing XML with huge text nodes



Andrew Hartley wrote:
I am using LibXml2 v2.7.6 and parsing an XML document that has a couple of
huge text nodes, approx 16MB.

I see that there is an option of setting a context option to XML_PARSE_HUGE. I would appreciate if someone could let me know where I need to set this. Here is a snippet of my code:

xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
xmlSubstituteEntitiesDefault(1);

m_pXmlDoc = xmlParseFile(szFilename);

...


Use xmlReadFile and you can pass parser options as the 3rd argument:
m_pXmlDoc = xmlReadFile(szFilename, NULL, XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOENT | XML_PARSE_HUGE);

Using this you should also be able to remove the use of the global vars (xmlLoadExtDtdDefaultValue and xmlSubstituteEntitiesDefault).

Rob




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