fdutils/html.py
def parse_html_table(table, keep_attributes=False, transpose=False):
    """ parses a regular html table
    
        where the headers are on top and the data is on each row, with
        one value per header column
        
    """
    labels = []
    rows = []

    thead_row = table.xpath('thead/tr')

    if thead_row:
        for row in thead_row:
            _row_labels, data = _get_row_label_cells_data(row)
            if data:
                log.debug('received data in thead?? ' + str(data))
            labels.append([_row_labels, 0])

    for row in _get_tbody_rows(table):

        _row_labels, row_data = _get_row_label_cells_data(row)

        if _row_labels:

            if not labels or (len(labels[-1][0]) > 1 and len(_row_labels) > 1):
                labels.append([_row_labels, len(rows)])

            else:
                row_data.insert(0, _row_labels[0])

        if row_data and all:
            rows.append(row_data)

    if not keep_attributes:
        labels, rows = _remove_attributes(labels, rows)

    if transpose:
        if len(labels) > 1:
            raise Exception('We have not implemented transposing tables with sub-labels inside')
        labels, rows = _transpose_table_info(labels[0][0], rows)

    elif len(labels) == 1:
        labels = labels[0][0]

    return labels, rows
 parses a regular html table
    
        where the headers are on top and the data is on each row, with
        one value per header column
        
    
parses a regular html table
where the headers are on top and the data is on each row, with
one value per header column
parses a regular html table where the headers are on top and the data is on each row with one value per header column
def parse_html_table(table, keep_attributes=False, transpose=False):
    labels = []
    rows = []
    thead_row = table.xpath('thead/tr')
    if thead_row:
        for row in thead_row:
            _row_labels, data = _get_row_label_cells_data(row)
            if data:
                log.debug('received data in thead?? ' + str(data))
            labels.append([_row_labels, 0])
    for row in _get_tbody_rows(table):
        _row_labels, row_data = _get_row_label_cells_data(row)
        if _row_labels:
            if not labels or (len(labels[-1][0]) > 1 and len(_row_labels) > 1):
                labels.append([_row_labels, len(rows)])
            else:
                row_data.insert(0, _row_labels[0])
        if row_data and all:
            rows.append(row_data)
    if not keep_attributes:
        labels, rows = _remove_attributes(labels, rows)
    if transpose:
        if len(labels) > 1:
            raise Exception('We have not implemented transposing tables with sub-labels inside')
        labels, rows = _transpose_table_info(labels[0][0], rows)
    elif len(labels) == 1:
        labels = labels[0][0]
    return labels, rows
def parse_html_table ( table , keep_attributes = False , transpose = False ) : labels = [ ] rows = [ ] thead_row = table . xpath ( 'thead/tr' ) if thead_row : for row in thead_row : _row_labels , data = _get_row_label_cells_data ( row ) if data : log . debug ( 'received data in thead?? ' + str ( data ) ) labels . append ( [ _row_labels , 0 ] ) for row in _get_tbody_rows ( table ) : _row_labels , row_data = _get_row_label_cells_data ( row ) if _row_labels : if not labels or ( len ( labels [ - 1 ] [ 0 ] ) > 1 and len ( _row_labels ) > 1 ) : labels . append ( [ _row_labels , len ( rows ) ] ) else : row_data . insert ( 0 , _row_labels [ 0 ] ) if row_data and all : rows . append ( row_data ) if not keep_attributes : labels , rows = _remove_attributes ( labels , rows ) if transpose : if len ( labels ) > 1 : raise Exception ( 'We have not implemented transposing tables with sub-labels inside' ) labels , rows = _transpose_table_info ( labels [ 0 ] [ 0 ] , rows ) elif len ( labels ) == 1 : labels = labels [ 0 ] [ 0 ] return labels , rows
parses a regular html table
where the headers are on top and the data is on each row, with
one value per header column
parses a regular html table where the headers are on top and the data is on each row with one value per header column
""" parses a regular html table
    
        where the headers are on top and the data is on each row, with
        one value per header column
        
    """
table
keep_attributes
transpose