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 https://virinco.zendesk.com/hc/en-us/articles/207424643-Wats-Standard-Xml-Format-WSXF-)

Here is an example:

<?xml version="1.0" encoding="utf-8" ?>
<TestReport>
  <Header>
    <SerialNumber>12345</SerialNumber>
    <PartNumber>Part1</PartNumber>
    <Revision>1.0</Revision>
    <StartDate>2017-04-20 12:01:30</StartDate>
    <ExecutionTime>20.5</ExecutionTime>
    <OperationTypeCode>50</OperationTypeCode>
    <Operator>Ragnar</Operator>
  </Header>
  <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>
  <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>
  </Sequence>
</TestReport>

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

XMLConverter (converter .dll)
and 
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

0 Comments

Please sign in to leave a comment.