Skip to content

Commit

Permalink
DataStructures 0.10.0 is not available yet
Browse files Browse the repository at this point in the history
  • Loading branch information
samoconnor committed Jul 19, 2018
1 parent 24b1603 commit b903553
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.7-DEV.1393
Compat 0.60.0
EzXML
DataStructures 0.10.0
DataStructures
IterTools
7 changes: 5 additions & 2 deletions src/XMLDict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,11 @@ function dict_xml(root::AbstractDict)
string("<?xml", attr_xml(root), "?>\n", node_xml(root))
end

attrs(node::AbstractDict) = filter(pair->isa(first(pair), Symbol), node)
nodes(node::AbstractDict) = filter(pair->!isa(first(pair), Symbol), node)
# FIXME: We can go back to using filter instead of filter! once
# https://github.com/JuliaCollections/DataStructures.jl/issues/400 is fixed.
# Calling filter! with copy is equivalent but inefficient.
attrs(node::AbstractDict) = filter!(pair->isa(first(pair), Symbol), copy(node))
nodes(node::AbstractDict) = filter!(pair->!isa(first(pair), Symbol), copy(n

function attr_xml(node::AbstractDict)
join([" $n=\"$v\"" for (n,v) in attrs(node)])
Expand Down

0 comments on commit b903553

Please sign in to comment.