代码

public SortedDictionary<string, object> FromXml(string xml)
    {
        SortedDictionary<string, object> m_values = new SortedDictionary<string, object>();
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xml);
        XmlNode xmlNode = xmlDoc.FirstChild;//获取到根节点<xml>
        XmlNodeList nodes = xmlNode.ChildNodes;
        foreach (XmlNode xn in nodes)
        {
            XmlElement xe = (XmlElement)xn;
            m_values[xe.Name] = xe.InnerText;//获取xml的键值对到WxPayData内部的数据中
        }
        return m_values;
    }

 

相关文章:

  • 2021-10-25
  • 2021-08-30
  • 2022-01-09
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
相关资源
相似解决方案