Skip to content

Commit eb68531

Browse files
committed
fix #26
1 parent 5e26b40 commit eb68531

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/XML.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Base.push!(a::Node, b::Node) = push!(a.children, b)
206206
Base.setindex!(o::Node, val, key::AbstractString) = (o.attributes[key] = string(val))
207207
Base.getindex(o::Node, val::AbstractString) = o.attributes[val]
208208
Base.haskey(o::Node, key::AbstractString) = isnothing(o.attributes) ? false : haskey(o.attributes, key)
209+
Base.keys(o::Node) = isnothing(o.attributes) ? () : keys(o.attributes)
209210

210211
Base.show(io::IO, o::Node) = _show_node(io, o)
211212

src/raw.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#-----------------------------------------------------------------------------# RawType
22
"""
33
RawType:
4-
- RawText # text
5-
- RawComment # <!-- ... -->
6-
- RawCData # <![CData[...]]>
7-
- RawDeclaration # <?xml attributes... ?>
4+
- RawText # text
5+
- RawComment # <!-- ... -->
6+
- RawCData # <![CData[...]]>
7+
- RawDeclaration # <?xml attributes... ?>
88
- RawProcessingInstruction # <?NAME attributes... ?>
9-
- RawDTD # <!DOCTYPE ...>
9+
- RawDTD # <!DOCTYPE ...>
1010
- RawElementOpen # <NAME attributes... >
1111
- RawElementClose # </NAME>
12-
- RawElementSelfClosed # <NAME attributes... />
13-
- RawDocument # Something to initialize with (not really used)
12+
- RawElementSelfClosed # <NAME attributes... />
13+
- RawDocument # Something to initialize with (not really used)
1414
"""
1515
@enum(RawType, RawDocument, RawText, RawComment, RawCData, RawProcessingInstruction,
1616
RawDeclaration, RawDTD, RawElementOpen, RawElementClose, RawElementSelfClosed)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ end
201201

202202
#set/get index for attributes
203203
o = doc[end]
204+
@test isempty(keys(o))
204205
o["id"] = 1
205206
@test o["id"] == "1"
207+
@test keys(o) == keys(Dict("id" => "1"))
206208
end
207209

208210
#-----------------------------------------------------------------------------# Issues

0 commit comments

Comments
 (0)