C# 如何在UWP中使用XMLDocument.SelectNodes

C# 如何在UWP中使用XMLDocument.SelectNodes,c#,uwp,xmldocument,C#,Uwp,Xmldocument,我是UWP应用程序编程的初学者,但我懂c。我的问题是,既然定义不存在,我如何在UWP应用程序中使用selectnodes。。。我将如何解决这个问题?谢谢 这是我的代码,如果需要的话 XmlDocument responseXML = new XmlDocument(); responseXML.LoadXml(response); string innerText = responseXML.SelectNodes("//maininfo").Item(0).InnerText; respon

我是UWP应用程序编程的初学者,但我懂c。我的问题是,既然定义不存在,我如何在UWP应用程序中使用selectnodes。。。我将如何解决这个问题?谢谢

这是我的代码,如果需要的话

XmlDocument responseXML = new XmlDocument();
responseXML.LoadXml(response);

string innerText = responseXML.SelectNodes("//maininfo").Item(0).InnerText;
responseXML.LoadXml(innerText);

info1 = responseXML.GetElementsByTagName("upnp:info1").Item(0).InnerText;
info2 = responseXML.GetElementsByTagName("upnp:info2").Item(0).InnerText;
info3 = responseXML.GetElementsByTagName("dc:info3").Item(0).InnerText;
info4 = responseXML.GetElementsByTagName("dc:info4").Item(0).InnerText;
既然定义不存在,我如何在UWP应用程序中使用selectnodes。。。我将如何解决这个问题

问题是您对
XmlDocument
使用了错误的命名空间(
System.Xml
)。请使用
Windows.Data.Xml.Dom
namespace。有关更多信息,请参阅班级官方文档

using Windows.Data.Xml.Dom;

......

XmlDocument responseXML = new XmlDocument();
responseXML.LoadXml(response);
string innerText = responseXML.SelectNodes("//maininfo").Item(0).InnerText;
这是,请查收

既然定义不存在,我如何在UWP应用程序中使用selectnodes。。。我将如何解决这个问题

问题是您对
XmlDocument
使用了错误的命名空间(
System.Xml
)。请使用
Windows.Data.Xml.Dom
namespace。有关更多信息,请参阅班级官方文档

using Windows.Data.Xml.Dom;

......

XmlDocument responseXML = new XmlDocument();
responseXML.LoadXml(response);
string innerText = responseXML.SelectNodes("//maininfo").Item(0).InnerText;

这是,请检查。

缩进已关闭。。使这个问题更容易理解,因为我的答案是否定的。。使问题更具可读性