C# 将XDocument和XmlReader降级为XmlDocument和XmlReader
我想将使用.Net Compact Framework 3.5制作的Windows Mobile应用程序降级为.Net Compact Framework 2.0 SP2 但是。。。我不知道如何使这段代码与2.0版兼容C# 将XDocument和XmlReader降级为XmlDocument和XmlReader,c#,compact-framework,linq-to-xml,downgrade,C#,Compact Framework,Linq To Xml,Downgrade,我想将使用.Net Compact Framework 3.5制作的Windows Mobile应用程序降级为.Net Compact Framework 2.0 SP2 但是。。。我不知道如何使这段代码与2.0版兼容 XDocument doc = XDocument.Load(string.Format(Open_Cell_Id_Uri, new object[]{ Settings.OpenCellIDApiKey, towerDetails.MobileCountryCo
XDocument doc = XDocument.Load(string.Format(Open_Cell_Id_Uri, new object[]{
Settings.OpenCellIDApiKey,
towerDetails.MobileCountryCode,
towerDetails.MobileNetworkCode,
towerDetails.TowerId,
towerDetails.LocationAreaCode
}));
using (System.Xml.XmlReader reader = doc.CreateReader())
{
...
}
我使用System.Xml.Linq更改为使用System.Xml,但这行代码有问题:
using (System.Xml.XmlReader reader = doc.CreateReader())
如何从XmlDocument中获取XmlReader
这是我降级的代码:
XmlDocument doc = new XmlDocument();
doc.Load(string.Format(Open_Cell_Id_Uri, new object[]{
Settings.OpenCellIDApiKey,
towerDetails.MobileCountryCode,
towerDetails.MobileNetworkCode,
towerDetails.TowerId,
towerDetails.LocationAreaCode
}));
using (System.Xml.XmlReader reader = doc.CreateReader())//;
{
...
}
谢谢大家! 要创建节点读取器:
using (XmlReader reader = new XmlNodeReader(doc.DocumentElement)) {...}