ok
Direktori : /usr/lib64/python2.7/site-packages/lxml/html/ |
Current File : //usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyo |
� �ePc @ s d Z d d d g Z d d l m Z m Z d d l m Z m Z m Z m Z m Z d d d � Z d d d � Z d d � Z d � Z d � Z d � Z d � Z y d d l m Z Wn! e k r� d d l m Z n Xd d l Z e j d � j Z d � Z d S( s5 External interface to the BeautifulSoup HTML parser. t fromstringt parset convert_treei����( t etreet html( t BeautifulSoupt Tagt Commentt ProcessingInstructiont 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. ( t _parse( t datat beautifulsoupt makeelementt bsargs( ( s: /usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR s c K s@ t | d � s t | � } n t | | | | � } t j | � 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 read( t hasattrt openR R t ElementTree( t fileR R R t root( ( s: /usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR s c C sX | d k r t j j } n t | | � } | j � } x | D] } | j | � 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( t NoneR t html_parserR t _convert_treet getchildrent remove( t beautiful_soup_treeR R t childrent child( ( s: /usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR '