Skip to content

Commit 9562c0b

Browse files
committed
Call xmlSubstituteEntitiesDefault before parsing
Given that LightXML does not support XML Entities, asking LibXML to expand entities while parsing seems like the right thing to do...
1 parent 9407ad0 commit 9562c0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/document.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,22 @@ end
8585
#### parse and free
8686

8787
function parse_file(filename::AbstractString)
88+
ccall((:xmlSubstituteEntitiesDefault, libxml2), Cint, (Cint,), 1)
8889
p = ccall((:xmlParseFile,libxml2), Xptr, (Cstring,), filename)
8990
p != C_NULL || throw(XMLParseError("Failure in parsing an XML file."))
9091
XMLDocument(p)
9192
end
9293

9394
function parse_file(filename::AbstractString, encoding, options::Integer)
95+
ccall((:xmlSubstituteEntitiesDefault, libxml2), Cint, (Cint,), 1)
9496
p = ccall((:xmlReadFile,libxml2), Xptr, (Cstring, Ptr{Cchar}, Cint),
9597
filename, encoding, options)
9698
p != C_NULL || throw(XMLParseError("Failure in parsing an XML file."))
9799
XMLDocument(p)
98100
end
99101

100102
function parse_string(s::AbstractString)
103+
ccall((:xmlSubstituteEntitiesDefault, libxml2), Cint, (Cint,), 1)
101104
p = ccall((:xmlParseMemory,libxml2), Xptr, (Xstr, Cint), s, sizeof(s) + 1)
102105
p != C_NULL || throw(XMLParseError("Failure in parsing an XML string."))
103106
XMLDocument(p)

0 commit comments

Comments
 (0)