Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Beautiful Soup with TreeBuilder action
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leonard Richardson  
View profile  
 More options Apr 10 2009, 4:19 pm
From: Leonard Richardson <leona...@segfault.org>
Date: Fri, 10 Apr 2009 16:19:48 -0400
Local: Fri, Apr 10 2009 4:19 pm
Subject: Beautiful Soup with TreeBuilder action
I've changed Beautiful Soup so that the default tree builder (which as
you're all aware uses the not-very-good HTMLParser) can be swapped out
for one that uses a different parser. I've written a tree builder for
lxml that's twice as fast as the HTMLParser. I'll also be writing one
for html5lib.

Writing a TreeBuilder is very easy. The TreeBuilder's job is to run a
document through a parser and generate "start tag", "end tag", and
"data" events for Beautiful Soup's consumption. All information about
how the underlying parser works is encapsulated in the tree builder
code. So there are many ways to build a Beautiful Soup tree, and once
you have the tree you can use all the Beautiful Soup methods on it.

I've created a small compatibility test suite for TreeBuilders in
tests/treebuilder.py. If this test suite passes with your tree
builder, you probably implemented the tree builder correctly. Every
tree builders will interpret bad HTML differently, but they should all
interpret valid HTML the same way.

I've also moved Beautiful Soup to zc.buildout for build and
deployment. This won't affect you if you just use Beautiful Soup, but
it changes where the source files live in the package.

The code is at the trunk of the beautifulsoup project on Launchpad:

http://code.launchpad.net/beautifulsoup

This will probably become Beautiful Soup 4.0. I'd like to hear
feedback about the TreeParser design and how the compatibility suite
can be improved.

Leonard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
monk.e.boy  
View profile  
 More options Apr 14 2009, 5:45 am
From: "monk.e.boy" <john.glazebr...@guava.com>
Date: Tue, 14 Apr 2009 02:45:21 -0700 (PDT)
Local: Tues, Apr 14 2009 5:45 am
Subject: Re: Beautiful Soup with TreeBuilder action

> you're all aware uses the not-very-good HTMLParser) can be swapped out
> for one that uses a different parser. I've written a tree builder for
> lxml that's twice as fast as the HTMLParser. I'll also be writing one
> for html5lib.

Thank you :)  I am super excited about html5lib. Which do you guys
prefer? lxml or html5lib? I'm looking for the most relaxed parser, the
tag soup I parse is very 1990s HTML 4 hand coded (ahem) rubbish ;)

Thanks again for all the hard work. Much appreciated :)

monk.e.boy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »