[Mono-devel-list] Interop with unmanaged code withoutcopyingor memory allocation?
karl at waclawek.net
Tue Jan 13 09:09:15 EST 2004
> .NET provides the System.Xml.XmlReader API instead of a the SAX API
> (which has also been implemented by libxml2).
You mean, there is an XMLReader wrapper for libxml2?
Such a wrapper for Expat would also be a nice idea, but likely
add some additional overhead, as Expat would need to be stopped
and re-started frequently.
> It avoids the memory
> overhead of a DOM, and the callback issues with SAX. Conceptually, it
> resembles a compiler lexer -- you Read() to get the next "token" (XML
> element), which you can then inspect using the XmlReader properties.
I know, a Pull API can be quite easy to use. However, there is a lot
of SAX based code out there, and it may be nice if it can be ported to
C# without a major rewrite. There may also be some apps where SAX
is a good choice.
> XmlReader is intended for processing multi-gigabyte files. I'm not sure
> if it's actually successful in doing so, but it *should* be able to do
> so, without requiring gigabytes of memory (like a DOM would require).
Yes, I am aware of that. The advantage of Expat would not only
be the low memory requirements, but also its speed.
> It would be interesting to know if XmlReader can be used for your
> particular high performance applications.
I know for sure that Expat can. ;-)
More information about the Mono-devel-list