Hello I just start to use Julia for programming. I have a XML dataset and used the EzXML package to get the data. The data is an N-element Vector{EzXML.Node}. For each EzXML.Node, it looks like this:
<event time="30000.0" type="actstart" person="200000" link="10000" x="40000.400" y="50000.500" actType="other_600.0"/>
<event time="60000.0" type="actend" person="400000" link="20000" x="50000.400" y="70000.500" actType="other_600.0"/>
....
By using EzXML.Node.name, I get “time”, or “type”, or “person”…
By using EzXML.Node.content, I get “30000.0”, or “actstart”, or “200000” …
My goal is to get a dictionary of the XML file.
The dictionary will look like this:
Dict{String, Int64} with 2 entries:
“time” => 30000.0, 60000.0, …
“type” => “actstart”, “attend”, …
“person” => 200000, 400000, …
“link” => 10000, 20000, …
“x” => 40000.400, 20000, …
“y” => 40000.400, 20000, …
“actType” = “other_600.0”, “other_600.0”, …
I try to use this to get the dictionary but end with only getting error.
s = (elements(root(testxml)))
for i in range(1, length(s)), j in range(1, length(attributes(s[i])))
contact_type1 = Dict()
if (occursin("actstart", string(s[i])) || (occursin("actend", string(s[i]))) ) && !occursin("interaction\"", string(s[i]))
(attributes(s[i]))[j].name = push!(keys(contact_type1), keys(contact_type1))
(attributes(s[i]))[j].content = push!(values(contact_type1) , values(contact_type1))
return(contact_type1)
end
end
contact_type1
Thank you for any help. I am also looking for some suggestions on courseS about Julia programming course.