@@ -1080,7 +1080,7 @@ end
1080
1080
# ----------
1081
1081
1082
1082
function Base. getindex (node:: Node , attr:: AbstractString )
1083
- i = searchindex (attr, ' :' )
1083
+ i = findfirstchar ( ' :' , attr )
1084
1084
if i == 0
1085
1085
str_ptr = ccall (
1086
1086
(:xmlGetNoNsProp , libxml2),
@@ -1109,7 +1109,7 @@ function Base.getindex(node::Node, attr::AbstractString)
1109
1109
end
1110
1110
1111
1111
function Base. haskey (node:: Node , attr:: AbstractString )
1112
- i = searchindex (attr, ' :' )
1112
+ i = findfirstchar ( ' :' , attr )
1113
1113
if i == 0
1114
1114
prop_ptr = ccall (
1115
1115
(:xmlHasNsProp , libxml2),
@@ -1143,7 +1143,7 @@ function Base.setindex!(node::Node, val, attr::AbstractString)
1143
1143
end
1144
1144
1145
1145
function Base. delete! (node:: Node , attr:: AbstractString )
1146
- i = searchindex (attr, ' :' )
1146
+ i = findfirstchar ( ' :' , attr )
1147
1147
if i == 0
1148
1148
# This function handles attributes in no namespace.
1149
1149
ccall (
@@ -1165,6 +1165,14 @@ function Base.delete!(node::Node, attr::AbstractString)
1165
1165
return node
1166
1166
end
1167
1167
1168
+ function findfirstchar (char:: Char , str:: AbstractString )
1169
+ @static if VERSION > v " 0.7-"
1170
+ return first (findfirst (equalto (char), str))
1171
+ else
1172
+ return searchindex (str, char)
1173
+ end
1174
+ end
1175
+
1168
1176
1169
1177
# Namespaces
1170
1178
# ----------
0 commit comments