From koffice-devel Sun Oct 30 15:50:10 2005 From: Ariya Hidayat Date: Sun, 30 Oct 2005 15:50:10 +0000 To: koffice-devel Subject: plan for lightweight DOM implementation Message-Id: X-MARC-Message: https://marc.info/?l=koffice-devel&m=113068741617154 I'd like to give a try to implement alternative DOM implementation which does not consume as much memory as typical QDom classes. My goal is to have counterparts to important QDom stuff (like QDomDocument, QDomNode, QDomElement) and retain the API so that current document loading code can only be slightly modified. This is in constrast e.g. if we go full the SAX-way and need to rewrite almost everyting. The idea is as follows. Each node does not necessarily load the attributes and its children at once, but rather only on-demand. Upon loading the main document, only information about the first level nodes/elements (which are children of the document) are loaded. For each node, the positions in the content corresponding the node data are saved. When this node is accessed, then it will "rewind" again the content to the appropriate position, reparse the data, and again capture only its direct children nodes. Node can also have unload() method which explicitly purged its data from memory. This is useful when the program knows it will not use the node anymore. Example: when KSpread starts to parse the second sheet, the first element is not useful and can be thrown away. I expect a performance degradation since parsing needs to be performed many times. However, I estimate that memory requirement will be much less. My guess is that this is worth doing it. So I'm starting to work on this, and comments are warmly appreciated. -- Ariya Hidayat, http://ariya.blogspot.com http://www.google.com/search?q=ariya+hidayat&btnI _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel