emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking Emacs with libxml2


From: Lars Magne Ingebrigtsen
Subject: Re: Linking Emacs with libxml2
Date: Mon, 06 Sep 2010 23:17:45 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> It's an obvious idea, but I think it's a fair bit of work:
> - you'll probably want your function to be able to read from a buffer
>   rather than from a file (reading from a file would slow down the
>   operation to a point where using a separate xml-to-elisp executable
>   isn't that much worse).

That's actually the main entry point for the library:

http://www.xmlsoft.org/html/libxml-HTMLparser.html#htmlParseDoc

Well, you have to convert the buffer to a string, but...

> - parsing HTML is the easy part, rendering it in Emacs is a lot
>   more difficult.

Well, parsing real work HTML is quite tricky, but you're right in that
the major part of this work wouldn't be hooking libxml2 into Emacs
(probably a day's work for somebody who knows what they're doing, and
three days for me?), but writing an HTML renderer.  I've been looking to
see whether there are any C libraries for rendering HTML, but I haven't
found anything.  (Well, except Gecko and Webkit, but 1) we probably
don't want to make Emacs dependent on those very large libraries, and 2)
they're oriented towards more graphical environments than Emacs.)

But I'm kinda unsure how much work writing an HTML renderer would be, if
you had access to a sensible parse tree.  My guess would be that you
could have something that rendered 80% of pages very nicely with one
week's worth of work.  And I take those numbers out of the air, but
that's the vague feeling I have...

-- 
(domestic pets only, the antidote for overdose, milk.)
  address@hidden * Lars Magne Ingebrigtsen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]