在没有XSLT的情况下使用ASP.NET控制台应用程序进行XML转换动态的哪种合适方式?

Nik*_*iya 6 xml asp.net console-application roku brightscript

首先,我在ASP.NET中成功创建了Web API。从另一台服务器获取XML的API。我找到了适合XML的所有格式更改。

我试图应用belove逻辑:

 using (XmlReader reader = XmlReader.Create("XML.xml"))
 {
    //String starttime,Endtime;
    while (reader.Read())
    {
        // Only detect start elements.
        if (reader.IsStartElement())
        {
            switch (reader.Name)
            {                           
                   case "EventInfo":
                   // Detect this element.
                   Console.WriteLine("Start <content> element.  ");
                   Console.WriteLine();
                   break;
             }
         }
     }
}
Run Code Online (Sandbox Code Playgroud)

这样,仅单个文件即可转换为另一个文件。我试图一次创建多个文件,然后转换为另一种格式。

我从Web API提供了以下格式数据,这是一种常规XML格式:

<EventInfo>
   <Event>
        <EventId>1</EventId>   
        <EventName>shedule-1</EventName>   
        <EventText>ch1 Channel Description</EventText> 
        <StartTime>00:00:00</StartTime>
        <Duration>00:30:00</Duration>
        <Date>20.06.2019</Date>
   </Event>
<EventInfo>
Run Code Online (Sandbox Code Playgroud)

我在标题标签中应用了Logic,它的开始时间+持续时间是我的结束时间,我同时在tile标签中显示EventName和Time。

这是它的ROKU格式XML:

<Content>

      //Here i only print the HH-MM.
      <item title="00:00 - 00:30 shedule-1" LIVE="true" streamformat="mov" description="ch1 Channel Description" realeasedate="20.06.2019" description-color="0xC36419"/>

<Content>
Run Code Online (Sandbox Code Playgroud)

任何人都知道哪种是转换XML的最佳方法。谢谢。