本文整理汇总了C#中System.Xml.XmlNodeList类的典型用法代码示例。如果您正苦于以下问题:C# XmlNodeList类的具体用法?C# XmlNodeList怎么用?C# XmlNodeList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlNodeList类属于System.Xml命名空间,在下文中一共展示了XmlNodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WalkAddingMenuItems
private void WalkAddingMenuItems(XmlNodeList nodes, ToolStripMenuItem parent)
{
if (nodes != null) {
foreach (XmlNode n in nodes) {
ToolStripMenuItem curItem = null;
if (parent == null) {
curItem = ContextMenuStrip.Items.Add(n.Attributes["name"].Value) as ToolStripMenuItem;
} else {
curItem = parent.DropDownItems.Add(n.Attributes["name"].Value) as ToolStripMenuItem;
}
curItem.Name = n.Attributes["name"].Value;
var snippets = n.SelectNodes("snip");
foreach (XmlNode snippet in snippets) {
curItem.DropDownItems.Add(snippet.Attributes["name"].Value, null, delegate {
var sel = Environment.NewLine + SelectedText.Trim() + Environment.NewLine;
SelectedText = string.Format(snippet.InnerText.Trim(), sel) + Environment.NewLine;
});
}
WalkAddingMenuItems(n.SelectNodes("node"), curItem);
}
}
}
示例2: AreEqual
public static void AreEqual(XmlNodeList ctrNodes, List<Grower> growers, Dictionary<string, List<UniqueId>> linkList)
{
for (var i = 0; i < ctrNodes.Count; i++)
{
AreEqual(ctrNodes[i], growers[i], linkList);
}
}
示例3: ParseXML
public void ParseXML(XmlNodeList node)
{
foreach (XmlNode node2 in node)
{
//Debug.WriteLine("\tConnection Node >" + node2.Value + " : " + node2.Name);
//Debug.WriteLine("\tConnection Node >" + node2.FirstChild.Value + " : " + node2.FirstChild.Name);
switch (node2.Name)
{
case ("Type"):
{
type = node2.FirstChild.Value;
break;
}
case("URL"):
{
url = node2.FirstChild.Value;
break;
}
case("Metric"):
{
metric = Convert.ToInt32(node2.FirstChild.Value);
break;
}
}
}
}
示例4: IsIndexColumn
private static bool IsIndexColumn(string name, XmlNodeList indexes)
{
foreach (XmlNode index in indexes)
if (index["primary"].InnerText == name)
return true;
return false;
}
示例5: getInformation
// ==================== METHODS ============================================
public bool getInformation(String sId, ref XmlNodeList ndList, ref XmlNode ndMovie)
{
try {
// Check if we currently have information on this movie
if (sId != this.idMovie) {
int iWaitTime = 1; // Number of seconds to wait
// Try get information
String sUrl = sBaseUrl + "idmovie-" + sId + "/xml";
String sContent = WebRequestGetData(sUrl);
while (!sContent.StartsWith ("<") ) {
// Try again
sContent = WebRequestGetData(sUrl);
// Check what we receive back
if (sContent == null) {
// Indicate that this is a premature end
errHandle.Status("getInformation: webrequest time-out");
return false;
}
}
// Read as XmlDocument
pdxMovie.LoadXml(sContent);
// Set the currnet idmovie
this.idMovie = sId;
}
// Set the list of nodes for this move
ndList = pdxMovie.SelectNodes("./descendant::subtitle");
ndMovie = pdxMovie.SelectSingleNode("./descendant::Movie");
return true;
} catch (Exception ex) {
errHandle.DoError("osrMoview/getInformation", ex);
return false;
}
}
示例6: TopAlbum
public TopAlbum(XmlNodeList list)
{
foreach (XmlNode node in list)
{
switch (node.LocalName)
{
case "name":
this.name = node.InnerText;
break;
case "reach":
this.reach = node.InnerText;
break;
case "url":
this.url = node.InnerText;
break;
case "image":
foreach (XmlNode image_node in node.ChildNodes)
if (image_node.LocalName == "large")
image = image_node.InnerText;
break;
}
}
}
示例7: FillInCandidates
private static void FillInCandidates(Dictionary<string, UserInfo> candidates, XmlNodeList nodes, StreamWriter writer)
{
foreach (XmlNode userNode in nodes)
{
string userName = userNode.Attributes["name"].Value;
int edits = int.Parse(userNode.Attributes["editcount"].Value);
XmlNode editorNode = userNode.SelectSingleNode("//user[@name=" + EscapeXPathQuery(userName) + "]/groups[g='editor' or g='autoeditor' or g='sysop']/g");
if (editorNode != null)
{
writer.WriteLine(userName);
}
else if (edits > 500 && !candidates.ContainsKey(userName))
{
UserInfo userInfo = new UserInfo();
userInfo.User = userName;
userInfo.Edits = edits;
if (!string.IsNullOrEmpty(userNode.Attributes["registration"].Value))
{
userInfo.Registration = DateTime.Parse(userNode.Attributes["registration"].Value,
null,
System.Globalization.DateTimeStyles.AssumeUniversal);
}
candidates.Add(userName, userInfo);
}
}
}
示例8: LoadCustomConfiguration
/// <summary>
/// Load custom configuration from Xml
/// </summary>
/// <param name="customConfigElements">SAML token authentication requirements.</param>
/// <exception cref="ArgumentNullException">Input parameter 'customConfigElements' is null.</exception>
/// <exception cref="InvalidOperationException">Custom configuration specified was invalid.</exception>
public override void LoadCustomConfiguration(XmlNodeList customConfigElements)
{
if (customConfigElements == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("customConfigElements");
}
List<XmlElement> configNodes = XmlUtil.GetXmlElements(customConfigElements);
bool foundValidConfig = false;
foreach (XmlElement configElement in configNodes)
{
if (configElement.LocalName != ConfigurationStrings.SamlSecurityTokenRequirement)
{
continue;
}
if (foundValidConfig)
{
throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID7026, ConfigurationStrings.SamlSecurityTokenRequirement));
}
this.samlSecurityTokenRequirement = new SamlSecurityTokenRequirement(configElement);
foundValidConfig = true;
}
if (!foundValidConfig)
{
this.samlSecurityTokenRequirement = new SamlSecurityTokenRequirement();
}
}
示例9: ParserMembers
protected override IDictionary<string, IMemberAttribute> ParserMembers(string typeFullName,
XmlNodeList memberNodes)
{
if (string.IsNullOrEmpty(typeFullName))
{
throw new ArgumentNullException("typeFullName");
}
object target = MemberCache.Get(typeFullName);
if (null == memberNodes || 0 == memberNodes.Count)
{
if (null == target)
{
return null;
}
return (IDictionary<string, IMemberAttribute>) target;
}
foreach (XmlNode node in memberNodes)
{
ParserMember(typeFullName, node);
}
if (null == target)
{
throw new Exception("Get the members attribute is error.");
}
return (IDictionary<string, IMemberAttribute>) target;
}
示例10: ErrorElementAdapter
public ErrorElementAdapter(XmlNodeList errorNodes, WixFiles wixFiles)
: base(wixFiles)
{
foreach (object o in errorNodes) {
this.errorNodes.Add(o);
}
}
示例11: Load
public static GuidanceShift Load(XmlNodeList inputNode, TaskDataDocument taskDataDocument)
{
var loader = new GuidanceShiftLoader(taskDataDocument);
var node = inputNode.Item(0);
return loader.Load(node);
}
示例12: ToString
public static string ToString(XmlNodeList nodes)
{
StringBuilder sb = new StringBuilder();
try
{
foreach (XmlNode node in nodes)
{
sb.AppendLine(node.OuterXml);
}
string s = "<Root>" + sb.ToString() + "</Root>";
s = Indent(s);
s = UStr.TrimStart(s, "<Root>");
s = UStr.TrimEnd(s, "</Root>");
return s;
}
catch
{
return "";
}
}
示例13: SimpleWebTokenTrustedIssuersRegistry
public SimpleWebTokenTrustedIssuersRegistry(XmlNodeList customConfiguration)
{
this.configuredTrustedIssuers = new Dictionary<string, string>();
if (customConfiguration == null)
{
throw new ArgumentNullException("customConfiguration");
}
List<XmlElement> xmlElements = GetXmlElements(customConfiguration);
if (xmlElements.Count != 1)
{
throw new InvalidOperationException("There should be only one xml element as the configuration of this class");
}
XmlElement element = xmlElements[0];
if (!StringComparer.Ordinal.Equals(element.LocalName, "trustedIssuers"))
{
throw new InvalidOperationException("The top element of the configuration should be named 'trustedIssuers'");
}
foreach (XmlNode node in element.ChildNodes)
{
XmlElement addRemoveNode = node as XmlElement;
if (addRemoveNode != null)
{
if (StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "add"))
{
XmlNode issuerIdentifierNode = addRemoveNode.Attributes.GetNamedItem("issuerIdentifier");
XmlNode nameNode = addRemoveNode.Attributes.GetNamedItem("name");
if (((addRemoveNode.Attributes.Count != 2) || (issuerIdentifierNode == null)) || ((nameNode == null) || string.IsNullOrEmpty(nameNode.Value)))
{
throw new InvalidOperationException("The <add> element is malformed. The right format is: <add issuerIdentifier=\"issuer identifier\" name=\"issuer friendly name\"");
}
string issuerIdentifier = issuerIdentifierNode.Value.ToLowerInvariant();
string name = string.Intern(nameNode.Value);
this.configuredTrustedIssuers.Add(issuerIdentifier, name);
}
else if (StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "remove"))
{
if ((addRemoveNode.Attributes.Count != 1) || !StringComparer.Ordinal.Equals(addRemoveNode.Attributes[0].LocalName, "issuerIdentifier"))
{
throw new InvalidOperationException("The <remove> node should have a issuerIdentifier attribute");
}
string issuerIdentifier = addRemoveNode.Attributes.GetNamedItem("issuerIdentifier").Value;
this.configuredTrustedIssuers.Remove(issuerIdentifier);
}
else
{
if (!StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "clear"))
{
throw new InvalidOperationException(string.Format("Invalid element: {0}", addRemoveNode.LocalName));
}
this.configuredTrustedIssuers.Clear();
}
}
}
}
示例14: ProgressTextElementAdapter
public ProgressTextElementAdapter(XmlNodeList progressTextNodes, WixFiles wixFiles)
: base(wixFiles)
{
foreach (object o in progressTextNodes) {
this.progressTextNodes.Add(o);
}
}
示例15: UnfurlNodes
public List<AvinodeMenuItem> UnfurlNodes(XmlNodeList xmlNodes)
{
var avinodeMenuItems = new List<AvinodeMenuItem>();
foreach (XmlNode node in xmlNodes)
{
var displayName = node["displayName"];
var nodePath = node["path"];
var subMenu = node.SelectNodes("subMenu/item");
if (displayName != null && nodePath != null)
{
var uriPath = new Uri(nodePath.Attributes["value"].Value, UriKind.Relative);
var subMenuItem = subMenu != null && subMenu.Count > 0 ? UnfurlNodes(subMenu) : null;
var isActive = RelativeUri == uriPath || (subMenuItem != null && subMenuItem.Any(menuItem => menuItem.Active));
avinodeMenuItems.Add(new AvinodeMenuItem
{
DisplayName = displayName.InnerText,
Path = uriPath,
Active = isActive,
SubMenuItem = subMenuItem
});
}
}
return avinodeMenuItems;
}