Jump to content

Read/write setup-xml-file


Arne

Recommended Posts

Hello

 

This is my first post in this forum, thank you for accepting me...

 

XML is a brand new area for me (and I haven't coding LabVIEW for years either). I have tested the eval copy of EasyXML and I'm impressed (and I will buy an EasyXML-license before the end of May...)

 

I'm working on a application that uses a xml-file as a setup for an instrument. What I want is to read the xml-file, pick out a few parameters from the file, change them and write the xml-file back to disk before the instrument-software reads the (modified) xml-file.

 

I found it easy to pick out my parameters by using EasyXml and also change them but I haven't figured out how to write the file back to disk without building a huge cluster. The original xml-setup-file has over 800 elements.

 

I attach a simple VI to show what I am trying to do

 

Any ideas ? Thanks from Sweden...

 

/Arne

JKI_forum.vi

Link to comment
Share on other sites

Hello Arne,

 

Greetings from the United States and welcome to the JKI discussion forums! We're glad you've joined us :)

 

Yes, I see what you're trying to do -- you wish to modify only a subset of an XML data structure (string). EasyXML does support parsing a subset of an XML data structure but the XML it generates is "1 to 1" -- the output XML string contains exactly what is in the input cluster.

 

Modifying a subset of the XML string is a feature that we're considering for a future release.

 

In the mean time, you might consider using the MSXML parser to poke at the value you need to change. I've written an example that modifies the baud rate in your example XML string (see attachments, below).

 

Please, let me know if you have any questions about this example. And let me know how your project goes -- I'm happy to provide pointers for using EasyXML and/or MSXML and want to hear about your successes and issues in using XML.

 

Thanks,

 

-Jim

 

 

Example VI (LabVIEW 8.5)

Set_Baud_Rate_using_MSXML.vi

Front Panel

Set_Baud_Rate_using_MSXML___FP.png

 

Block Diagram

Set_Baud_Rate_using_MSXML___BD.png

Link to comment
Share on other sites

Hello Jim

 

Thank you... It was exactly what I needed. :)

 

Project 1: We have a VB6-application which simplifies handling the software (and one of the instruments) on our research vessel. My plans for the future is to rebuild the application using LabVIEW instead of VB6. One of the essential parts of the application is to make changes in the instrument (software-) setup, so reading, make changes and writing to the xml-setup-file (and using LabVIEW for that) is one of the first step in the transformation... and yes the instrument supplier has recently change the setup-files to xml so we're still running an old software...

 

Project 2: We also have a "on the way"-system, picking out NMEA-data (position, depth, heading and so on), collecting the data together with oceanographical and meteorological data, saving them on board and also sending them to HQ via satellite (ftp and/or satellite-modem) entirely built in LabVIEW...

 

 

Once again, thank you for the help

 

 

/Arne

Link to comment
Share on other sites

Hello Arne,

 

> Thank you... It was exactly what I needed. :D

You're very welcome. I'm glad the example helped.

> collecting the data together with oceanographical and meteorological data, saving them on board and also sending them to HQ via satellite

 

That sounds like a very interesting and cool application, and I'm happy to hear that EasyXML will be part of your system :)

 

Please let us know if you have any more questions, issues, or ideas for how we can make EasyXML better.

 

Thanks,

 

-Jim

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.