Создал класс для обработки xml файла посредством сериализации
public class Signals
{
[XmlArrayAttribute("SignalSource")]
public SignalSource[] Items;
}
public class SignalSource
{
[XmlAttribute] public string Name;
[XmlAttribute] public string LastValue;
[XmlAttribute] public string UpdateTime;
[XmlArrayAttribute("SignalSource")]
public SignalSource[] Items;
}
в итоге получаю
<?xml version="1.0" encoding="utf-8"?>
<Signals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SignalSource>
<SignalSource Name="name1" LastValue="lastvalue1" UpdateTime="updatetime1">
<SignalSource>
<SignalSource Name="name2" LastValue="lastvalue2" UpdateTime="updatetime2" />
<SignalSource Name="name3" LastValue="lastvalue3" UpdateTime="updatetime3" />
</SignalSource>
</SignalSource>
</SignalSource>
</Signals>
интересует как можно получить такой xml-файл
<?xml version="1.0" encoding="utf-8"?>
<Signals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SignalSource Name="name1" LastValue="lastvalue1" UpdateTime="updatetime1">
<SignalSource Name="name2" LastValue="lastvalue2" UpdateTime="updatetime2" />
<SignalSource Name="name3" LastValue="lastvalue3" UpdateTime="updatetime3" />
</SignalSource>
</Signals>