Re: [xml] Query regarding re-using parser context for SAX parsing

On Fri, Mar 28, 2008 at 06:50:32PM +0530, Nagesh wrote:
Hi All,

       Is there any way, I can re-use the already created parser context
(ex: xmlCreateMemoryParserCtxt) to perform SAX parsing of more than one xml
document without freeing and creating the parser context again. I tried
using xmlSetupParserForBuffer( ), but apparently it handles only the case in
which the encoding of the XML document is UTF-8. Any other encoding is
currently not supported by xmlSetupParserForBuffer( ). 

  create your XML parser context, then use xmlCtxtReadMemory()
(assuming parsing from memory) for each document with the same parser

The xmlCtxtRead... functions uses xmlCtxtReset() to cleanup existing state
left from previous parsing


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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