Windows.Data.Xml.Dom.XmlDocument.SelectNodes C# (CSharp) Method

SelectNodes() public method

public SelectNodes ( [ xpath ) : XmlNodeList
xpath [
return XmlNodeList
		public extern XmlNodeList SelectNodes([In] string xpath);
		public extern IXmlNode SelectSingleNodeNS([In] string xpath, [Variant] [In] object namespaces);

Usage Example

        public static void CompleteTemplate(XmlDocument xml, string[] text, string[] images = null, string sound = null)
        {
            XmlNodeList slots = xml.SelectNodes("descendant-or-self::image");
            int index = 0;

            if ((images != null) && (slots != null))
            {
                while ((index < images.Length) && (index < slots.Length))
                {
                    ((XmlElement)slots[index]).SetAttribute("src", images[index]);
                    index++;
                }
            }

            if (text != null)
            {
                slots = xml.SelectNodes("descendant-or-self::text");
                index = 0;

                while ((slots != null) && ((index < text.Length) && (index < slots.Length)))
                {
                    slots[index].AppendChild(xml.CreateTextNode(text[index]));
                    index++;
                }
            }

            if (!string.IsNullOrEmpty(sound))
            {
                var audioElement = xml.CreateElement("audio");
                audioElement.SetAttribute("src", sound);
                xml.DocumentElement.AppendChild(audioElement);
            }
        }
All Usage Examples Of Windows.Data.Xml.Dom.XmlDocument::SelectNodes