views:

409

answers:

1

Hello!

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.MobileCountryCode, 
    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!

+2  A: 

To create a node reader:

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