Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
lxml
/
html
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/lxml/html/soupparser.pyc
mō i2āGc @ sÐ d Z d d d g Z d k l Z l Z d k l Z l Z l Z l Z l Z d d d Z d d d Z d d Z d Z d Z d Z d Z d k l Z d k Z e i d i Z d Z d S( s5 External interface to the BeautifulSoup HTML parser. t fromstringt parset convert_tree( s etrees html( s BeautifulSoups Tags Comments ProcessingInstructions NavigableStringc K s t | | | | S( sĪ Parse a string of HTML data into an Element tree using the BeautifulSoup parser. Returns the root ``<html>`` Element of the tree. You can pass a different BeautifulSoup parser through the `beautifulsoup` keyword, and a diffent Element factory function through the `makeelement` keyword. By default, the standard ``BeautifulSoup`` class and the default factory of `lxml.html` are used. N( t _parset datat beautifulsoupt makeelementt bsargs( R R R R ( ( t8 /usr/lib/python2.4/site-packages/lxml/html/soupparser.pyR s c K sB t | d p t | } n t | | | | } t i | S( sY Parse a file into an ElemenTree using the BeautifulSoup parser. You can pass a different BeautifulSoup parser through the `beautifulsoup` keyword, and a diffent Element factory function through the `makeelement` keyword. By default, the standard ``BeautifulSoup`` class and the default factory of `lxml.html` are used. t readN( t hasattrt filet openR R R R t roott etreet ElementTree( R R R R R ( ( R R s c C sZ | d j o t i i } n t | | } | i } x | D] } | i | q? W| S( s Convert a BeautifulSoup tree to a list of Element trees. Returns a list instead of a single root Element to support HTML-like soup with more than one root element. You can pass a different Element factory through the `makeelement` keyword. N( R t Nonet htmlt html_parsert _convert_treet beautiful_soup_treeR t getchildrent childrent childt remove( R R R R R ( ( R R ' s c K s | d j o t } n | d j o t i i } n d | j o d | d <n | | | } t | | } t | d j o | d i d j o | d Sn d | _ | S( Nt convertEntitiesR i i ( R R t BeautifulSoupR R R R t sourcet treeR R t lent tag( R R R R R R ( ( R R ; s ' c C s2 | | i d t | i } t | | | | S( Nt attrib( R R t namet dictt attrsR t _convert_children( R R R ( ( R R J s c C s9 t i } d } x#| D]} t | t ob | | | i d t g } | i D] \ } } | | t | f qL ~ } t | | | q t | t j o t | | t | q t | t o | i t i | q t | t o&