开发者

Downgrade XDocument and XmlReader to XmlDocument and XmlReader

I want to downgrade a Windows Mobile application made with .Net Compact Framework 3.5 to .Net Compact Framework 2.0 SP2.

But... I don't know how to make this piece of code compatible with version 2.0.

XDocument doc = XDocument.Load(string.Format(Open_Cell_Id_Uri, new object[]{
    Settings.OpenCellIDApiKey,
    towerDetails.MobileCountr开发者_Python百科yCode, 
    towerDetails.MobileNetworkCode, 
    towerDetails.TowerId,
    towerDetails.LocationAreaCode
    }));

using (System.Xml.XmlReader reader = doc.CreateReader())
{
     ...
}

I changed using System.Xml.Linq with using System.Xml but this line is complaining:

using (System.Xml.XmlReader reader = doc.CreateReader())

How can I obtain a XmlReader from a XmlDocument?

This is the code that I've downgraded:

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())//;
{
    ...
}

Thank you!


To create a node reader:

using (XmlReader reader = new XmlNodeReader(doc.DocumentElement)) {...}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜