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


C# XmlNode.AppendChild方法代码示例

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


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

示例1: CreateNode

 public XmlNode CreateNode(XmlDocument doc, XmlNode parent, string node_label, string node_value)
 {
     XmlNode node = doc.CreateElement(node_label);
     node.InnerText = node_value;
     parent.AppendChild(node);
     return node;
 }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:7,代码来源:DataSources.cs

示例2: SetPropNode

 public static void SetPropNode(XmlNode parent, XmlNode child)
 {
     foreach (XmlNode toRemove in parent.Children(child.Name).ToArray()) {
         parent.RemoveChild(toRemove);
     }
     parent.AppendChild(child);
     Save();
 }
开发者ID:foxor,项目名称:unity-nls,代码行数:8,代码来源:UserProperty.cs

示例3: AddXMLChildNode

    public static XmlNode AddXMLChildNode(XmlDocument xmlDoc, XmlNode xmlnodeRoot, string sElementName)
    {
        XmlNode xmlnodeChild;
        XmlElement xmlElemChild;

        xmlElemChild = xmlDoc.CreateElement("", sElementName, "");
        xmlnodeChild = xmlnodeRoot.AppendChild(xmlElemChild);

        return xmlnodeChild;
    }
开发者ID:vaddepallysrinivas,项目名称:NGO,代码行数:10,代码来源:XMLdoc.cs

示例4: InjectXmlNodeList

 public void InjectXmlNodeList(XmlNodeList nodeList)
 {
     XmlDocument doc = new XmlDocument();
     xmlNode =  doc.CreateElement("root");
     foreach(XmlNode _node in nodeList)
     {
         xmlNode.AppendChild(_node);
     }
     RegisterEventHandlers();
 }
开发者ID:Daloupe,项目名称:Syzygy_Git,代码行数:10,代码来源:DataMakerXmlProxy.cs

示例5: AddSongsInAlbum

 static void AddSongsInAlbum(XmlDocument xml, Dictionary<string, double> songsList, XmlNode album)
 {
     foreach (var songName in songsList)
     {
         XmlNode song = album.AppendChild(xml.CreateElement("Song"));
         XmlNode title = song.AppendChild(xml.CreateElement("Title"));
         XmlNode duration = song.AppendChild(xml.CreateElement("Duration"));
         title.InnerText = songName.Key;
         duration.InnerText = songName.Value.ToString();
     }
 }
开发者ID:razsilev,项目名称:TelerikAcademy_Homework,代码行数:11,代码来源:Program.cs

示例6: AddXMLElement

    public static XmlNode AddXMLElement(XmlDocument xmlDoc, XmlNode xmlnode, string sElementName, string sElementValue, bool bElementOnly)
    {
        XmlElement xmlelem;
        XmlText xmltext;
        XmlNode newnode;

        xmlelem = xmlDoc.CreateElement("", sElementName, "");
        if (!bElementOnly)
        {
            xmltext = xmlDoc.CreateTextNode(sElementValue);
            xmlelem.AppendChild(xmltext);
        }
        newnode = xmlnode.AppendChild(xmlelem);
        return newnode;
    }
开发者ID:vaddepallysrinivas,项目名称:NGO,代码行数:15,代码来源:XMLdoc.cs

示例7: AppendElement

    public static XmlElement AppendElement(XmlNode target, string elementName, object inner)
    {
        try{
            XmlElement e = target.OwnerDocument.CreateElement(elementName);
            if(inner is XmlNode){
                XmlNode innerNode = inner as XmlNode;

                if(string.IsNullOrEmpty(innerNode.InnerText)) return null;
                e.AppendChild(innerNode);
                target.AppendChild(e);
                return e;
            }
            if(string.IsNullOrEmpty(inner.ToString())) return null;
            e.InnerText = inner.ToString();
            target.AppendChild(e);
            return e;
        }catch (Exception e){
            Console.Error.WriteLine("[{0}]", target);
            Console.Error.WriteLine("[{0}]", elementName);
            Console.Error.WriteLine("[{0}]", inner);
            Console.Error.WriteLine(e);
            throw;
        }
    }
开发者ID:waic,项目名称:as_html_generator,代码行数:24,代码来源:CsvDataTable.cs

示例8: AddAlbum

    static XmlNode AddAlbum(XmlDocument xml, XmlNode catalogue, string albumName, string artistName, string year, string producerName, decimal price)
    {
        XmlNode artist = catalogue.AppendChild(xml.CreateElement("Artist"));
        XmlAttribute artistAttrName = artist.Attributes.Append(xml.CreateAttribute("name"));
        artistAttrName.InnerText = artistName;

        XmlNode album = AddChild(xml, artist, "Album");
        XmlAttribute albumAttrName = album.Attributes.Append(xml.CreateAttribute("name"));
        albumAttrName.InnerText = albumName;

        XmlNode promYear = AddChild(xml, album, "Year");
        promYear.InnerText = year;

        XmlNode producer = AddChild(xml, album, "Producer");
        producer.InnerText = producerName;

        XmlNode albumPrice = AddChild(xml, album, "Price");
        albumPrice.InnerText = price.ToString();

        XmlNode songs = AddChild(xml, album, "Songs");
        return album;
    }
开发者ID:razsilev,项目名称:TelerikAcademy_Homework,代码行数:22,代码来源:Program.cs

示例9: ProcessAppInfoDocMarkup

        private void ProcessAppInfoDocMarkup(bool root) {
            //First time reader is positioned on AppInfo or Documentation element
            XmlNode currentNode = null; 
            
            switch (reader.NodeType) {
                case XmlNodeType.Element:
                    annotationNSManager.PushScope();
                    currentNode = LoadElementNode(root);
                    break;
                
                case XmlNodeType.Text:
                    currentNode = dummyDocument.CreateTextNode( reader.Value );
                    goto default;

                case XmlNodeType.SignificantWhitespace:
                    currentNode = dummyDocument.CreateSignificantWhitespace( reader.Value );
                    goto default;

                case XmlNodeType.CDATA:
                    currentNode = dummyDocument.CreateCDataSection( reader.Value );
                    goto default;

                case XmlNodeType.EntityReference:
                    currentNode = dummyDocument.CreateEntityReference( reader.Name );
                    goto default;

                case XmlNodeType.Comment:    
                    currentNode = dummyDocument.CreateComment( reader.Value );
                    goto default;

                case XmlNodeType.ProcessingInstruction:
                    currentNode = dummyDocument.CreateProcessingInstruction( reader.Name, reader.Value );
                    goto default;
                
                case XmlNodeType.EndEntity:
                    break;
                
                case XmlNodeType.Whitespace:
                    break;

                case XmlNodeType.EndElement:
                    annotationNSManager.PopScope();
                    parentNode = parentNode.ParentNode;
                    break;
                
                default: //other possible node types: Document/DocType/DocumentFrag/Entity/Notation/Xmldecl cannot appear as children of xs:appInfo or xs:doc
                    Debug.Assert(currentNode != null);
                    Debug.Assert(parentNode != null);
                    parentNode.AppendChild(currentNode);
                    break;
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:52,代码来源:parser.cs

示例10: AddItem

 ///<summary>
 ///</summary>
 ///<param name="Element"></param>
 ///<param name="Key"></param>
 ///<param name="value"></param>
 public void AddItem(XmlNode Element, string Key, string value)
 {
     XmlNode ItemElement = CreateNode(XmlNodeType.Element, "Item", "");
     ItemElement.Attributes.Append(AddAttribute("key", Key));
     ItemElement.Attributes.Append(AddAttribute("value", value));
     Element.AppendChild(ItemElement);
 }
开发者ID:liujf5566,项目名称:Tool,代码行数:12,代码来源:XmlText.cs

示例11: AddChild

 static XmlNode AddChild(XmlDocument xml, XmlNode node, string nodeName)
 {
     XmlNode newNode = node.AppendChild(xml.CreateElement(nodeName));
     return newNode;
 }
开发者ID:razsilev,项目名称:TelerikAcademy_Homework,代码行数:5,代码来源:Program.cs

示例12: AddDictionaryToPlist

	static void AddDictionaryToPlist (ISD_Variable var, XmlNode node, XmlDocument doc)
	{
		if(var.DictValues.Count == 0) return;
		
		foreach(ISD_VariableListed varDict in var.DictValues)
		{
			XmlNode tempNode = null;
			switch(varDict.Type)
			{
			case ISD_PlistValueTypes.Boolean:
				tempNode = doc.CreateElement (varDict.BooleanValue.ToString ().ToLower ());
				break;
				
			case ISD_PlistValueTypes.Float:
				tempNode = doc.CreateElement ("real");
				tempNode.InnerText = varDict.FloatValue.ToString ();
				break;
				
			case ISD_PlistValueTypes.Integer:
				tempNode = doc.CreateElement ("integer");
				tempNode.InnerText = varDict.IntegerValue.ToString ();
				break;
				
			case ISD_PlistValueTypes.String:
				tempNode = doc.CreateElement ("string");
				tempNode.InnerText = varDict.StringValue;
				break;
			}
			XmlNode tempKeyNode = doc.CreateElement ("key");
			tempKeyNode.InnerText = varDict.DictKey;
			node.AppendChild (tempKeyNode);
			node.AppendChild (tempNode);
		}
	}
开发者ID:sonxoans2,项目名称:TapJump,代码行数:34,代码来源:IOSDeployPostProcess.cs

示例13: AddArrayToPlist

	static void AddArrayToPlist (ISD_Variable var, XmlNode node, XmlDocument doc)
	{
		if(var.ArrayValue.Count == 0) return;

		foreach(ISD_VariableListed varArray in var.ArrayValue)
		{
			switch(var.ArrayType)
			{
			case ISD_PlistValueTypes.Boolean:
				XmlNode tempBoolNode = doc.CreateElement (varArray.BooleanValue.ToString ().ToLower ());
				node.AppendChild (tempBoolNode);
				break;
				
			case ISD_PlistValueTypes.Float:
				XmlNode tempFloatNode = doc.CreateElement ("real");
				tempFloatNode.InnerText = varArray.FloatValue.ToString ();
				node.AppendChild (tempFloatNode);
				break;
				
			case ISD_PlistValueTypes.Integer:
				XmlNode tempIntegerNode = doc.CreateElement ("integer");
				tempIntegerNode.InnerText = varArray.IntegerValue.ToString ();
				node.AppendChild (tempIntegerNode);
				break;
				
			case ISD_PlistValueTypes.String:
				XmlNode tempStringNode = doc.CreateElement ("string");
				tempStringNode.InnerText = varArray.StringValue;
				node.AppendChild (tempStringNode);
				break;
			}
		}
	}
开发者ID:sonxoans2,项目名称:TapJump,代码行数:33,代码来源:IOSDeployPostProcess.cs

示例14: createTextWallNodes

    public static XmlNode createTextWallNodes(XmlDocument HomeSettings, XmlNode CurrNode, string element, string innertext)
    {
        XmlElement NewNodes = HomeSettings.CreateElement(element);
        NewNodes.InnerText = NewNodes.InnerText = innertext;

        ///CurrNode.PrependChild(NewNodes);
         CurrNode.AppendChild(NewNodes);
        //CurrNode.LastChild

          //  CurrNode.InsertAfter(  NewNodes, CurrNode.LastChild );

        return CurrNode;
    }
开发者ID:elieli,项目名称:nonProfit,代码行数:13,代码来源:Class1.cs

示例15: SaveValueToPlistNode

 private static bool SaveValueToPlistNode(XmlNode node, object value)
 {
     // The node passed will be the parent node to the new value node.
     XmlNode valNode;
     System.Type type = value.GetType();
     // Identify the data type for the value and serialize it accordingly
     if (type == typeof(String)) {
         valNode = node.OwnerDocument.CreateElement("string");
     }
     else if (type == typeof(Int16) ||
              type == typeof(Int32) ||
              type == typeof(Int64)) { valNode = node.OwnerDocument.CreateElement("integer"); }
     else if (type == typeof(Single) ||
              type == typeof(Double) ||
              type == typeof(Decimal)) { valNode = node.OwnerDocument.CreateElement("real"); }
     else if (type == typeof(DateTime)) {
         // Dates need to be stored in ISO 8601 format
         valNode = node.OwnerDocument.CreateElement("date");
         DateTime dt = (DateTime)value;
         valNode.InnerText = dt.ToUniversalTime().ToString("o");
         node.AppendChild(valNode);
         return true;
     }
     else if (type == typeof(bool)) {
         // Boolean values are empty elements, simply being stored as an elemement with a name of true or false
         if ((bool)value == true) { valNode = node.OwnerDocument.CreateElement("true"); }
         else { valNode = node.OwnerDocument.CreateElement("false"); }
         node.AppendChild(valNode);
         return true;
     }
     // Hashtables and arrays require special functions to save their values in an itterative and recursive manner.
     // The functions will return true/false to indicate success/failure, so pass those on.
     else if (type == typeof(Hashtable))	{
         return SaveDictToPlistNode(node, (Hashtable)value);
     }
     else if (type == typeof(ArrayList)) { return SaveArrayToPlistNode(node, (ArrayList)value); }
     // Anything that doesn't fit the defined data types will just be stored as "data", which is effectively a string.
     else {
         valNode = node.OwnerDocument.CreateElement("data");
     }
     // Some of the values (strings, numbers, data) basically get stored as a string.  The rest will store their values in their special format and return true for success.  If we made it this far, then the value in valNode must be stored as a string.
     if (valNode != null) valNode.InnerText = value.ToString();
     node.AppendChild(valNode);
     // We're done.  Return true for success.
     return true;
 }
开发者ID:rahmanazhar,项目名称:UnityWorkspace,代码行数:46,代码来源:PListManager.cs


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