open Bytesrw (* Basic HTML parsing example *) let html = {|
This is a simple example.
|} let () = (* Parse HTML string *) let result = Html5rw.parse (Bytes.Reader.of_string html) in (* Access the root document node *) let doc = Html5rw.root result in Printf.printf "Root node: %s\n" doc.Html5rw.Dom.name; (* Convert back to HTML *) let output = Html5rw.to_string result in Printf.printf "\nParsed and serialized:\n%s\n" output; (* Extract plain text *) let text = Html5rw.to_text result in Printf.printf "\nText content: %s\n" text