Hello!
Suppose I have:
using LightXML
e = new_element("a")
e_arr = [e;e]
How would I then go about converting e_arr from Array{LightXML,1} to LightXML?
Kind regards
Hello!
Suppose I have:
using LightXML
e = new_element("a")
e_arr = [e;e]
How would I then go about converting e_arr from Array{LightXML,1} to LightXML?
Kind regards
I am using a unusual XML package in Julia or is what I am trying to do unusual?
I want to gather a lot of different XML elements, before combining them to one…
Kind regards
The problem is, what you are trying to do here cannot work. You cannot add the same element twice to an XML document without cloning it.
The following code works:
using LightXML
e1 = new_element("a")
e2 = new_element("a")
e_arr = [e1; e2]
xdoc = XMLDocument()
# create & attach a root node
xroot = create_root(xdoc, "Elements")
for elem in e_arr
add_child(xroot, elem)
end
println(xroot)
Output:
<Elements>
<a/>
<a/>
</Elements>
I see, I suppose my approach was wrong. I have followed the example and done the way you propose.
Kind regards