sxdhtmltable

Provide features related to HTML tables

There are some complexities to deal with when dealing with HTML tables.

This library hides these complexities and makes it easy to deal with the structure of the table. For example, you can convert an HTML table tag to a CSV file.

Usage

```rust use sxdhtmltable::Table;

let html = r#"

header1 header2
data1 data2

"#;

fn extracttabletextsfromdocument(html: &str) -> Result>, Error> { let package = sxdhtml::parsehtml(html); let document = package.asdocument(); let tables = extracttablenodestotable(document.root())?; let tables = tables .intoiter() .map(|table| table.tostringtable()) .collect(); Ok(tables) }

let table = extracttabletextsfromdocument(html).unwrap(); let csv = table.tocsv().unwrap(); asserteq!(csv, "header1,header2\ndata1,data2\n"); ```

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.