Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
People down-voting should really read what a specific site stands for:, or at least think a little. – gits1225 Mar 11 '12 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 Mar 12 '12 at 8:29

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

share|improve this answer
Firefox uses the Expat parser for XML parsing, see about:license. As to XSLT - it seems to be an own development. – Wladimir Palant Mar 11 '12 at 20:21
I do know what lxml is and its history, as I am working with it now. After reading:, it got me thinking the relative merits of parsers used in browsers and the other libraries. – gits1225 Mar 11 '12 at 20:35
@AbyCodes Well if you knew lxml is not a parser, then I really don't understand your question.... – Yannis Mar 11 '12 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. – gits1225 Mar 11 '12 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 Mar 11 '12 at 21:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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