From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-27-2015 01:05 AM
I am able to write datas to XML file. But when I am writing inside loop then for second loop it is generating issue and giving error. attached VI which will update for single run successfully. Let me know where is issue
10-27-2015 03:27 AM
This VI works, but in single run and if placed in a loop, so i can't reproduce your issue. Do you manage to close the XML ref in the loop?
/Y
10-27-2015 03:47 AM
Ok take this VI which I wrote for writing in loop.
10-27-2015 04:06 AM
If you unravel the loop you'll notice it's the 2nd Testdata that's causing the error.
/Y
10-27-2015 04:06 AM
If you unwrap the loop you'll notice it's the 2nd Testdata that's causing the error.
/Y
10-27-2015 04:12 AM
I guess where tag is boxno where issue is coming. Let me know how to resolve it
10-28-2015 03:20 PM
@Ranjeet_Singh wrote:
I guess where tag is boxno where issue is coming. Let me know how to resolve it
The problem is your XML tree structure, you must have a single root element. Create a TestSession element before the for loop and the last thing to do in this loop is to append the TestData node to this element. After the loop you append the TestSession element to the document.
Ben64
10-29-2015 10:45 AM
@ben64 wrote:
The problem is your XML tree structure, you must have a single root element. Create a TestSession element before the for loop and the last thing to do in this loop is to append the TestData node to this element. After the loop you append the TestSession element to the document.
Ben64
Note that the TestSession node can be appended to the document immediatly after its creation, which is probably better. Then you just close its reference after the loop.
Ben64
10-29-2015 12:20 PM
XML is an interesting format -- it is "human-readable", seems to "map" reasonably well with LabVIEW data types (various representations of numbers, booleans, strings, paths, arrays, clusters), and there are several (at least 4, I think) implementations of it available for LabVIEW.
What's also interesting is that (possibly because of its "open" nature) there is no set way that XML is generated and parsed, and the resulting file formats are often not compatible with each other. This need not be an issue if you are doing the reading and writing, but can make it a little less "portable".
Another interesting thing that I've noticed is that the "model" of how (several) XML systems seem to work is that the file is open, a single Write of "Everything" is done, and the file is closed, with Reading/parsing largely the inverse of this. In particular, the notion of opening a file and "streaming" data in XML format as it is being generated does not seem to "fit" the usual model.
Fortunately, with at least two XML packages (EasyXML from JKI Software, and NI-GXML, from the LabVIEW Tools Network), it is possible to "extend" this model and to allow for such streaming. In addition, both packages allow a very "intuitive" way to write and read/parse XML in flexible ways. I'm less familiar with the version of XML that ships with LabVIEW, and haven't looked carefully at LabXML.
Bob Schor