02-18-2021 09:00 AM
Hi
I seem to have trouble understanding how to properly instantiate and close XML blocks. While the attached program shows no initial errors, when running it i get an error about attempting to create an invalid document. Can someone give a simple explanation as for how do i close this kind on blocks or prompt me to where i can read further details about this issue? I have found the 'Help' function somewhat vague.
Thanks
Solved! Go to Solution.
02-18-2021 09:12 AM
You are closing your document inside the FOR loop. Remove the Close that is in the top level FOR loop.
02-18-2021 09:55 AM - edited 02-18-2021 09:55 AM
Ok, I did a little more digging and cleaning up. One of your main issues is that you need an overall element to put things into (XML is weird). After that, I did some more cleaning up and attached is the result. I didn't spend a lot of time cleaning, but I highly recommend you consider subVIs to eliminate duplicate code (such as the Add Element). I find it useful in these situations to line up things based on references (keep the reference wires as straight as possible instead of the error wire). It just makes it easier to keep track of the references.
02-18-2021 12:02 PM
Thanks for the details!