Converter example to read from xml file C#

In this example, I will show a simple way to import data to WATS from an xml file. The format is not standard (like

Here is an example:

<?xml version="1.0" encoding="utf-8" ?>
    <StartDate>2017-04-20 12:01:30</StartDate>
  <Sequence Name="Startup">
    <NumericTest Name="Test1" Measure="4.56" LowLim="4" HighLim="5" Unit="V"/>
    <NumericTest Name="Test2" Measure="1000.766" LowLim="900" HighLim="1100" Unit="Ohm"/>
  <Sequence Name="Main">
    <NumericTest Name="Test1" Measure="555.7" LowLim="500" HighLim="600" Unit="V"/>
    <NumericTest Name="Test2" Measure="300.88" LowLim="310" HighLim="400" Unit="A"/>
    <StringTest Name="Software version" Measure="3.4" Limit="3.4"></StringTest>
    <PassFailTest Name="LED ok" Measure="True"></PassFailTest>

The source code to a converter can be downloaded from this article. It consist of two projects: 

XMLConverter (converter .dll)
TestConverter (.exe to debug the .dll in visual Studio. Arguments to the program: XMLConverter c:\tmp\*.xml). Set this as startup project. XML files in the c:\tmp folder will be imported.

To make it work, install the WATS client (check for Development), add a reference to Virinco.WATS.Interface.TDM (C:\Program Files\Virinco\WATS\DesignSupport)
To install it, look here: to Install converter
For another example, see here Converter example


Have more questions? Submit a request


Please sign in to leave a comment.