Re: [xml] libxml memory consumption



On Mon, Aug 06, 2001 at 11:42:20PM +1000, Gavin Sherry wrote:
I have not noticed any reference in the documentation nor (from the skim I
gave it) anything in the source which suggests that libxml can deal with
just localised parts of the XML document. That is, to take a basic
example, if I have a document such as:

<doc>
   <info>
      <data>123</data>
      <data>456></data>
   </info>
   <otherinfo>
      <data>abc</data>
      ...
   </otherinfo>
</doc>

and the size of the tree under 'otherinfo' is 200 MB but I want only to
look at the tree under 'info' then I am using a very large amount of
memory to do it. Has anyone considered building a 'contextually' (for lack
of another word) sensitive read ahead system into libxml which could read
only the section of the tree you are interested in into memory or is this
also featured in some part of the library I am yet to explore?

  Not provided directly, but you can probably build it using mostly existing
code. The tree is built by the default SAX handlers in SAX.c.
  If you override them and call the default ones only for content within
the parts you are interested you can probably build what you need 
relatively quickly. The ctxt->nameXXX provides the current stack
context of the parser, you should be able to build your selection on this.
  This will require a bit of custom glue code, though.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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