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


C# XmlNode.RemoveAll方法代码示例

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


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

示例1: appendElement

 public static void appendElement(XmlNode xmlNode, String element, Hashtable properties, Hashtable eventProperties)
 {
     xmlNode.RemoveAll();
     if (properties != null)
     {
         foreach (string name in properties.Keys)
         {
             XmlAttribute attr = xmlNode.OwnerDocument.CreateAttribute(name);
             attr.InnerText = (string)properties[name];
             xmlNode.Attributes.Append(attr);
         }
     }
     if (eventProperties != null)
     {
         foreach (string name in eventProperties.Keys)
         {
             XmlNode eventNode = xmlNode.OwnerDocument.CreateNode(XmlNodeType.Element, XMLServicesConstants.XmlNodeEventElt, null);
             eventNode.InnerText = (string)eventProperties[name];
             xmlNode.AppendChild(eventNode);
             XmlAttribute attr = eventNode.OwnerDocument.CreateAttribute(XMLServicesConstants.XmlNodeNameAtt);
             attr.InnerText = name;
             eventNode.Attributes.Append(attr);
         }
     }
 }
开发者ID:harpreetoxyent,项目名称:pnl,代码行数:25,代码来源:WorkflowXMLServices.cs

示例2: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     string uNo = Label1.Text;
     string oADDRESS = null;
     string oEmail = null;
     string oName = null;
     string Count = null;
     int i;
     for (i = 1; i < mytable.Rows.Count; i++)
     {
         if (mytable.Rows[i]["UNO"].ToString().Trim().Equals(uNo))
         {
             oADDRESS = mytable.Rows[i]["UADDRESS"].ToString();
             oEmail = mytable.Rows[i]["UEMAIL"].ToString();
         }
     }
     for (i = 0; i < Table1.Rows.Count-1; i++)
     {
         oName += Table1.Rows[i].Cells[0].Text+";";
         Count += Table1.Rows[i].Cells[1].Text + ";";
     }
     oName += Table1.Rows[i].Cells[0].Text;
     Count += Table1.Rows[i].Cells[1].Text;
     db.add_BItem(int.Parse(uNo), oName, oADDRESS, oEmail, "OrderForm", Count);
     root = xd.DocumentElement;
     root.RemoveAll();
     xd.Save(Server.MapPath("gouwuche.xml"));
     Response.Write("<script>window.alert('下单成功')</script>");
     Response.Redirect("~/index.aspx?id=" + Label1.Text);
 }
开发者ID:ZhanNeo,项目名称:test,代码行数:30,代码来源:gouwuche.aspx.cs

示例3: Button2_Click

 protected void Button2_Click(object sender, EventArgs e)
 {
     root = xd.DocumentElement;
     root.RemoveAll();
     xd.Save(Server.MapPath("gouwuche.xml"));
     Response.Redirect("~/index.aspx?id=" + Label1.Text);
 }
开发者ID:ZhanNeo,项目名称:test,代码行数:7,代码来源:gouwuche.aspx.cs

示例4: DeleteNodes

 /// <summary>
 /// 删除指定节点下的子节点
 /// </summary>
 /// <param name="XmlFile">Xml文件路径</param>
 /// <param name="fatherNode">制定节点</param>
 /// <returns>返回真为更新成功,否则失败</returns>
 public bool DeleteNodes(string XmlFile, string fatherNode)
 {
     try
     {
         xmldoc = new XmlDocument();
         xmldoc.Load(XmlFile);
         xmlnode = xmldoc.SelectSingleNode(fatherNode);
         xmlnode.RemoveAll();
         xmldoc.Save(XmlFile);
         return true;
     }
     catch (XmlException xe)
     {
         throw new XmlException(xe.Message);
     }
 }
开发者ID:bookxiao,项目名称:orisoft,代码行数:22,代码来源:XmlHelper.cs

示例5: Apply

        public void Apply(XmlNode oldNode, XmlNode newNode)
        {
            if (newNode == null)
                throw new ArgumentNullException(nameof(newNode));
            if (oldNode == null)
                throw new ArgumentNullException(nameof(oldNode));

            Contract.Requires(newNode != null);
            Contract.Requires(oldNode != null);

            //ToDo: Implement Binding

            if(Query.IsBindingQuery(newNode.InnerText))
            {
                Query.Parse(newNode.InnerText);

                // Children Binding - not deep
                if(Query.Children)
                {
                    foreach (XmlNode node in oldNode.ChildNodes)
                    {
                        var tmpN = newNode.OwnerDocument.ImportNode(node, true);

                        newNode.RemoveAll();

                        newNode.AppendChild(tmpN);
                    }
                }
                else
                {
                    

                    
                }
            }

            foreach (XmlAttribute att in newNode.Attributes)
            {
                if (Query.IsBindingQuery(att.Value))
                {
                    Query.Parse(att.Value);

                    newNode.Attributes[Query.Property].Value = oldNode.Attributes[Query.Property]?.Value;
                }
            }
        }
开发者ID:SchwarzerLoewe,项目名称:XmlComponent,代码行数:46,代码来源:Binding.cs

示例6: ProcessRadioGroupLabels

        private static void ProcessRadioGroupLabels(XmlNode node)
        {
            StringCollection optionalValues =
                TYml2Xml.GetElements(TXMLParser.GetChild(node, "OptionalValues"));

            node.RemoveAll();
            XmlNode OptionalValuesLabel = node.OwnerDocument.CreateElement("LabelsForOptionalValues");
            node.AppendChild(OptionalValuesLabel);

            foreach (string s in optionalValues)
            {
                string label = s;

                if (label.StartsWith("="))
                {
                    label = label.Substring(1).Trim();
                }

                XmlNode LabelNode = node.OwnerDocument.CreateElement(TYml2Xml.XMLLIST);
                OptionalValuesLabel.AppendChild(LabelNode);
                TXMLParser.SetAttribute(LabelNode, "name", Catalog.GetString(label));
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:23,代码来源:GenerateYaml.cs

示例7: SetPropertiesInstance

        /// <summary>
        /// Set the custom properties given the properties object
        /// </summary>
        /// <param name="node"></param>
        /// <param name="inst"></param>
        public void SetPropertiesInstance(XmlNode node, object inst)
        {
            node.RemoveAll();       // Get rid of all properties

            BarCodeBooklandProperties bcp = inst as BarCodeBooklandProperties;
            if (bcp == null)
                return;

            // ISBN
            CreateChild(node, "ISBN", bcp.ISBN);
        }
开发者ID:Elboodo,项目名称:My-FyiReporting,代码行数:16,代码来源:BarCodeBookland.cs

示例8: StripLangTag

        private void StripLangTag(XmlNode docNode, XmlNode langNode)
        {
            List<XmlNode> innerNodeList = new List<XmlNode>();
            foreach (XmlNode innerNode in langNode.ChildNodes)
            {
                innerNodeList.Add(innerNode);
            }
            langNode.RemoveAll();

            foreach (XmlNode innerNode in innerNodeList)
            {
                docNode.InsertBefore(innerNode, langNode);
            }

            docNode.RemoveChild(langNode);
        }
开发者ID:VirusFree,项目名称:Poderosa,代码行数:16,代码来源:MultilanguageDocumentationPlugIn.cs

示例9: ReplaceNode

 /// <summary>
 /// �ڵ��滻[֧���������ĵ����滻]
 /// </summary>
 /// <param name="NewXNode"></param>
 /// <param name="OldXNode"></param>
 public void ReplaceNode(XmlNode newNode, XmlNode oldNode)
 {
     if (newNode != null && oldNode != null)
     {
         oldNode.RemoveAll();
         //if (!string.IsNullOrEmpty(newNode.InnerXml) && !string.IsNullOrEmpty(newNode.NamespaceURI))
         //{
         //    oldNode.InnerXml = newNode.InnerXml.Replace("xmlns=\"" + newNode.NamespaceURI+"\"", string.Empty);
         //}
         //else
         //{
         oldNode.InnerXml = newNode.InnerXml;
         //}
         XmlAttributeCollection xAttributes = newNode.Attributes;
         if (xAttributes != null && xAttributes.Count > 0)
         {
             for (int i = 0; i < xAttributes.Count; i++)
             {
                 ((XmlElement)oldNode).SetAttribute(xAttributes[i].Name, xAttributes[i].Value);
             }
         }
     }
 }
开发者ID:Feng2012,项目名称:cyqdata,代码行数:28,代码来源:XHtmlAction.cs

示例10: Clear

 /// <summary>
 /// ����ڵ�,������ڵ�������/����
 /// </summary>
 /// <param name="OldNode"></param>
 public void Clear(XmlNode node)
 {
     node.RemoveAll();
 }
开发者ID:Feng2012,项目名称:cyqdata,代码行数:8,代码来源:XHtmlAction.cs

示例11: MoveMasterStyles

		/// <summary>
		/// Moves the master styles.
		/// </summary>
		/// <param name="contentDocument">The content document.</param>
		/// <param name="nodeAutomaticStyles">The node automatic styles.</param>
		/// <param name="nodeMasterPages">The node master pages.</param>
		/// <param name="namespaceMng">The namespace MNG.</param>
		/// <remarks>
		/// We will move the whole master style and master pages stuff
		/// from the style document to the text document. This is
		/// necessary for avoiding xml document owner errors.
		/// Notice: When the document will be saved this nodes have
		/// to move back to the styles document. Otherwise they wont
		/// work resp. diplayed not correct within OpenOffice.
		/// </remarks>
		public static void MoveMasterStyles(XmlDocument contentDocument,XmlNode nodeAutomaticStyles, XmlNode nodeMasterPages, XmlNamespaceManager namespaceMng)
		{
			// First import all automatic styles
			XmlNode contentAutomaticStyles = contentDocument.SelectSingleNode(
				"//office:automatic-styles", namespaceMng);
			if (contentAutomaticStyles != null && nodeAutomaticStyles.HasChildNodes)
			{
				foreach(XmlNode childNode in nodeAutomaticStyles.ChildNodes)
				{
					XmlNode importNode = contentDocument.ImportNode(childNode, true);
					contentAutomaticStyles.AppendChild(importNode);
				}
			}
			// Second import master pages
			XmlNode importedMasterPages = contentDocument.ImportNode(nodeMasterPages, true);
			contentDocument.LastChild.AppendChild(importedMasterPages);

			// clear nodes in style.xml
			nodeAutomaticStyles.RemoveAll();
			// clear master pages in style.xml
			nodeMasterPages.RemoveAll();
		}
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:37,代码来源:MasterPageFactory.cs

示例12: SetPropNodeValue

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Sets the value of a node to that found in the specified property. This method
        /// specially handles properties that are string collections.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetPropNodeValue(XmlNode propNode, SettingsPropertyValue propVal)
        {
            if (propVal.Property.PropertyType != typeof(StringCollection))
            {
                propNode.InnerText = propVal.SerializedValue.ToString();
                return;
            }

            if (propVal.PropertyValue == null)
                return;

            // At this point, we know we're dealing with a string collection, therefore,
            // create child nodes for each item in the collection.
            propNode.RemoveAll();
            var attrib = m_settingsXml.CreateAttribute(StrCollectionAttrib);
            attrib.Value = "true";
            propNode.Attributes.Append(attrib);
            int i = 0;
            foreach (string str in propVal.PropertyValue as StringCollection)
            {
                var node = m_settingsXml.CreateElement(propVal.Name + i++);
                node.AppendChild(m_settingsXml.CreateTextNode(str));
                propNode.AppendChild(node);
            }
        }
开发者ID:jen20,项目名称:skype-log-viewer,代码行数:31,代码来源:PortableSettings.cs

示例13: AdjustLabel

        private static void AdjustLabel(XmlNode node, TCodeStorage CodeStorage, XmlDocument AOrigLocalisedYaml)
        {
            XmlNode TranslatedNode = TXMLParser.FindNodeRecursive(AOrigLocalisedYaml, node.Name);
            string TranslatedLabel = string.Empty;

            if (TranslatedNode != null)
            {
                TranslatedLabel = TXMLParser.GetAttribute(TranslatedNode, "Label");
            }

            TControlDef ctrlDef = new TControlDef(node, CodeStorage);
            string Label = ctrlDef.Label;

            if ((ctrlDef.GetAttribute("NoLabel") == "true") || (ctrlDef.controlTypePrefix == "pnl")
                || (TXMLParser.FindNodeRecursive(node.OwnerDocument, "act" + ctrlDef.controlName.Substring(ctrlDef.controlTypePrefix.Length)) != null)
                || ctrlDef.GetAttribute("Action").StartsWith("act"))
            {
                Label = string.Empty;
            }

            if ((ctrlDef.controlTypePrefix == "rgr") && (TXMLParser.GetChild(node, "OptionalValues") != null))
            {
                ProcessRadioGroupLabels(node);
            }
            else if (ctrlDef.controlTypePrefix == "mni")
            {
                // drop all attributes
                node.Attributes.RemoveAll();

                foreach (XmlNode menu in node.ChildNodes)
                {
                    if (menu.Name.Contains("Separator"))
                    {
                        continue;
                    }

                    AdjustLabel(menu, CodeStorage, AOrigLocalisedYaml);
                }
            }
            else
            {
                // drop all attributes and children nodes
                node.RemoveAll();
            }

            if (Label.Length > 0)
            {
                if ((TranslatedLabel != Label) && (TranslatedLabel != Catalog.GetString(Label)) && (TranslatedLabel.Length > 0))
                {
                    // add to po file
                    if (!NewTranslations.ContainsKey(Label))
                    {
                        NewTranslations.Add(Label, TranslatedLabel);
                    }

                    TXMLParser.SetAttribute(node, "Label", TranslatedLabel);
                }
                else
                {
                    TXMLParser.SetAttribute(node, "Label", Catalog.GetString(Label));
                }
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:63,代码来源:GenerateYaml.cs

示例14: CreateStundenProfil

		private void CreateStundenProfil (XmlNode StundenProfilContainer, SortedList StundenProfil)
			{
			StundenProfilContainer.RemoveAll ();
			String OldMaschine = "";
			XmlNode MaschineNode = null;
			foreach (DictionaryEntry ProfilEntry in StundenProfil)
				{
				String [] EntryContent = ((String)ProfilEntry.Key).Split (' ');
				if (OldMaschine != EntryContent [0])
					{
					OldMaschine = EntryContent [0];
					MaschineNode = InsertContainerNode (StundenProfilContainer, OldMaschine);
					}
				InsertTextNode (MaschineNode, "H_" + EntryContent [1], (String) ProfilEntry.Value);
				}
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:16,代码来源:CommonValues.cs

示例15: SetPropertiesInstance

        /// <summary>
        /// Set the custom properties given the properties object
        /// </summary>
        /// <param name="node"></param>
        /// <param name="inst"></param>
        public void SetPropertiesInstance(XmlNode node, object inst)
        {
            node.RemoveAll();       // Get rid of all properties

            BarCodeProperties bcp = inst as BarCodeProperties;
            if (bcp == null)
                return;

            // NumberSystem
            CreateChild(node, "NumberSystem", bcp.NumberSystem);

            // ManufacturerCode
            CreateChild(node, "ManufacturerCode", bcp.ManufacturerCode);

            // ProductCode
            CreateChild(node, "ProductCode", bcp.ProductCode);
        }
开发者ID:Elboodo,项目名称:My-FyiReporting,代码行数:22,代码来源:BarCodeEAN13.cs


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