Re: [xml] Access internal xmlParserInputBuffer data



On Fri, Jan 15, 2010 at 10:50:15PM +0300, Nikolay Sivov wrote:
Hi.

First on question background. I want to use xmlTextReader API to
access streamed xml data.
Decided to allocate input buffer with xmlAllocParserInputBuffer()
and use read callback to provide xml data
(no choice here for me actually).

Is it safe to manually set 'readcallback' and 'context' fields of
returned xmlParserInputBuffer?
Looking at libxml2 code I don't see any problems with that, but it's
better to ask.

  In general I would suggest you try to use
http://xmlsoft.org/html/libxml-xmlreader.html#xmlReaderNewIO
i.e. don't manipulate the buffer directly but let libxml2 callbacks
call you to fill data in as needed instead.

  Now if you want to play with the internals, you can, libxml2 exposes
them, but I can't garantee your code won't break something, only solid
testing and careful analysis can really give insurance over such
tweaking,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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