学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

请教!!!

请教!!!

protected void Init()  //帮忙整体的介绍下,LIVE41,拜托,谢谢!!!急!!!
  {
   this.XmlDoc = new XmlDocument();  //新建一个Xml文档
   switch(this.Type.ToLower())  // ToLower()是返回此 System.String 的小写形式的副本,返回时使用当前区域性的大小写规则。
   {
    case "form":this.XmlDoc.LoadXml("<Form Name='' ></Form>");break;
    case "list":this.XmlDoc.LoadXml("<List Name='' Fields=''></List>");break;
    case "enum":this.XmlDoc.LoadXml("<Enum Name='' ></Enum>");break;
    case "param":this.XmlDoc.LoadXml("<Param Name=''></Param>");break;
   }
   this.XmlEle=this.XmlDoc.DocumentElement;
  }

TOP

又来? using System; using System.IO; using System.Xml; public class Sample { public static void Main() { //Create the XmlDocument. XmlDocument doc = new XmlDocument(); doc.LoadXml("<?xml version='1.0' ?>" + "<book genre='novel' ISBN='1-861001-57-5'>" + "<title>Pride And Prejudice</title>" + "</book>"); //Display the document element. Console.WriteLine(doc.DocumentElement.OuterXml); } } 大概就是根据当前输入字符来判断读取XML文件的指定段之间的内容,然后传给XmlEle(又是一个我不知道什么的定义),关键是this,this就是本文件或者本类,this.Type判断本类的类型,此处的Type是属性,但是我始终不知道你的this的定义是什么,所以没法解释。

The Type property can only be set to primitive types and enumerations.

The XmlTextAttribute can also be applied to a field that returns an XmlNode or an array of XmlNode objects.

You can apply the XmlTextAttribute to a field or property that returns an array of strings. You can also apply the attribute to an array of type Object but you must set the Type property to string. In that case, any strings inserted into the array will be serialized as XML text.

TOP

感谢LIVE41对我的大力支持,虽然有时候帖的比较的吓人,但是你还是坚持看完,真的很谢谢你!!以后尽量一次少贴点,把说明作好,谢谢!!!

TOP

不用感谢在下啦,你的帖子不吓人,是我没有耐性而已,不好意思。不过这里始终不是csdn,论坛里的高手们都回家过年了,很少上来回帖,要不一定有更详尽的回帖。

TOP

发新话题