C# c读取带有名称空间问题的xml
我想阅读rss/channel/itunes:subtitle中的值 xml:参见 我试过:C# c读取带有名称空间问题的xml,c#,xml,namespaces,C#,Xml,Namespaces,我想阅读rss/channel/itunes:subtitle中的值 xml:参见 我试过: System.Xml.XmlDocument pd = new System.Xml.XmlDocument(); pd.Load(podcasterUrl); XmlElement resultt = pd.DocumentElement; XmlNamespaceManager mgr = new XmlNamespaceManager(pd.NameTable); mgr.AddNamespace
System.Xml.XmlDocument pd = new System.Xml.XmlDocument();
pd.Load(podcasterUrl);
XmlElement resultt = pd.DocumentElement;
XmlNamespaceManager mgr = new XmlNamespaceManager(pd.NameTable);
mgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd");
XmlNode nodeS = resultt.SelectSingleNode("/rss/channel/itunes:subtitle", mgr);
string subtitle = nodeS.InnerText.ToString();
副标题为:
This is the official ...
但在XML中是这样的
Representing the ...
有人能帮我吗?使用你的代码,我收到了副标题,作为舞蹈音乐中较难的风格的代表。我检查了你的代码,我得到了较难的风格的代表。。。也可能因为摘要和副标题而有点混乱?好的,问题是我使用了另一个xml文件,而不是数据库中的。它起作用了!使用你的代码,我收到了副标题,作为舞蹈音乐中较难的风格的代表。我检查了你的代码,我得到了较难的风格的代表。。。也可能因为摘要和副标题而有点混乱?好的,问题是我使用了另一个xml文件,而不是数据库中的。它起作用了!