J
James Jhfghgfhgf
Hey,
I've been having some trouble getting to grips with the various XML
libraries, I just want to put together a ruby script that will convert a
basic XML file into a nested array then just output that array to the
console.
The XML looks like this:
<vector>
<point>
<x>1018.550659</x>
<y>558.138367</y>
<z>102.505821</z>
</point>
<point>
<x>1013.557495</x>
<y>560.874878</y>
<z>107.041840</z>
</point>
<point>
<x>1008.563049</x>
<y>563.611267</y>
<z>111.577576</z>
</point>
</vector>
<vector>
<point>
<x>1030.809204</x>
<y>551.722961</y>
<z>86.581741</z>
</point>
<point>
<x>1027.500854</x>
<y>553.190613</y>
<z>95.061058</z>
</point>
</vector>
and I want to make it this:
[[[1018.550659],[558.138367],[102.505821]],[[1013.557495],[560.874878],[107.041840]],[[1008.563049],[563.611267],[111.577576]]],[[[1030.809204],[551.722961],[86.581741]],[[1027.500854],[553.190613],[95.061058]]]
Anyone know the best way to go about this?
Thanks very much!
I've been having some trouble getting to grips with the various XML
libraries, I just want to put together a ruby script that will convert a
basic XML file into a nested array then just output that array to the
console.
The XML looks like this:
<vector>
<point>
<x>1018.550659</x>
<y>558.138367</y>
<z>102.505821</z>
</point>
<point>
<x>1013.557495</x>
<y>560.874878</y>
<z>107.041840</z>
</point>
<point>
<x>1008.563049</x>
<y>563.611267</y>
<z>111.577576</z>
</point>
</vector>
<vector>
<point>
<x>1030.809204</x>
<y>551.722961</y>
<z>86.581741</z>
</point>
<point>
<x>1027.500854</x>
<y>553.190613</y>
<z>95.061058</z>
</point>
</vector>
and I want to make it this:
[[[1018.550659],[558.138367],[102.505821]],[[1013.557495],[560.874878],[107.041840]],[[1008.563049],[563.611267],[111.577576]]],[[[1030.809204],[551.722961],[86.581741]],[[1027.500854],[553.190613],[95.061058]]]
Anyone know the best way to go about this?
Thanks very much!