LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save XML File Error

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

0 Kudos
Message 1 of 5
(3,424 Views)

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

 

District Sales Engineer
0 Kudos
Message 2 of 5
(3,412 Views)

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

0 Kudos
Message 3 of 5
(3,400 Views)
Shot in the dark: Can you use the Get XML(pretty print) method and the Write To Text File function instead?
0 Kudos
Message 4 of 5
(3,397 Views)

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

0 Kudos
Message 5 of 5
(3,389 Views)