XML多媒体内容下载

发布于 2024-12-13 19:31:09 字数 390 浏览 4 评论 0 原文

我想知道读取 xml 文件并将内容保存在 Windows Phone 内存中的最佳方法。

xml 可以在此链接中找到:

http://dl.dropbox.com/u/32613258 /xml_example.xml

xml 文件包含指向视频、图像和声音等多媒体文件的链接。我已经将 xml 文件下载到存储手机中,并且我知道如何读取该文件,但我不知道如何读取内容并将其保存到存储手机中。

我想从内存中读取xml并选择xml中的所有链接,然后将图像、视频和声音下载到内存中。最好的方法是什么?我将文件保存在独立存储中,可以保存在卡内存中吗?

I iwant to know the best way to read an xml file and save the content in a windows phone memory.

The xml is available in this link:

http://dl.dropbox.com/u/32613258/xml_example.xml

The xml file have links to multimedia files like videos, images and sound. I already make the download of the xml file to the memory phone and i know how to read the file, but i don't know how to read the content and save it into the memory phone.

I want to read the xml from the memory and pick all the links in the xml and then download the images, videos and sound into memory. What is the best way to do that? I save the files in isolated storage it's possible save in a card memory?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

后来的我们 2024-12-20 19:31:10

首先,您从 XML 文件中获取链接:

    // using local XML file for demonstration
    StreamResourceInfo info = Application.GetResourceStream(new Uri("xml_example.xml", UriKind.Relative));

    XElement xml = XElement.Load(info.Stream);
    // iterate media files
    foreach (XElement element in xml.Element("graphics").Elements("file"))
    {   
        // pick a video
        if (element.Attribute("type").Value == "video")
        {
            // demoing that we found something
            MessageBox.Show(element.Element("fileurl").Value);

            // here goes the real action
            DoSomethingUsefulWithURL(element.Element("fileurl").Value); 
        }

    }

然后按照此博客文章中所述继续下载并播放该文件:“从独立存储下载、存储和播放媒体文件”。您的起点是从 XML 文件中获取的 URL。然后博客中的人就会按照你想要的方式做几乎相同的事情。

First you get the links from your XML file:

    // using local XML file for demonstration
    StreamResourceInfo info = Application.GetResourceStream(new Uri("xml_example.xml", UriKind.Relative));

    XElement xml = XElement.Load(info.Stream);
    // iterate media files
    foreach (XElement element in xml.Element("graphics").Elements("file"))
    {   
        // pick a video
        if (element.Attribute("type").Value == "video")
        {
            // demoing that we found something
            MessageBox.Show(element.Element("fileurl").Value);

            // here goes the real action
            DoSomethingUsefulWithURL(element.Element("fileurl").Value); 
        }

    }

And then you proceed with downloading and playing the file as described in this blog post: "Download, Store and Play Media files from Isolated Storage". Your starting point is the URL you got from the XML file. And then the guy from the blog does pretty much the same as you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文