本文介绍了什么Xmlresolver属性正确吗?因为我很困惑使用Xmlrelover。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
XmlResolver属性究竟做什么?如果可能的话举个例子。请有人帮帮我....谢谢你........
What XmlResolver property exactly do? if possible give an example. Please anybody help me.... Thank u........
推荐答案
using System;
using System.IO;
using System.Xml;
using System.Net;
public class Sample {
public static void Main() {
// Supply the credentials necessary to access the DTD file stored on the network.
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = CredentialCache.DefaultCredentials;
// Create and load the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.XmlResolver = resolver; // Set the resolver.
doc.Load("book5.xml");
// Display the entity replacement text which is pulled from the DTD file.
Console.WriteLine(doc.DocumentElement.LastChild.InnerText);
}
} // End class
[]总是有帮助:)
MSDN[^] always helps :)
这篇关于什么Xmlresolver属性正确吗?因为我很困惑使用Xmlrelover。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!