當前位置: 首頁>>代碼示例>>C#>>正文


C# Xml.XmlNodeList類代碼示例

本文整理匯總了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);
                }
            }
        }
開發者ID:u89012,項目名稱:Bootpad,代碼行數:26,代碼來源:Editors.cs

示例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);
     }
 }
開發者ID:ADAPT,項目名稱:ISOv4Plugin,代碼行數:7,代碼來源:GrowerAssert.cs

示例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;
                 }
         }
     }
 }
開發者ID:keithloughnane,項目名稱:Omnipresent,代碼行數:26,代碼來源:Connection.cs

示例4: IsIndexColumn

 private static bool IsIndexColumn(string name, XmlNodeList indexes)
 {
     foreach (XmlNode index in indexes)
         if (index["primary"].InnerText == name)
             return true;
     return false;
 }
開發者ID:PalWow,項目名稱:dbcviewer,代碼行數:7,代碼來源:DefinitionEditor.cs

示例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;
       }
 }
開發者ID:ErwinKomen,項目名稱:subtiel,代碼行數:34,代碼來源:osrMovie.cs

示例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;
                }
            }
        }
開發者ID:gsterjov,項目名稱:fusemc,代碼行數:26,代碼來源:TopAlbum.cs

示例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);
                }
            }
        }
開發者ID:Claymore,項目名稱:WikiBots,代碼行數:27,代碼來源:Program.cs

示例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();
            }
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:39,代碼來源:Saml2SecurityTokenHandler.cs

示例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;
        }
開發者ID:mbsky,項目名稱:albian,代碼行數:28,代碼來源:PersistenceParser.cs

示例10: ErrorElementAdapter

 public ErrorElementAdapter(XmlNodeList errorNodes, WixFiles wixFiles)
     : base(wixFiles)
 {
     foreach (object o in errorNodes) {
         this.errorNodes.Add(o);
     }
 }
開發者ID:xwiz,項目名稱:WixEdit,代碼行數:7,代碼來源:ErrorElementAdapter.cs

示例11: Load

        public static GuidanceShift Load(XmlNodeList inputNode, TaskDataDocument taskDataDocument)
        {
            var loader = new GuidanceShiftLoader(taskDataDocument);

            var node = inputNode.Item(0);
            return loader.Load(node);
        }
開發者ID:ADAPT,項目名稱:ISOv4Plugin,代碼行數:7,代碼來源:GuidanceShiftLoader.cs

示例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 "";
            }
        }
開發者ID:Erls-Corporation,項目名稱:Singularity1.0,代碼行數:26,代碼來源:UXml.cs

示例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();
                    }
                }
            }
        }
開發者ID:junleqian,項目名稱:Mobile-Restaurant,代碼行數:60,代碼來源:SimpleWebTokenTrustedIssuersRegistry.cs

示例14: ProgressTextElementAdapter

 public ProgressTextElementAdapter(XmlNodeList progressTextNodes, WixFiles wixFiles)
     : base(wixFiles)
 {
     foreach (object o in progressTextNodes) {
         this.progressTextNodes.Add(o);
     }
 }
開發者ID:xwiz,項目名稱:WixEdit,代碼行數:7,代碼來源:ProgressTextElementAdapter.cs

示例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;
        }
開發者ID:chaim1221,項目名稱:ParsingXml,代碼行數:26,代碼來源:Helper.cs


注:本文中的System.Xml.XmlNodeList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。