Firefox/Chromium have well implemented(?) parsers. Then why are parsers like lxml and other such parsers being developed with so much effort put into it?

Aren't they re-inventing the wheel? Or are they solving a different problem? Can't parsers in browsers be made into standalone libraries?

  • 1
    People down-voting should really read what a specific site stands for: programmers.stackexchange.com/about, or at least think a little.
    – Aby James
    Commented Mar 11, 2012 at 20:29
  • I amn't sure about the question. But one possible answer would be that Firefox/Chromium just don't parse HTML/XML alone; they parse CSS and JavaScript too (and other plugins) for processing. And XML isn't just used on the web alone. Its a data interchange format and there are separate technologies to deal with it (there are XML databases). So a full-fledged XML parser is necessary to deal with non-browser data. You might now ask why not abstract the XML of the browser. Good question but need to go through the technical docs to understand whether its possible.
    – Ubermensch
    Commented Mar 12, 2012 at 8:29

1 Answer 1


lxml is not a new parser, it's a Python binding for libxml2 and libxslt. Both libraries were originally build for Gnome, have been around for quite a while and are used by numerous projects, either directly or via language specific bindings like lxml.

Chrome uses both (check chrome://credits/) and Firefox uses Expat1 (check: about:license) which similarly to libxml is a standalone library. Both browsers use standalone open source libraries that are quite popular, so there isn't really much re-inventing the wheel going on here.

1 Thanks Wladimir Palant

  • 1
    Firefox uses the Expat parser for XML parsing, see about:license. As to XSLT - it seems to be an own development. Commented Mar 11, 2012 at 20:21
  • I do know what lxml is and its history, as I am working with it now. After reading: html5rocks.com/en/tutorials/internals/howbrowserswork, it got me thinking the relative merits of parsers used in browsers and the other libraries.
    – Aby James
    Commented Mar 11, 2012 at 20:35
  • @AbyCodes Well if you knew lxml is not a parser, then I really don't understand your question....
    – yannis
    Commented Mar 11, 2012 at 20:40
  • @Yanni Rizos : 'lxml is not a new parser'. Your answer too paints a broad stroke, doesn't it? let's not be too pedantic here, and see the question for what it is; which is the relative merits and the 'why' of parsers in browers vs the other parsers, or 'toolkits' that make use of it.
    – Aby James
    Commented Mar 11, 2012 at 21:20
  • @AbyCodes I still don't get it. lxml is a binding toolkit, the only thing it does is offer a Python binding for libxml, which is the same parser Chrome uses. Firefox uses Expat, another widely used library, there isn't such a thing as a "browser parser", at least not when we are discussing open source browsers.
    – yannis
    Commented Mar 11, 2012 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.