-1

I have an XML file. I want C # with the desktop application. There are similar solutions on the site. But I can't read with the XML I have. How should I proceed about this?

    <?xml version="1.0"?>
    <RealTimeMetrics  SiteId="Site ID">
    <Properties>
    <Version>3</Version>
    <TransmitTime>1581582053</TransmitTime>
    <MacAddress>00:b0:9d:23:72:f0</MacAddress>
    <IpAddress>192.168.1.99</IpAddress>
    <HostName>Cam-19100400</HostName>
    <HttpPort>80</HttpPort>
    <HttpsPort>443</HttpsPort>
    <Timezone>3</Timezone>
    <TimezoneName>(GMT 03:00) Nairobi</TimezoneName>
    <DST>0</DST>
    <HwPlatform>2500</HwPlatform>
    <SerialNumber>19100400</SerialNumber>
    <DeviceType>0</DeviceType>
    <SwRelease>4.1.4005.2249</SwRelease>
    </Properties>
    <RTReport  Date="2020-02-13T11:20:53">
    <RTObject  Id="0" DeviceId="Demo" Devicename="Demo" ObjectType="0" Name="TEST">
    <RTCount  TotalEnters="0" TotalExits="0"/>
    </RTObject>
    </RTReport>
    </RealTimeMetrics>
Sefa DEDE
  • 5
  • 1

1 Answers1

2

I used simple solution to read and edit XML file:

 XmlDocument xmlDoc = new XmlDocument();
 xmlDoc.Load("path\to\file.xml");
 XmlNode node = xmlDoc.SelectSingleNode("//nodeName");
 node.InnerText = value;
 xmlDoc.Save("path\to\file.xml");

You can load this file, read single node or all nodes, change value of InnerText or Add Atributes, end save this file

Russel
  • 36
  • 1