Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated methods #84

Merged
merged 1 commit into from
Aug 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions src/EzXML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,45 +133,4 @@ function __init__()
init_error_handler()
end


# Deprecation
# -----------

function Base.read(::Type{Document}, filename::AbstractString)
Compat.@warn "read(Document, filename) is deprecated, use readxml(filename) or readhtml(filename) instead"
if endswith(filename, ".html") || endswith(filename, ".htm")
return readhtml(filename)
else
return readxml(filename)
end
end

function Base.parse(::Type{Document}, inputstring::AbstractString)
Compat.@warn "parse(Document, string) is deprecated, use parsexml(string) or parsehtml(string) instead"
if is_html_like(inputstring)
return parsehtml(inputstring)
else
return parsexml(inputstring)
end
end

function Base.parse(::Type{Document}, inputdata::Vector{UInt8})
return parse(Document, String(inputdata))
end

# Try to infer whether an input is formatted in HTML.
function is_html_like(inputstring)
if ismatch(r"^\s*<!DOCTYPE html", inputstring)
return true
elseif ismatch(r"^\s*<\?xml", inputstring)
return false
end
i = searchindex(inputstring, "<html")
if 0 < i < 100
return true
else
return false
end
end

end # module