downgrade xdocument و xmlReader إلى xmldocument و xmlReader
-
19-09-2019 - |
سؤال
اريد انخفض ويندوز موبايل تطبيق صنع مع .NET Framework المدمجة 3.5 ل .NET Framework Framework 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.linq باستخدام System.xml ولكن هذا الخط يشكو:
using (System.Xml.XmlReader reader = doc.CreateReader())
كيف يمكنني الحصول على XMLReader من xmldocument؟
هذا هو الكود الذي قمت بتخفيضه:
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)) {...}
لا تنتمي إلى StackOverflow