當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlDocument.LoadXmlFromBuffer方法代碼示例

本文整理匯總了C#中Windows.Data.Xml.Dom.XmlDocument.LoadXmlFromBuffer方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlDocument.LoadXmlFromBuffer方法的具體用法?C# XmlDocument.LoadXmlFromBuffer怎麽用?C# XmlDocument.LoadXmlFromBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.Data.Xml.Dom.XmlDocument的用法示例。


在下文中一共展示了XmlDocument.LoadXmlFromBuffer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetIndex

        static async Task<XmlDocument> GetIndex()
        {
            var indexUrl = "http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObjectApproved/index.html";
            var buffer = await Http.GetBufferAsync(new Uri(indexUrl));

            var doc = new XmlDocument();
            doc.LoadXmlFromBuffer(buffer, new XmlLoadSettings() { ProhibitDtd = false });

            return doc;
        }
開發者ID:clarkezone,項目名稱:SvgWin2D,代碼行數:10,代碼來源:TestSuite.cs

示例2: LoadManifestAsync

        internal async Task<XmlDocument> LoadManifestAsync(string url)
        {
            Uri uri = null;
            IBuffer buffer = null;
            try
            {
                uri = new Uri(url);
            }
            catch
            {
#if DEBUG
                Logger.Log("Bad url: " + url);
#endif
                throw new Exception("Invalid URL");
            }

            buffer = await Downloader.DownloadBufferAsync(uri);

            if (buffer == null)
            {
#if DEBUG
                Logger.Log("Failed to get buffer of manifest");
#endif
                throw new Exception("Failed to get buffer from url");
            }
            XmlDocument document = new XmlDocument();

            try 
            {

                var bufferString = DataReader.FromBuffer(buffer).ReadString(buffer.Length);
                document.LoadXmlFromBuffer(buffer);
            }
            catch (Exception e)
            {
#if DEBUG
                Logger.Log("Failed to load XML from buffer = " + Logger.Display(e));
#endif
                throw new Exception("Invalid XML file");
            }

            return document;
        }
開發者ID:davidezordan,項目名稱:playready_livedash_UWP,代碼行數:43,代碼來源:manifest.cs


注:本文中的Windows.Data.Xml.Dom.XmlDocument.LoadXmlFromBuffer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。