Skip to content

Commit

Permalink
fix #26
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Sep 3, 2024
1 parent 5e26b40 commit eb68531
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/XML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Base.push!(a::Node, b::Node) = push!(a.children, b)
Base.setindex!(o::Node, val, key::AbstractString) = (o.attributes[key] = string(val))
Base.getindex(o::Node, val::AbstractString) = o.attributes[val]
Base.haskey(o::Node, key::AbstractString) = isnothing(o.attributes) ? false : haskey(o.attributes, key)
Base.keys(o::Node) = isnothing(o.attributes) ? () : keys(o.attributes)

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

Expand Down
14 changes: 7 additions & 7 deletions src/raw.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#-----------------------------------------------------------------------------# RawType
"""
RawType:
- RawText # text
- RawComment # <!-- ... -->
- RawCData # <![CData[...]]>
- RawDeclaration # <?xml attributes... ?>
- RawText # text
- RawComment # <!-- ... -->
- RawCData # <![CData[...]]>
- RawDeclaration # <?xml attributes... ?>
- RawProcessingInstruction # <?NAME attributes... ?>
- RawDTD # <!DOCTYPE ...>
- RawDTD # <!DOCTYPE ...>
- RawElementOpen # <NAME attributes... >
- RawElementClose # </NAME>
- RawElementSelfClosed # <NAME attributes... />
- RawDocument # Something to initialize with (not really used)
- RawElementSelfClosed # <NAME attributes... />
- RawDocument # Something to initialize with (not really used)
"""
@enum(RawType, RawDocument, RawText, RawComment, RawCData, RawProcessingInstruction,
RawDeclaration, RawDTD, RawElementOpen, RawElementClose, RawElementSelfClosed)
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ end

#set/get index for attributes
o = doc[end]
@test isempty(keys(o))
o["id"] = 1
@test o["id"] == "1"
@test keys(o) == keys(Dict("id" => "1"))
end

#-----------------------------------------------------------------------------# Issues
Expand Down

0 comments on commit eb68531

Please sign in to comment.