On Sun, 27 Feb 2011, Gustavo Sverzut Barbieri wrote:
> Hi all, > > Find attached a test file that implements a very simple and stupid XML > parser for Eina. It's far from complete or standards compliant, yet it > should do fine for traditional xml files we have in our systems, > things such as FreeDesktop or various configuration files. > > It ships with a SAX-like parser that does not allocate any memory and > depends on nothing other than strings.h and ctype.h. This parser will > tokenize the given buffer and handle you with pointers/offset/size in > the originating buffer, with some type hint to make your life easier > (is it an open tag? close? processing? doctype? data? cdata? comment? > error), also will strip whitespaces. Your function can then choose to > abort the parsing at any moment by returning FALSE. > Tag attributes are not handled in this phase, you can use other > functions to parse then if you wish. Also does not allocate memory > (does a bit on the stack with alloca for ease of use of the api). > > Most people that want to parse configuration files or some definitions > (ie: xkbd mappings) can use the SAX directly. > > If you like, there is a basic node-tree builder that should be > efficient (nodes allocated from mempool, inlists to avoid > fragmentation, data nodes have inlined string contents, most strings > are stringshared). This also accept user-created nodes and can be then > serialized into a buffer. Use this if you need to load-modify-save > files. > > Again, this is far from standards compliant as libxml2, but it's even > far from the bloat these xml libs carry. I'd propose it to be > integrated into Eina as it's very useful and small. > > The idea came from quaker66 that is doing xkbd/language module and > would like to avoid libxml2... he cited using efreet, but that would > be nonsense and efreet does not expose its parser... actually efreet > could be converted to use this new parser I'm proposing. would it be possible to have some benchmark (that parser vs libxml2 vs expat) ? Vincent ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
