小编mar*_*n32的帖子

为什么XDocument.Parse抛出NotSupportedException?

我试图使用XDocument.Parse wchich解析xml数据抛出NotSupportedException,就像在主题中一样:Windows Phone 7中的XDocument.Parse是否不同?我根据发布的建议更新了我的代码,但它仍然无济于事.前段时间我使用类似(但更简单)的方法解析RSS,并且工作得很好.

public void sList()
        {

            WebClient client = new WebClient();

            client.Encoding = Encoding.UTF8;
            string url = "http://eztv.it";
            Uri u = new Uri(url);
            client.DownloadStringAsync(u);
            client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);


        }

    private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        try
        {
            string s = e.Result;
            s = cut(s);

            XmlReaderSettings settings = new XmlReaderSettings();
            settings.DtdProcessing = DtdProcessing.Ignore;


            XDocument document = null;// XDocument.Parse(s);//Load(s);
            using (XmlReader reader = XmlReader.Create(new StringReader(e.Result), settings))
            {
                document = XDocument.Load(reader); // error thrown here
            }

            // ... …
Run Code Online (Sandbox Code Playgroud)

c# silverlight linq-to-xml windows-phone-7

4
推荐指数
1
解决办法
2058
查看次数

Nuget包在Visual Studio中无法正常工作

我正在使用VS 2010 Express for Windows phone开始编写Windows Phone应用程序.然后我安装了VS 2012,我制作了一个使用RestSharp消耗JSON/REST服务的桌面应用程序.由于缺乏对Express版本插件的支持,我得到了完整的VS 2010 Ultimate并安装了Nuget.当我创建一个win手机库项目,并添加一个RestSharp软件包时,它显示在References中,但是我无法访问它的任何类(并且使用RestSharp以红色加下划线).此外,当我删除它并从添加引用再次添加时,我得到一个不兼容的引用错误窗口:

RestSharp.WindowsPhone, Version=103.2.0.0, Culture=neutral, PublicKeyToken=null" is incompatible with 
Windows Phone 7.1
In order to add it yourself you should to change the project's terget to a compatible framework first.
Run Code Online (Sandbox Code Playgroud)

如果我将目标更改为WP 7.0,也会出现.

有人解决了类似的问题吗?

.net c# visual-studio-2010 windows-phone-7

3
推荐指数
1
解决办法
6002
查看次数