Skip to content

Commit ec57b73

Browse files
committed
add parse_file with options
1 parent da4544c commit ec57b73

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/document.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ function parse_file(filename::AbstractString)
9090
XMLDocument(p)
9191
end
9292

93+
function parse_file(filename::AbstractString, encoding, options::Integer)
94+
p = ccall((:xmlReadFile,libxml2), Xptr, (Cstring, Ptr{Cchar}, Cint),
95+
filename, encoding, options)
96+
p != C_NULL || throw(XMLParseError("Failure in parsing an XML file."))
97+
XMLDocument(p)
98+
end
99+
93100
function parse_string(s::AbstractString)
94101
p = ccall((:xmlParseMemory,libxml2), Xptr, (Xstr, Cint), s, sizeof(s) + 1)
95102
p != C_NULL || throw(XMLParseError("Failure in parsing an XML string."))

0 commit comments

Comments
 (0)