[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: plan for lightweight DOM implementation
From:       Tomas Mecir <mecirt () gmail ! com>
Date:       2005-10-31 15:07:02
Message-ID: 492258b10510310707g4fc78885n1575b7e52f4b9b57 () mail ! gmail ! com
[Download RAW message or body]

On 10/31/05, Ariya Hidayat <ariya@kde.org> wrote:
> > So basically, you expose a DOM interface on the front side, but use SAX on the
> > back side as needed.
>
> This is also what QDom does.  The difference is that QDom and friends
> load everything into the memory at once, while for this plan those DOM
> nodes will be loaded on-demand only.

Been thinking ...

Not quite sure how exactly you plan to implement these things, but
here is what I came with. It would be relatively easy to do, and
accomplish what we need ...

Basically, it would work like current DOM stuff works, with one
exception. The code which uses the DOM stuff will be able to provide a
list of tags, for which lazy evaluation is desired (as a list of
names). Note that this would also affect all nested tags within a tag
with a given name. Then, the file would be loaded all into memory and
stuff, as it is now, but whenever the tag in the list is encountered,
parsing would stop until the matching closing tag comes (so some
parsing is necessary to avoid problems with nested tags having the
same name), and a proxy node will be created, that'd point to a
position in the file or loaded strem or something where all contents
of the tag and its childs are written (or alternately, it could be
stored in the proxy tag as a big string). Then, when the code wants to
use the tag, it would transparently (or the code would call some
method, like wantToUseTag) parse the XML section into the DOM subtree.
And after processing, the code would call something like releaseTag,
which would release tag contents. This releasing could maybe work also
for tags that were loaded normally, without using the lazy-loading...

I believe that this would be quite straightforward to implement,
possibly simply by copying QDom and making the necessary changes...

I hope I've explained it well enough :D

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic