05-10-2011 11:55 PM
I was trying to replace a Node in an XML file (see attached VI - LV 2010), but for some reason the Load or Save XML VI's are changing the format of the XML Header (only by a couple of \n characters, but enough for the application reading the XML file to say it is corrupt). In the Load XML VI I have left all the Inputs at their default values (ie. Preserve Whitespace) so why is the file being modified?
What the original file header contents look like.....
<?xml version="1.0" encoding="iso8859-1" standalone="no" ?>
<METRONFile Type="Record" Version="2.0.1">
<Application Name="Ansur" Version="2.9.4">
What the Header looks like after using the LabVIEW Load/Save XML VI's.
<?xml version="1.0" encoding="iso8859-1" standalone="no" ?><METRONFile Type="Record" Version="2.0.1">
<Application Name="Ansur" Version="2.9.4">
Chris
05-12-2011 01:41 PM
Good afternoon Chris,
Have you tried opening the NI_XML.lvlib:Load XML File.vi block diagram? There is a preserve whitespace option. Have you tried playing with that to see if it will affect your errors? If that does not help, please post back and I will try it on my end to see if I can replicate the error. Thanks!
~kgarrett
05-12-2011 08:40 PM
Believe me I have tried all possible variations of the inputs to the NI_XML.lvlib:Load XML File.vi, none of them make a difference. Also the Block Diagram of this VI doesn't help much since it is just a couple of Property and Invoke Nodes so nothing to debug really.
I have attached the XML file that we are working with if you want to experiment - thanks
Note: I had to change the extension of the attached file from *.mtr to *.txt since the website says it is not a valid extension for an attachment.
Chris
05-12-2011 09:04 PM
05-12-2011 11:01 PM
OK that did work (see attached VI) - it also works if I just use the GetXML Method. This would suggest the problem lies with the NI_XML.lvlib:Save.VI.
Unfortunately don't I have to use the XML Save VI if I'm inserting/changing Node values, since I am parsing the DOM Document Out Reference when I Load up the XML File?
Chris