本文整理匯總了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;
}
示例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;
}