aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/net/html/html.v
blob: 293b64371474d30cf3efb0133da03a409358b829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module html

import os

// parse parses and returns the DOM from the given text.
pub fn parse(text string) DocumentObjectModel {
	mut parser := Parser{}
	parser.parse_html(text)
	return parser.get_dom()
}

// parse_file parses and returns the DOM from the contents of a file.
pub fn parse_file(filename string) DocumentObjectModel {
	content := os.read_file(filename) or { return DocumentObjectModel{
		root: &Tag{}
	} }
	return parse(content)
}