本文整理汇总了C#中System.Xml.XmlElement.AppendElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.AppendElement方法的具体用法?C# XmlElement.AppendElement怎么用?C# XmlElement.AppendElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.AppendElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSaveSettings
public override void OnSaveSettings(XmlElement moduleElement)
{
for (int i = 0; i < 5; i++)
{
XmlElement element = moduleElement.AppendElement("option" + i);
element.InnerText = "value " + (i*5);
moduleElement.AppendChild(element);
}
}
示例2: OnSaveSettings
public virtual void OnSaveSettings(XmlElement moduleElement)
{
foreach (var activablePart in Parts.OfType<IActivablePart>())
{
moduleElement.AppendElement(
activablePart.GetCodeName(),
activablePart.IsEnabled.ToString());
}
}
示例3: OnSaveSettings
public override void OnSaveSettings(XmlElement moduleElement)
{
base.OnSaveSettings(moduleElement);
foreach (var option in Enum.GetValues(typeof(ModOptions))
.OfType<ModOptions>()
.Where(o => o != 0))
{
moduleElement.AppendElement(
option.ToString().ToUpper(),
s_activeOptions.HasFlag(option).ToString());
}
}
示例4: CopyConfiguration
private static void CopyConfiguration(PackageGroup group, string parentName, string childName, XmlElement source, XmlElement target)
{
string aggregateXpath = string.Format("{0}/{1}/@name", parentName, childName);
List<string> names = group.FilterNames(source.Aggregate(aggregateXpath, XmlNamespaces.Manager));
if (names.Count != 0)
{
XmlNode parentNode = target.AppendElement(parentName.Replace("p:", string.Empty), XmlNamespaces.ProjectConfigurationNamespace);
foreach (string name in names)
{
string xpath = string.Format("{0}/{1}[@name='{2}']", parentName, childName, name);
parentNode.AppendChild(target.OwnerDocument.ImportNode(
source.SelectSingleNode(xpath, XmlNamespaces.Manager), true));
}
}
}
示例5: SynchronizeElements
private void SynchronizeElements(XmlElement targetElement, XmlElement sourceElement)
{
foreach (XmlAttribute attr in sourceElement.Attributes)
{
if (targetElement.Attributes[attr.Name] == null)
targetElement.SetAttribute(attr.Name, attr.Value);
}
foreach (XmlElement sourceChild in sourceElement.SelectNodes("*"))
{
XmlNamespaceManager nm = new XmlNamespaceManager(new NameTable());
nm.AddNamespace("temp", sourceElement.NamespaceURI);
XmlElement targetChild = targetElement.SelectSingleElement(string.Format("temp:{0}", sourceChild.LocalName), nm);
if (targetChild == null)
{
targetChild = targetElement.OwnerDocument.CreateElement(sourceChild.Name, sourceChild.NamespaceURI);
targetElement.AppendElement(targetElement.OwnerDocument.ImportNode(sourceChild, true));
}
this.SynchronizeElements(targetChild, sourceChild);
}
}