How to read XML node from URL using C#?

前端 未结 2 1482
小蘑菇
小蘑菇 2021-01-26 10:45

I\'m having program like below. The concept is Read XML value from URL, but my program read the xml structure only, not the code datas. Like

2条回答
  •  囚心锁ツ
    2021-01-26 11:03

    First download the XML. Then Use like,

      try { 
        //read xml
        XmlDocument xdoc = new XmlDocument();
        xdoc.Load("XMLFilePath");
        XmlNodeList nodes = xdoc.SelectNodes(@"rss/channel/item");
        foreach (XmlNode node in nodes)
        {
          XmlNode titleNode = node.SelectSingleNode("title");
          string title = titleNode == null ? string.Empty : titleNode.InnerText;
    
          };
    

    }

提交回复
热议问题