Package CHEM :: Package DB :: Package rdb :: Module BeautifulSoup
[hide private]
[frames] | no frames]

Module BeautifulSoup



Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/

Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.

A well-formed XML/HTML document yields a well-formed data
structure. An ill-formed XML/HTML document yields a correspondingly
ill-formed data structure. If your document is only locally
well-formed, you can use this library to find and process the
well-formed part of it. The BeautifulSoup class 

Beautiful Soup works with Python 2.2 and up. It has no external
dependencies, but you'll have more success at converting data to UTF-8
if you also install these three packages:

* chardet, for auto-detecting character encodings
  http://chardet.feedparser.org/
* cjkcodecs and iconv_codec, which add more encodings to the ones supported
  by stock Python.
  http://cjkpython.i18n.org/

Beautiful Soup defines classes for two main parsing strategies:
    
 * BeautifulStoneSoup, for parsing XML, SGML, or your domain-specific
   language that kind of looks like XML.

 * BeautifulSoup, for parsing run-of-the-mill HTML code, be it valid
   or invalid. This class has web browser-like heuristics for
   obtaining a sensible parse tree in the face of common HTML errors.

Beautiful Soup also defines a class (UnicodeDammit) for autodetecting
the encoding of an HTML or XML document, and converting it to
Unicode. Much of this code is taken from Mark Pilgrim's Universal Feed Parser.

For more than you ever wanted to know about Beautiful Soup, see the
documentation:
http://www.crummy.com/software/BeautifulSoup/documentation.html




Version: 3.0.4

Author: Leonard Richardson (leonardr@segfault.org)

Copyright: Copyright (c) 2004-2007 Leonard Richardson

License: PSF

Classes [hide private]
  PageElement
Contains the navigational information for some part of the page (either a tag or a piece of text)
  NavigableString
  CData
  ProcessingInstruction
  Comment
  Declaration
  Tag
Represents a found HTML tag with its attributes and contents.
  SoupStrainer
Encapsulates a number of ways of matching a markup element (tag or text).
  ResultSet
A ResultSet is just a list that keeps track of the SoupStrainer that created it.
  BeautifulStoneSoup
This class contains the basic parser and search code.
  BeautifulSoup
This parser knows the following facts about HTML: * Some tags have no closing tag and should be interpreted as being closed as soon as they are encountered.
  StopParsing
  ICantBelieveItsBeautifulSoup
The BeautifulSoup class is oriented towards skipping over common HTML errors like unclosed tags.
  MinimalSoup
The MinimalSoup class is for parsing HTML that contains pathologically bad markup.
  BeautifulSOAP
This class will push a tag with only a single string child into the tag's parent as an attribute.
  RobustXMLParser
  RobustHTMLParser
  RobustWackAssHTMLParser
  RobustInsanelyWackAssHTMLParser
  SimplifyingSOAPParser
  UnicodeDammit
A class for detecting the encoding of a *ML document and converting it to a Unicode string.
Functions [hide private]
 
isList(l)
Convenience method that works with all 2.x versions of Python to determine whether or not something is listlike.
 
isString(s)
Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.
 
buildTagMap(default, *args)
Turns a list of maps, lists, or scalars into a single map.
Variables [hide private]
  name2codepoint = {'AElig': 198, 'Aacute': 193, 'Acirc': 194, '...
  DEFAULT_OUTPUT_ENCODING = 'utf-8'
  chardet = <CHEM.DB.rdb.search.NameRxnPatternMatchingModel.Sear...
Function Details [hide private]

buildTagMap(default, *args)

 
Turns a list of maps, lists, or scalars into a single map. Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and NESTING_RESET_TAGS maps out of lists and partial maps.

Variables Details [hide private]

name2codepoint

Value:
{'AElig': 198,
 'Aacute': 193,
 'Acirc': 194,
 'Agrave': 192,
 'Alpha': 913,
 'Aring': 197,
 'Atilde': 195,
 'Auml': 196,
...

chardet

Value:
None