什么Xmlresolver属性正确吗?因为我很困惑使用Xmlrelover。 [英] What Xmlresolver Property Exactly Do? Because I Am Confused Using Of Xmlrelover.

查看:74
本文介绍了什么Xmlresolver属性正确吗?因为我很困惑使用Xmlrelover。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XmlResolver属性究竟做什么?如果可能的话举个例子。请有人帮帮我....谢谢你........

What XmlResolver property exactly do? if possible give an example. Please anybody help me.... Thank u........

推荐答案

XmlDocument.XmlResolver Property

设置用于解析外部资源的XmlResolver,即.dtd文件



示例,

XmlDocument.XmlResolver Property
Sets the XmlResolver to use for resolving external resources, i.e .dtd files

Example,
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 [ ^ ]总是有帮助:)



MSDN[^] always helps :)


以什么方式解决手段?它会删除DTD还是什么?

意味着它将从具有DTD实体的XML文件中精确解析它?



我期待清楚这张照片....请帮帮我....谢谢你
resolving means in what way? either it will remove DTD or what?
Means what it will resolve exactly from XML file which having DTD Entity?

I am expecting clear picture of this.... Please help me.... Thank u


这篇关于什么Xmlresolver属性正确吗?因为我很困惑使用Xmlrelover。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆