Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A lightweight XML parser efficient for large files?

I need to parse potentially huge XML files, so I guess this rules out DOM parsers.

Is out there any good lightweight SAX parser for C++, comparable with TinyXML on footprint? The structure of XML is very simple, no advanced things like namespaces and DTDs are needed. Just elements, attributes and cdata.

I know about Xerces, but its sheer size of over 50mb gives me shivers.

Thanks!

like image 867
Alex Jenter Avatar asked Jun 17 '09 11:06

Alex Jenter


People also ask

Which parser is best in parsing in large size documents Why?

DOM Parser is faster than SAX Parser. Best for the larger sizes of files.

What is fast XML parser?

Fast XML Parser (FXP)is the JS library which validate and parse a XML syntactically without applying the rules of XSD. It has completed it's one year with 85k Downloads and 175+ github stars.


2 Answers

If you are using C, then you can use LibXML from the Gnome project. You can choose from DOM and SAX interfaces to your document, plus lots of additional features that have been developed over years. If you really want C++, then you can use libxml++, which is a C++ OO wrapper around LibXML.

The library has been proven again and again, is high performance, and can be compiled on almost any platform you can find.

like image 94
Tony Miller Avatar answered Sep 20 '22 13:09

Tony Miller


I like ExPat
http://expat.sourceforge.net/

It is C based but there are several C++ wrappers around to help.

like image 43
Martin York Avatar answered Sep 19 '22 13:09

Martin York