本文整理汇总了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());
}
示例2: SaveValue
/// <summary>
///
/// </summary>
/// <param name="node_"></param>
protected override void SaveValue(XmlNode node_)
{
node_.AddAttribute("varName", m_Value.Name);
}
示例3: Save
/// <summary>
///
/// </summary>
/// <param name="node_"></param>
public override void Save(XmlNode node_)
{
base.Save(node_);
node_.AddAttribute("ScriptElementID", GetScriptElement().ID.ToString());
}
示例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);
}
}
示例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;
}
}
示例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_);
}
}