aboutsummaryrefslogtreecommitdiff
path: root/core/encoding/xml/xml_os.odin
blob: 1e94572c69301f83c300371e24e2fc7a43b5d9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#+build !freestanding
#+build !js
package encoding_xml

import "core:os"

// Load an XML file
load_from_file :: proc(filename: string, options := DEFAULT_OPTIONS, error_handler := default_error_handler, allocator := context.allocator) -> (doc: ^Document, err: Error) {
	context.allocator = allocator
	options := options

	data, data_err := os.read_entire_file(filename, allocator)
	if data_err != nil { return {}, .File_Error }

	options.flags += { .Input_May_Be_Modified }

	return parse_bytes(data, options, filename, error_handler, allocator)
}