本文整理汇总了C#中IXmlDocument.GetElementsByTagName方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlDocument.GetElementsByTagName方法的具体用法?C# IXmlDocument.GetElementsByTagName怎么用?C# IXmlDocument.GetElementsByTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmlDocument
的用法示例。
在下文中一共展示了IXmlDocument.GetElementsByTagName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetImageSrc
static void SetImageSrc(IXmlDocument xmldoc, string imagePath) {
IXmlNodeList nodes;
int res = xmldoc.GetElementsByTagName("image", out nodes);
ComFunctions.CheckHRESULT(res);
IXmlNode imageNode;
res = nodes.Item(0, out imageNode);
ComFunctions.CheckHRESULT(res);
IXmlNode srcAttribute;
res = imageNode.Attributes.GetNamedItem("src", out srcAttribute);
ComFunctions.CheckHRESULT(res);
SetNodeValueString(imagePath, xmldoc, srcAttribute);
}
示例2: SetDuration
static void SetDuration(IXmlDocument xmldoc, NotificationDuration duration) {
IXmlNodeList nodes;
ComFunctions.CheckHRESULT(xmldoc.GetElementsByTagName("toast", out nodes));
IXmlNode toastNode;
ComFunctions.CheckHRESULT(nodes.Item(0, out toastNode));
((IXmlElement)toastNode).SetAttribute("duration", "long");
}
示例3: SetSound
static void SetSound(IXmlDocument xmldoc, PredefinedSound sound) {
string soundXml = "ms-winsoundevent:" + sound.ToString().Replace("_", ".");
IXmlElement soundElement;
ComFunctions.CheckHRESULT(xmldoc.CreateElement("audio", out soundElement));
if(sound == PredefinedSound.NoSound) {
ComFunctions.CheckHRESULT(soundElement.SetAttribute("silent", "true"));
}
else {
ComFunctions.CheckHRESULT(soundElement.SetAttribute("src", soundXml));
ComFunctions.CheckHRESULT(soundElement.SetAttribute("loop", IsLoopingSound(sound).ToString().ToLower()));
}
var asNode = (IXmlNode)xmldoc;
IXmlNode appendedChild;
IXmlNodeList nodes;
ComFunctions.CheckHRESULT(xmldoc.GetElementsByTagName("toast", out nodes));
IXmlNode toastNode;
ComFunctions.CheckHRESULT(nodes.Item(0, out toastNode));
ComFunctions.CheckHRESULT(toastNode.AppendChild((IXmlNode)soundElement, out appendedChild));
}
示例4: SetTextLine
static void SetTextLine(IXmlDocument xmldoc, uint index, string text) {
IXmlNodeList nodes;
ComFunctions.CheckHRESULT(xmldoc.GetElementsByTagName("text", out nodes));
Debug.Assert(nodes.Length >= index + 1);
IXmlNode node;
ComFunctions.CheckHRESULT(nodes.Item(index, out node));
SetNodeValueString(text, xmldoc, node);
}