Function parsercher::print_dom_tree[][src]

pub fn print_dom_tree(dom: &Dom)
Expand description

Output the Dom structure in a human readable format.

Using println!. Useful for debugging.

Examples

Output the following HTML.

let html = r#"
<head>
  <meta charset="UTF-8">
  <title>sample</title>
</head>
<body>
  <h1>Hello, world!</h1>
</body>
"#;
if let Ok(dom) = parsercher::parse(&html) {
    parsercher::print_dom_tree(&dom);
}

output:

<root>
  <head>
    <meta charset="UTF-8">
    <title>
      TEXT: "sample"
  <body>
    <h1>
      TEXT: "Hello, world!"