本文整理汇总了C#中System.Xml.XmlNode.GetStringAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.GetStringAttribute方法的具体用法?C# XmlNode.GetStringAttribute怎么用?C# XmlNode.GetStringAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.GetStringAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSingleFormHtml
private static void AddSingleFormHtml(XmlNode node, StringBuilder builder, string label)
{
var lang = node.GetStringAttribute("lang");
builder.AppendFormat("<tr><td><span class='fieldLabel'>{0}</span><span class='langid'>{1}</span></td>", label, lang);
if (node.InnerText.Trim().EndsWith(".wav"))
{
builder.AppendFormat("<td>(a sound file)</td></tr>");
}
else
{
builder.AppendFormat("<td><span class='{0}'>{1}</span><br/></td></tr>", lang, node.InnerText);
}
}
示例2: FromXml
//
// public void WriteXml(XmlWriter writer)
// {
// writer.WriteStartElement("MergeSituation");
// writer.WriteAttributeString("PathToFileInRepository",this.PathToFileInRepository);
// writer.WriteEndElement();
// }
public static MergeSituation FromXml(XmlNode node)
{
var modeLabel = node.GetOptionalStringAttribute("conflictHandlingMode",
string.Empty);
MergeOrder.ConflictHandlingModeChoices mode;
try
{
mode =
(MergeOrder.ConflictHandlingModeChoices)
Enum.Parse(typeof (MergeOrder.ConflictHandlingModeChoices),
modeLabel);
}
catch (Exception)
{
mode = MergeOrder.ConflictHandlingModeChoices.Unknown;
}
//Note, we can't use the normal construtor, because it switches who is alpha/beta
//depending on the conflict handling mode. We don't want to switch them again
//when we're re-constituting the situation
var situation = new MergeSituation(node.GetStringAttribute("path"), mode);
situation.AlphaUserId = node.GetStringAttribute("alphaUserId");
situation.AlphaUserRevision = node.GetStringAttribute("alphaUserRevision");
situation.BetaUserId = node.GetStringAttribute("betaUserId");
situation.BetaUserRevision = node.GetStringAttribute("betaUserRevision");
return situation;
}