ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PArsing XML error

Solved!
Go to solution

HEllo Everyone,

 

I need to use XML to save some program data. In the attached example, I am saving a path to an XML file, so that my program remembers the latest Export folder used.

The format of this simple XML file is as follow:

<?xml version="1.0" encoding="UTF-8"?>
-<Config>
<ExportFolder>C:\Users\AJ\Desktop</ExportFolder>
</Config>

At some other point in my main program, an exception occurs when trying to update the XML file with a new  path location and i endup with the current XML :

<?xml version="1.0" encoding="UTF-8"?>
-<Config>
<ExportFolder/>
</Config>

I am currently trying to detect if the ExportFolder text node is empty then add a default path to it :

Capture.PNG

The if statement is working but I can't find a way to update the XML file and parse a next node under the ExportFolder Element.

 

Any help will be greatly appreciated.

 

Best regards,

AJ

 

0 Kudos
Message 1 of 4
(5,931 Views)

Not sure where the exportFolder text node is in your app, but cant you use the empty string? vi and if true wire a default path.  You can use hte select? vi if you dont want to use a case structure for this.  There is also a is path and not empty? vi if you node is a path.



-Matt
0 Kudos
Message 2 of 4
(5,904 Views)

Hello Matt,

 

I am indeed trying to " you use the empty string? vi and if true wire a default path."

My problem is that I can't append the closed tag with the new path.

Once this tag is closed :

<ExportFolder/>

I can't find a way to programmatically change it back to :

<ExportFolder>C:\</ExportFolder>
0 Kudos
Message 3 of 4
(5,882 Views)
Solution
Accepted by topic author M_AmineJ

Found a solution to this. for those who might have a similar issue, this worked for me :Capture.PNG

Message 4 of 4
(5,873 Views)