当前位置: 首页>>代码示例>>C#>>正文


C# XmlDocument.CreateNode方法代码示例

本文整理汇总了C#中XmlDocument.CreateNode方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument.CreateNode方法的具体用法?C# XmlDocument.CreateNode怎么用?C# XmlDocument.CreateNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlDocument的用法示例。


在下文中一共展示了XmlDocument.CreateNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

    public static void Write(XmlDocument target, DbDataReader source )
    {
        /*
            Style:
            <root>
                <raw><name>name1</name><index>name2</index></raw>
                <raw><name>name1</name><index>name2</index></raw>
                <raw><name>name1</name><index>name2</index></raw>
            </root>
        */

        XmlNode head = target.CreateNode(XmlNodeType.Element, "head", "");
        XmlNode body = target.CreateNode(XmlNodeType.Element, "body", "");

        for (int i = 0; i < source.FieldCount; ++i)
        {
            string vl = source.GetName(i);
            string local =  (string)HttpContext.GetGlobalResourceObject("local", vl);
            if (local != null) vl = local;

            Util.AddNodedText(head, "column", vl, false);
        }

        while (source.Read())
        {
            XmlNode raw = target.CreateNode(XmlNodeType.Element, "raw", "");

            for (int i = 0; i < source.FieldCount; ++i) Util.AddNodedText(raw, "value", Util.GetString( source, i ), false);

            body.AppendChild(raw);
        }

        target.FirstChild.AppendChild(head);
        target.FirstChild.AppendChild(body);
    }
开发者ID:mbsky,项目名称:kub-engine,代码行数:35,代码来源:TableToData.cs

示例2: SaveConfig

    public static void SaveConfig()
    {
        try
        {
            string ConfigFile = Path.Combine(ClientSettings.AppPath, "App.config");

            XmlDocument oXml = new XmlDocument();
            XmlNode Root = oXml.CreateNode(XmlNodeType.Element, "configuration", "");
            XmlNode SettingsNode = oXml.CreateNode(XmlNodeType.Element, "appSettings", "");
            foreach(string AppSettingName in AppSettings.Keys)
            {
                XmlNode SettingNode = oXml.CreateNode(XmlNodeType.Element, "add", "");
                XmlAttribute keyatt = oXml.CreateAttribute("key");
                keyatt.Value = AppSettingName;

                XmlAttribute valueatt = oXml.CreateAttribute("value");
                valueatt.Value = AppSettings[AppSettingName];
                SettingNode.Attributes.Append(keyatt);
                SettingNode.Attributes.Append(valueatt);
                SettingsNode.AppendChild(SettingNode);
            }

            XmlNode AccountsNode = oXml.CreateNode(XmlNodeType.Element, "accounts", "");
            foreach (Yedda.Twitter.Account Account in Accounts)
            {
                XmlNode AccountNode = oXml.CreateNode(XmlNodeType.Element, "add", "");
                XmlAttribute userAtt = oXml.CreateAttribute("user");
                userAtt.Value = Account.UserName;

                XmlAttribute passAtt = oXml.CreateAttribute("password");
                passAtt.Value = Account.Password;

                XmlAttribute serverNameAtt = oXml.CreateAttribute("servername");
                serverNameAtt.Value = Account.ServerURL.Name;

                XmlAttribute enabledAtt = oXml.CreateAttribute("enabled");
                enabledAtt.Value = Account.Enabled.ToString();

                AccountNode.Attributes.Append(userAtt);
                AccountNode.Attributes.Append(passAtt);
                AccountNode.Attributes.Append(serverNameAtt);
                AccountNode.Attributes.Append(enabledAtt);
                AccountsNode.AppendChild(AccountNode);
            }

            Root.AppendChild(SettingsNode);
            Root.AppendChild(AccountsNode);
            oXml.AppendChild(Root);

            oXml.Save(ConfigFile);
        }
        catch(Exception ex) 
        {
            System.Diagnostics.Debug.WriteLine(ex.Message);
        }
    }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:56,代码来源:appconfig.cs

示例3: getBookPrice

 public float getBookPrice(string isbn)
 {
     if (isbnNotValid(isbn))
     {
         XmlDocument doc = new XmlDocument();
         XmlNode node = doc.CreateNode(XmlNodeType.Element, SoapException.DetailElementName.Name, SoapException.DetailElementName.Namespace);
         XmlNode child = doc.CreateNode(XmlNodeType.Element, "error", "http://DEETC.SES.SD");
         child.InnerText = "BookService:Not valid ISBN in getBookPrice operation.";
         node.AppendChild(child);
         throw new SoapException("ISBN not Valid", SoapException.ServerFaultCode, "ActorServer", node);
     }
     return 24.9F;
 }
开发者ID:jonas12,项目名称:SD-LI61D-1112,代码行数:13,代码来源:Service.cs

示例4: GetEmployeesCountError

	public int GetEmployeesCountError()
	{
		try
		{
			SqlConnection con = new SqlConnection(connectionString);

			// Make a deliberately faulty SQL string
			string sql = "INVALID_SQL COUNT(*) FROM Employees";
			SqlCommand cmd = new SqlCommand(sql, con);

			// Open the connection and get the value.
			cmd.Connection.Open();
			int numEmployees = -1;
			try
			{
				numEmployees = (int)cmd.ExecuteScalar();
			}
			finally
			{
				cmd.Connection.Close();
			}
			return numEmployees;
		}
		catch (Exception err)
		{
			// Create the detail information
			// an <ExceptionType> element with the type name.
			XmlDocument doc = new XmlDocument();
			XmlNode node = doc.CreateNode(
				XmlNodeType.Element, SoapException.DetailElementName.Name,
				SoapException.DetailElementName.Namespace);
			XmlNode child = doc.CreateNode(
				XmlNodeType.Element, "ExceptionType",
				SoapException.DetailElementName.Namespace);
			child.InnerText = err.GetType().ToString();
			node.AppendChild(child);

			// Create the custom SoapException.
			// Use the message from the original exception,
			// and add the detail information.
			SoapException soapErr = new SoapException(
				err.Message, SoapException.ServerFaultCode,
				Context.Request.Url.AbsoluteUri, node);

			// Throw the revised SoapException.
			throw soapErr;
		}
	}
开发者ID:Helen1987,项目名称:edu,代码行数:48,代码来源:EmployeesService.cs

示例5: VerifyOwnerOfGivenType

        private static void VerifyOwnerOfGivenType(XmlNodeType nodeType)
        {
            var xmlDocument = new XmlDocument();
            var node = xmlDocument.CreateNode(nodeType, "test", string.Empty);

            Assert.Equal(xmlDocument, node.OwnerDocument);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:OwnerDocumentTests.cs

示例6: saveXML

    public void saveXML(string path)
    {
        XmlDocument doc = new XmlDocument ();
        XmlElement main = doc.CreateElement ("Config");
        XmlAttribute version = doc.CreateAttribute ("Version");
        version.Value = configVersion;
        main.Attributes.Append (version);
        XmlAttribute lastMap = doc.CreateAttribute ("lastCompletedMap");
        lastMap.Value = lastCompletedLevel;
        main.Attributes.Append (lastMap);
        XmlNode score = doc.CreateNode (XmlNodeType.Element, "ScoreHistory", "");
        foreach(int i in scoreHistory ){
            XmlElement node = doc.CreateElement("Score");
            XmlAttribute val = doc.CreateAttribute("Value");
            val.Value = i.ToString();
            node.Attributes.Append(val);
            score.AppendChild(node);
        }

        main.AppendChild (score);
        doc.AppendChild (main);
        doc.Save(path);
        /*
        //doc.l
        using (var stream = new FileStream(path, FileMode.Create)) {
            using (StreamWriter writer = new StreamWriter(stream))
                writer.Write (data);
        }
        */
    }
开发者ID:allfa,项目名称:Reborn,代码行数:30,代码来源:config.cs

示例7: Create

	/// <summary>
	/// Create a node containing the user
	/// </summary>
	/// <param name="doc">XML configuration document</param>
	/// <returns>base node of new permission</returns>
	public XmlNode Create(XmlDocument doc)
	{
		// create the permission node
		XmlNode user = doc.CreateNode(XmlNodeType.Element, "User", null);

		// assign the user name attribute
		XmlAttribute userName = doc.CreateAttribute("Name");
		userName.Value = Username;
		user.Attributes.Append(userName);

		// create the options
		XmlNode opt;
		opt = CreateOption(doc, "Pass", Filezilla.GetMd5Sum(Password));
		user.AppendChild(opt);
		opt = CreateOption(doc, "Group", "");
		user.AppendChild(opt);
		opt = CreateOption(doc, "Bypass server userlimit", false);
		user.AppendChild(opt);
		opt = CreateOption(doc, "User Limit", "0");
		user.AppendChild(opt);
		opt = CreateOption(doc, "IP Limit", "0");
		user.AppendChild(opt);
		opt = CreateOption(doc, "Enabled", Enabled);
		user.AppendChild(opt);
		opt = CreateOption(doc, "Comments", "FileZilla.NET user");
		user.AppendChild(opt);
		opt = CreateOption(doc, "ForceSsl", "0");
		user.AppendChild(opt);

		// create the ip filters
		XmlNode ipfilter;
		ipfilter = doc.CreateNode(XmlNodeType.Element, "IpFilter", null);
		ipfilter.AppendChild(doc.CreateNode(XmlNodeType.Element, "Disallowed", null));
		ipfilter.AppendChild(doc.CreateNode(XmlNodeType.Element, "Allowed", null));
		user.AppendChild(ipfilter);

		// create the permissions
		XmlNode permissions;
		permissions = doc.CreateNode(XmlNodeType.Element, "Permissions", null);
		foreach (FilezillaPermission p in Permissions)
		{
			permissions.AppendChild(p.Create(doc));
		}
		user.AppendChild(permissions);

		return user;
	}
开发者ID:sancsoft,项目名称:FileZilla.NET,代码行数:52,代码来源:FilezillaUser.cs

示例8: SavePlistToFile

 public static bool SavePlistToFile(String xmlFile, Hashtable plist)
 {
     // If the hashtable is null, then there's apparently an issue; fail out.
     if (plist == null) {
         Debug.LogError("Passed a null plist hashtable to SavePlistToFile.");
         return false;
     }
     // Create the base xml document that we will use to write the data
     XmlDocument xml = new XmlDocument();
     xml.XmlResolver = null; //Disable schema/DTD validation, it's not implemented for Unity.
     // Create the root XML declaration
     // This, and the DOCTYPE, below, are standard parts of a XML property list file
     XmlDeclaration xmldecl = xml.CreateXmlDeclaration("1.0", "UTF-8", null);
     xml.PrependChild(xmldecl);
     // Create the DOCTYPE
     XmlDocumentType doctype = xml.CreateDocumentType("plist", "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
     xml.AppendChild(doctype);
     // Create the root plist node, with a version number attribute.
     // Every plist file has this as the root element.  We're using version 1.0 of the plist scheme
     XmlNode plistNode = xml.CreateNode(XmlNodeType.Element, "plist", null);
     XmlAttribute plistVers = (XmlAttribute)xml.CreateNode(XmlNodeType.Attribute, "version", null);
     plistVers.Value = "1.0";
     plistNode.Attributes.Append(plistVers);
     xml.AppendChild(plistNode);
     // Now that we've created the base for the XML file, we can add all of our information to it.
     // Pass the plist data and the root dict node to SaveDictToPlistNode, which will write the plist data to the dict node.
     // This function will itterate through the hashtable hierarchy and call itself recursively for child hashtables.
     if (!SaveDictToPlistNode(plistNode, plist)) {
         // If for some reason we failed, post an error and return false.
         Debug.LogError("Failed to save plist data to root dict node: " + plist);
         return false;
     } else { // We were successful
         // Create a StreamWriter and write the XML file to disk.
         // (do not append and UTF-8 are default, but we're defining it explicitly just in case)
         StreamWriter sw = new StreamWriter(xmlFile, false, System.Text.Encoding.UTF8);
         xml.Save(sw);
         sw.Close();
     }
     // We're done here.  If there were any failures, they would have returned false.
     // Return true to indicate success.
     return true;
 }
开发者ID:rahmanazhar,项目名称:UnityWorkspace,代码行数:42,代码来源:PListManager.cs

示例9: btnLaheta_Click

 protected void btnLaheta_Click(object sender, EventArgs e)
 {
     XmlDocument oXmlDocument = new XmlDocument();
     oXmlDocument.Load(MapPath("~/App_Data/Palautteet.xml"));
     XmlNode oXmlRootNode = oXmlDocument.SelectSingleNode("palautteet");
     XmlNode oXmlRecordNode = oXmlRootNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "palaute", ""));
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "pvm", "")).InnerText = txtPvm.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "tekija", "")).InnerText = txtNimi.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "opittu", "")).InnerText = txtOppinut.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "haluanoppia", "")).InnerText = txtHaluanoppia.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "hyvaa", "")).InnerText = txtHyvaa.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "parannettavaa", "")).InnerText = txtParannettavaa.Text;
     oXmlRecordNode.AppendChild(oXmlDocument.CreateNode(XmlNodeType.Element, "muuta", "")).InnerText = txtMuuta.Text;
     oXmlDocument.Save(MapPath("~/App_Data/Palautteet.xml"));
 }
开发者ID:G2559,项目名称:viikkotehtava-1,代码行数:15,代码来源:G2559_Valipalaute.aspx.cs

示例10: NamedItemDoesNotExist

        public static void NamedItemDoesNotExist()
        {
            var xmlDocument = new XmlDocument();
            xmlDocument.LoadXml("<foo />");

            var namedNodeMap = (XmlNamedNodeMap)xmlDocument.FirstChild.Attributes;
            Assert.Equal(0, namedNodeMap.Count);

            var newAttribute = xmlDocument.CreateNode(XmlNodeType.Attribute, "newNode", string.Empty);
            namedNodeMap.SetNamedItem(newAttribute);

            Assert.NotNull(newAttribute);
            Assert.Equal(1, namedNodeMap.Count);
            Assert.Equal(newAttribute, namedNodeMap.GetNamedItem("newNode"));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:15,代码来源:SetNamedItemTests.cs

示例11: GetPlayerChartXML

    protected string GetPlayerChartXML()
    {
        XmlDocument xmlDoc = new XmlDocument();
        XmlNode xmlNode = xmlDoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
        xmlDoc.AppendChild(xmlNode);
        XmlElement xEle = xmlDoc.CreateElement("graph");
        xEle.SetAttribute("showvalues", "0");
        XmlElement categories = xmlDoc.CreateElement("categories");
        XmlElement pointsPerGame = xmlDoc.CreateElement("dataset");
        pointsPerGame.SetAttribute("seriesname", "Points per Game");
        pointsPerGame.SetAttribute("color", "#000000");
        XmlElement assistsPerGame = xmlDoc.CreateElement("dataset");
        assistsPerGame.SetAttribute("seriesname", "Assists per Game");
        assistsPerGame.SetAttribute("color", "#000066");
        XmlElement goalsPerGame = xmlDoc.CreateElement("dataset");
        goalsPerGame.SetAttribute("seriesname", "Goals per Game");
        goalsPerGame.SetAttribute("color", "#660000");
        XmlElement tmpElement;
        String sqlString = GetDataString();
        SqlCommand sqlCommand = new SqlCommand(sqlString, scripts.GetConnection());
        using (SqlDataReader reader = sqlCommand.ExecuteReader())
        {
            while (reader.Read())
            {
                tmpElement = xmlDoc.CreateElement("category");
                tmpElement.SetAttribute("name", Convert.ToString(reader[3]));
                categories.AppendChild(tmpElement);

                tmpElement = xmlDoc.CreateElement("set");
                tmpElement.SetAttribute("value", Convert.ToString(reader[2]));
                pointsPerGame.AppendChild(tmpElement);

                tmpElement = xmlDoc.CreateElement("set");
                tmpElement.SetAttribute("value", Convert.ToString(reader[1]));
                goalsPerGame.AppendChild(tmpElement);

                tmpElement = xmlDoc.CreateElement("set");
                tmpElement.SetAttribute("value", Convert.ToString(reader[0]));
                assistsPerGame.AppendChild(tmpElement);
            }
        }
        xEle.AppendChild(categories);
        xEle.AppendChild(pointsPerGame);
        xEle.AppendChild(assistsPerGame);
        xEle.AppendChild(goalsPerGame);
        xmlDoc.AppendChild(xEle);
        return xmlDoc.OuterXml;
    }
开发者ID:Aphramzo,项目名称:AnAvalancheOfStats,代码行数:48,代码来源:PlayerChart.aspx.cs

示例12: CreateSomeXml

    // Create example data to sign.
    public static void CreateSomeXml(string FileName)
    {
        // Create a new XmlDocument object.
        XmlDocument document = new XmlDocument();

        // Create a new XmlNode object.
        XmlNode node = document.CreateNode(XmlNodeType.Element, "", "MyElement", "samples");

        // Add some text to the node.
        node.InnerText = "Example text to be signed.";

        // Append the node to the document.
        document.AppendChild(node);

        // Save the XML document to the file name specified.
        XmlTextWriter xmltw = new XmlTextWriter(FileName, new UTF8Encoding(false));
        document.WriteTo(xmltw);
        xmltw.Close();
    }
开发者ID:Mahendrasiddappa,项目名称:Binary_server,代码行数:20,代码来源:program-repro-misc-validation-and-canon.cs

示例13: PluginConfig

    private void PluginConfig(HttpContext context)
    {
        string str = "<![CDATA[\n" + context.Request.Form["datastr"] + "]]>\n";
        string pluginid = context.Request.Form["id"];
        string type = context.Request.Form["type"];
        string parasstr = "<![CDATA[" + context.Request.Form["paras"] + "]]>";
        string fn = context.Request.Form["fn"];
        Dukey.Model.WebConfig mysite = BLL.WebConfig.instance.GetModelByCache();//网站配置信息
        if (!File.Exists(context.Server.MapPath("~/template/" + mysite.folder + "/theme.xml")))
        {
            using (StreamWriter sw = File.CreateText(context.Server.MapPath("~/template/" + mysite.folder + "/theme.xml")))
            {
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                sw.WriteLine("<config>");
                sw.WriteLine(string.Format("<page url=\"{0}\">", fn));
                sw.WriteLine("<plugins>");
                sw.WriteLine(string.Format("<plugin id=\"{0}\" type=\"{1}\">", pluginid, type));
                sw.WriteLine(string.Format("<paras>{0}</paras>", parasstr));
                sw.WriteLine("<content>");
                sw.WriteLine(str);
                sw.WriteLine("</content>");
                sw.WriteLine("</plugin>");
                sw.WriteLine("</plugins>");
                sw.WriteLine("</page>");
                sw.WriteLine("</config>");
            }
        }
        else
        {
            string path = context.Server.MapPath("~/template/" + mysite.folder + "/theme.xml");
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(path); //加载XML文档
                XmlNode root = xmlDoc.SelectSingleNode("//config");
                if (root == null)
                {
                    root = xmlDoc.CreateNode("element", "config", "");
                    xmlDoc.AppendChild(root);
                }
                XmlNode page = xmlDoc.SelectSingleNode("//config/page[@url='" + fn + "']");
                if (page == null)
                {
                    page = xmlDoc.CreateNode("element", "page", "");
                    XmlAttribute xmlAttribute = xmlDoc.CreateAttribute("url");
                    xmlAttribute.Value = fn;
                    page.Attributes.Append(xmlAttribute);
                    root.AppendChild(page);
                }
                XmlNode plugins = xmlDoc.SelectSingleNode("//config/page[@url='" + fn + "']/plugins");
                if (plugins == null)
                {
                    plugins = xmlDoc.CreateNode("element", "plugins", "");
                    page.AppendChild(plugins);
                }
                XmlNode plugin = xmlDoc.SelectSingleNode("//config/page[@url='" + fn + "']/plugins/plugin[@id='" + pluginid + "' and @type='" + type + "']");
                if (plugin == null)
                {
                    plugin = xmlDoc.CreateNode("element", "plugin", "");
                    XmlAttribute att1 = xmlDoc.CreateAttribute("id");
                    att1.Value = pluginid;
                    XmlAttribute att2 = xmlDoc.CreateAttribute("type");
                    att2.Value = type;
                    plugin.Attributes.Append(att1);
                    plugin.Attributes.Append(att2);
                    plugins.AppendChild(plugin);
                }
                XmlNode paras = xmlDoc.SelectSingleNode("//config/page[@url='" + fn + "']/plugins/plugin[@id='" + pluginid + "' and @type='" + type + "']/paras");
                if (paras == null)
                {
                    paras = xmlDoc.CreateNode("element", "paras", "");
                    plugin.AppendChild(paras);
                }
                paras.InnerXml = parasstr;
                XmlNode content = xmlDoc.SelectSingleNode("//config/page[@url='" + fn + "']/plugins/plugin[@id='" + pluginid + "' and @type='" + type + "']/content");
                if (content == null)
                {
                    content = xmlDoc.CreateNode("element", "content", "");
                    plugin.AppendChild(content);
                }

                content.InnerXml = str;
                xmlDoc.Save(path);
                context.Response.Write("ok");
            }
            catch (Exception ex) { context.Response.Write(ex.Message); }
        }
    }
开发者ID:fsfree,项目名称:dookcms,代码行数:88,代码来源:postop.ashx.cs

示例14: CheckAppSetting

    /// <summary>
    /// To Check if the appsetting already exists or not, if not then add it with suitable value
    /// </summary>
    /// <param name="xmlDoc"></param>
    /// <param name="keyName"></param>
    /// <returns></returns>
    public static string CheckAppSetting(XmlDocument xmlDocument, string keyName, string keyValue)
    {
        string RetVal = string.Empty;
        XmlDocument XmlDoc;
        string AppSettingsFile = string.Empty;

        try
        {
            if (xmlDocument.SelectSingleNode("/" + Constants.XmlFile.AppSettings.Tags.Root + "/" + Constants.XmlFile.AppSettings.Tags.Item + "[@" + Constants.XmlFile.AppSettings.Tags.ItemAttributes.Name + "='" + keyName + "']") == null)
            {
                AppSettingsFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]);
                XmlDoc = new XmlDocument();
                XmlDoc.Load(AppSettingsFile);
                XmlNode xNode = XmlDoc.CreateNode(XmlNodeType.Element, "item", "");
                XmlAttribute xKey = XmlDoc.CreateAttribute("n");
                XmlAttribute xValue = XmlDoc.CreateAttribute("v");
                xKey.Value = keyName;
                xValue.Value = keyValue;
                xNode.Attributes.Append(xKey);
                xNode.Attributes.Append(xValue);
                XmlDoc.GetElementsByTagName("appsettings")[0].InsertAfter(xNode,
                XmlDoc.GetElementsByTagName("appsettings")[0].LastChild);
                File.SetAttributes(AppSettingsFile, FileAttributes.Normal);
                XmlDoc.Save(AppSettingsFile);
            }

        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }

        return RetVal;
    }
开发者ID:SDRC-India,项目名称:sdrcdevinfo,代码行数:40,代码来源:Global.cs

示例15: CreateOption

	/// <summary>
	/// Creaate a string-based option for xml
	/// </summary>
	/// <param name="doc">XML configuration document</param>
	/// <param name="optionName">name attribute of option</param>
	/// <param name="optionValue">value of option</param>
	/// <returns></returns>
	public XmlNode CreateOption(XmlDocument doc, string optionName, string optionValue)
	{
		XmlNode opt = doc.CreateNode(XmlNodeType.Element, "Option", null);
		XmlAttribute name = doc.CreateAttribute("Name");
		XmlText value = doc.CreateTextNode(optionValue);
		name.Value = optionName;
		opt.Attributes.Append(name);
		opt.AppendChild(value);
		return opt;
	}
开发者ID:sancsoft,项目名称:FileZilla.NET,代码行数:17,代码来源:FilezillaPermission.cs


注:本文中的XmlDocument.CreateNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。