diff --git a/src/document.jl b/src/document.jl index 7f2b9a9..db75917 100644 --- a/src/document.jl +++ b/src/document.jl @@ -99,6 +99,9 @@ parse_file(filename::AbstractString, encoding, options::Integer) = parse_string(s::AbstractString) = _check_result(ccall((:xmlParseMemory,libxml2), Xptr, (Xstr, Cint), s, sizeof(s))) +parse_string(s::AbstractString, encoding, options::Integer) = + _check_result(ccall((:xmlReadMemory,libxml2), Xptr, (Cstring, Int, Cstring, Cstring, Int), + s, sizeof(s), "", encoding, options)) #### output diff --git a/test/parse.jl b/test/parse.jl index 4c3db0c..9684763 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -19,8 +19,10 @@ docstr = """ """ for xdoc = (parse_string(docstr), + parse_string(docstr, C_NULL, 64), # 64 == XML_PARSE_NOWARNING + parse_string(docstr, "UTF-8", 64), parse_file(joinpath(@__DIR__, "ex1.xml")), - parse_file(joinpath(@__DIR__, "ex1.xml"), C_NULL, 64), # 64 == XML_PARSE_NOWARNING + parse_file(joinpath(@__DIR__, "ex1.xml"), C_NULL, 64), parse_file(joinpath(@__DIR__, "ex1.xml"), "UTF-8", 64)) @test version(xdoc) == "1.0"