다운 그레이드 XDocument 및 XmlReader를 XMLDocument 및 XMLReader로 다운 그레이드합니다

StackOverflow https://stackoverflow.com/questions/1716294

문제

다운 그레이드 a Windows Mobile 신청서 .NET 소형 프레임 워크 3.5 에게 .NET 소형 프레임 워크 2.0 SP2.

그러나 ...이 코드를 버전 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())
{
     ...
}

System.xml을 사용하여 System.xml.linq을 사용하여 변경했지만이 라인은 불평합니다.

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)) {...}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top