By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

html DOM

P: n/a
Is there a package that would allow me the same or similar functionality for
modifying html code via the DOM model as I have in JavaScript ? I'd like to
parse an html file, then modify it and save the result. I am not trying to
do this online, rather I would like to do this on a batch of files stored on
my hard drive. I have found several packages that allow me to parse and
dissect html but none that allow me to modify the object and save the
results -- perhaps I am overlooking the obvious
Mar 30 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sun, Mar 30, 2008 at 1:09 AM, Sam the Cat <sa**********@verizon.netwrote:
Is there a package that would allow me the same or similar functionality for
modifying html code via the DOM model as I have in JavaScript ? I'd like to
parse an html file, then modify it and save the result. I am not trying to
do this online, rather I would like to do this on a batch of files stored on
my hard drive. I have found several packages that allow me to parse and
dissect html but none that allow me to modify the object and save the
results -- perhaps I am overlooking the obvious
Have you looked at Beautiful Soup?

http://www.crummy.com/software/BeautifulSoup/

David.
Mar 30 '08 #2

P: n/a
On 30 Mar, 01:09, "Sam the Cat" <sam_spam_...@verizon.netwrote:
Is there a package that would allow me the same or similar functionality for
modifying html code via the DOM model as I have in JavaScript ? I'd like to
parse an html file, then modify it and save the result.
You could try libxml2dom which has an HTML parsing mode (like lxml and
other solutions based on libxml2):

http://www.python.org/pypi/libxml2dom

It attempts to provide a DOM API very much like that used by
JavaScript implementations.

Paul
Mar 30 '08 #3

P: n/a
Sam the Cat wrote:
Is there a package that would allow me the same or similar functionality
for modifying html code via the DOM model as I have in JavaScript ? I'd
like to parse an html file, then modify it and save the result. I am
not trying to do this online, rather I would like to do this on a batch
of files stored on my hard drive. I have found several packages that
allow me to parse and dissect html but none that allow me to modify the
object and save the results -- perhaps I am overlooking the obvious
http://codespeak.net/lxml/lxmlhtml.html

Here are some performance comparisons of HTML parsers:

http://blog.ianbicking.org/2008/03/3...r-performance/

Stefan
Apr 7 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.