# What exactly is this XML\_Parse in the LibExpat package?

**URL:** <https://discourse.julialang.org/t/what-exactly-is-this-xml-parse-in-the-libexpat-package/29399>\
**Category:** General Usage\
**Created:** [October 2, 2019, 12:01pm UTC](https://discourse.julialang.org/t/what-exactly-is-this-xml-parse-in-the-libexpat-package/29399 "2019-10-02T12:01:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 2, 2019, 12:01pm UTC](https://discourse.julialang.org/t/what-exactly-is-this-xml-parse-in-the-libexpat-package/29399/1 "2019-10-02T12:01:14Z")

</div>

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.

```julia
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
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.

```julia
(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

```julia
(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.

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 3, 2019, 12:11pm UTC](https://discourse.julialang.org/t/what-exactly-is-this-xml-parse-in-the-libexpat-package/29399/2 "2019-10-03T12:11:15Z")

</div>

@ [Bartosz\_Pankratz](https://discourse.julialang.org/u/Bartosz_Pankratz) Hope you can share some lights…
