當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlNode.AddAttribute方法代碼示例

本文整理匯總了C#中System.Xml.XmlNode.AddAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlNode.AddAttribute方法的具體用法?C# XmlNode.AddAttribute怎麽用?C# XmlNode.AddAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.AddAttribute方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Save

 /// <summary>
 /// 
 /// </summary>
 /// <param name="node_"></param>
 public override void Save(XmlNode node_)
 {
     base.Save(node_);
     node_.AddAttribute("functionID", GetFunction().Id.ToString());
 }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:9,代碼來源:ReturnNode.cs

示例2: SaveValue

 /// <summary>
 /// 
 /// </summary>
 /// <param name="node_"></param>
 protected override void SaveValue(XmlNode node_)
 {
     node_.AddAttribute("varName", m_Value.Name);
 }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:8,代碼來源:NamedVariableNode.cs

示例3: Save

 /// <summary>
 /// 
 /// </summary>
 /// <param name="node_"></param>
 public override void Save(XmlNode node_)
 {
     base.Save(node_);
     node_.AddAttribute("ScriptElementID", GetScriptElement().ID.ToString());
 }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:9,代碼來源:ScriptNode.cs

示例4: Save

        /// <summary>
        /// 
        /// </summary>
        /// <param name="seqNodeNode_"></param>
        public virtual void Save(XmlNode seqNodeNode_)
        {
            const int version = 1;
            seqNodeNode_.AddAttribute("version", version.ToString());

            seqNodeNode_.AddAttribute("comment", Comment);
            seqNodeNode_.AddAttribute("id", Id.ToString());

            string typeName = GetType().AssemblyQualifiedName;
            int index = typeName.IndexOf(',', typeName.IndexOf(',') + 1);
            typeName = typeName.Substring(0, index);
            seqNodeNode_.AddAttribute("type", typeName);

            //Save slots
            foreach (NodeSlot slot in m_Slots)
            {
                XmlNode nodeSlot = seqNodeNode_.OwnerDocument.CreateElement("Slot");
                seqNodeNode_.AppendChild(nodeSlot);
                slot.Save(nodeSlot);
            }
        }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:25,代碼來源:SequenceNode_Editor.cs

示例5: BuildTree

        private static IEnumerable<XmlNode> BuildTree(XmlReader xmlReader, int level)
        {
            while (xmlReader.Read() )
            {
                if (xmlReader.NodeType == XmlNodeType.EndElement) yield break;

                var node = new XmlNode
                {
                    NodeType = xmlReader.NodeType,
                    Name = xmlReader.Name,
                    NamespaceURI = xmlReader.NamespaceURI ?? "",
                    Value = xmlReader.Value,
                    Level = level,
                    IsEmpty = xmlReader.IsEmptyElement
                };

                if (node.NodeType == XmlNodeType.Element || node.NodeType == XmlNodeType.DocumentType)
                {
                    int attributeCount = xmlReader.AttributeCount;
                    for (int i = 0; i < attributeCount; i++)
                    {
                        xmlReader.MoveToAttribute(i);

                        var attribute = new XmlAttribute
                        {
                            Name = xmlReader.Name, 
                            Value = xmlReader.Value
                        };

                        node.AddAttribute(attribute);
                    }

                    if (node.NodeType == XmlNodeType.Element)
                    {
                        if (!node.IsEmpty)
                        {
                            foreach (XmlNode childNode in BuildTree(xmlReader, level + 1))
                            {
                                node.AddChild(childNode);
                            }
                        }
                    }
                }

                yield return node;
            }
        }
開發者ID:DBailey635,項目名稱:C1-CMS,代碼行數:47,代碼來源:XhtmlPrettifier.cs

示例6: Save

        /// <summary>
        /// 
        /// </summary>
        /// <param name="node_"></param>
        public override void Save(XmlNode node_)
        {
            base.Save(node_);

            node_.AddAttribute("saveValue", m_SaveValue.ToString());

            if (m_SaveValue == true)
            {
                m_Value.Save(node_);
            }
        }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:15,代碼來源:NodeSlot.cs


注:本文中的System.Xml.XmlNode.AddAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。