HandCoded.Xml.NodeIndex.GetElementsByName C# (CSharp) Method

GetElementsByName() public method

Creates a (possibly empty) XmlNodeList containing all the element nodes identified by the given name string.
public GetElementsByName ( string name ) : XmlNodeList
name string The name of the required elements.
return System.Xml.XmlNodeList
        public XmlNodeList GetElementsByName(string name)
        {
            return (elementsByName.ContainsKey (name) ? elementsByName [name] : MutableNodeList.EMPTY);
        }

Usage Example

        /// <summary>
        /// Evaluates this <see cref="Precondition"/> against the contents of the
        /// indicated <see cref="NodeIndex"/>.
        /// </summary>
        /// <param name="nodeIndex">The <see cref="NodeIndex"/> of a <see cref="XmlDocument"/>.</param>
        /// <param name="cache">A cache of previously evaluated precondition results.</param>
        /// <returns>A <see cref="bool"/> value indicating the applicability of this
        /// <see cref="Precondition"/> to the <see cref="XmlDocument"/>.</returns>
        public override bool Evaluate(NodeIndex nodeIndex, Dictionary<Precondition, bool> cache)
        {
            foreach (string rootElement in release.RootElements) {
                XmlNodeList list = nodeIndex.GetElementsByName (rootElement);

                if (list.Count == 1) {
                    XmlElement	fpml = list [0] as XmlElement;

                    if (fpml.LocalName.Equals("FpML"))
                        return (fpml.GetAttribute ("version").Equals (release.Version));
                    else
                        return (fpml.GetAttribute ("fpmlVersion").Equals (release.Version));
                }
            }
            return (false);
        }
All Usage Examples Of HandCoded.Xml.NodeIndex::GetElementsByName