Hi, I hope this is not a too naive question. I get confused about “XML_Parse” in LibExpat package.
The following is the function where it is actually used.
function parsefile(filename::AbstractString,callbacks::XPCallbacks; bufferlines=1024, data=nothing)
h = make_parser(callbacks, data)
# TODO: Support suspending for files too
suspended = false
file = open(filename, "r")
try
io = IOBuffer()
while !eof(file)
i::Int = 0
truncate(io, 0)
while i < bufferlines && !eof(file)
write(io, readline(file))
i += 1
end
txt = String(take!(copy(io)))
rc = XML_Parse(h.parser, txt, sizeof(txt), 0)
if (rc != XML_STATUS_OK) && (XML_GetErrorCode(h.parser) != XML_ERROR_ABORTED)
# Do not fail if the user aborted the parsing
error("Error parsing document : $rc")
end
if XML_GetErrorCode(h.parser) == XML_ERROR_ABORTED
break
end
end
rc = XML_Parse(h.parser, "", length(""), 1)
#if (rc == XML_STATUS_SUSPENDED)
# suspended = true
# return XPStreamHandler(callbacks, parser)
#end
if (rc != XML_STATUS_OK) && (XML_GetErrorCode(h.parser) != XML_ERROR_ABORTED)
# Do not fail if the user aborted the parsing
error("Error parsing document : $rc")
end
catch e
stre = string(e)
(err, line, column, pos) = xp_geterror(h.parser)
rethrow("$e, $err, $line, $column, $pos")
finally
if !suspended
XML_ParserFree(h.parser)
end
close(file)
end
end
I tried the following in REPL.
Julia> using LibExpat
help?> XML_Parse
search:
Couldn't find XML_Parse
Perhaps you meant xp_parse
No documentation found.
Building XML_Parse does not exist.
Then, I tried to install the other two modules “Pkg.Artifacts
” and “Expat_jl
”, as these two have appeared like “using Pkg.Artifacts
”, and “using Expat_jll
” in the file LibExpat.jl
. The following is what happened.
(v1.0) pkg> add Pkg.Artifacts
Updating registry at `~/.Julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Cloning git-repo `Pkg.Artifacts`
ERROR: failed to clone from Pkg.Artifacts, error: GitError(Code:ERROR, Class:Net, unsupported URL protocol)
and
(v1.0) pkg> add Expat_jll
Resolving package versions
ERROR: Unsatisfiable requirements detected for package Expat_jll [2e619515]:
Expat_jll [2e619515] log:
possible versions are: 2.2.7 or uninstalled
restricted to versions * by an explicit requirement, leaving only versions 2.2.7
restricted by Julia compatibility retirements to versions: uninstalled - no versions left.
Any comments are greatly appreciated.