GetElementsByTagName() публичный Метод

public GetElementsByTagName ( [ tagName ) : XmlNodeList
tagName [
Результат XmlNodeList
Пример #1
0
        private void ParseMPDElement()
        {
            Windows.Data.Xml.Dom.XmlElement root = document.DocumentElement;
            if (root.GetAttribute("type").ToLower().Equals("dynamic"))
            {
                manifest.IsLive = true;
            }
            if (root.GetAttribute("profiles").ToLower().Contains(LiveProfile))
            {
                manifest.IsSupportedProfile = true;
            }
            if (!root.GetAttribute("availabilityStartTime").Equals(""))
            {
                string availabilityStartTime = root.GetAttribute("availabilityStartTime");
                manifest.AvailibilityStartTime = XmlConvert.ToDateTimeOffset(availabilityStartTime);
            }
            if (!root.GetAttribute("minBufferTime").Equals(""))
            {
                string minBufferTime = root.GetAttribute("minBufferTime");
                manifest.MinBufferTime = XmlConvert.ToTimeSpan(minBufferTime);
            }
            if (!root.GetAttribute("minimumUpdatePeriod").Equals(""))
            {
                manifest.HasMinimumUpdatePeriod = true;
                string minUpdatePeriod = root.GetAttribute("minimumUpdatePeriod");
                manifest.MinimumUpdatePeriod = XmlConvert.ToTimeSpan(minUpdatePeriod);
            }
            if (!root.GetAttribute("mediaPresentationDuration").Equals(""))
            {
                manifest.HasPresentationDuration = true;
                string mediaPresentationDuration = root.GetAttribute("mediaPresentationDuration");
                manifest.MediaPresentationDuration = XmlConvert.ToTimeSpan(mediaPresentationDuration);
            }
            if (!root.GetAttribute("timeShiftBufferDepth").Equals(""))
            {
                string timeShiftBufferDepth = root.GetAttribute("timeShiftBufferDepth");
                manifest.TimeShiftBufferDepth = XmlConvert.ToTimeSpan(timeShiftBufferDepth);
            }
            if (!root.GetAttribute("publishTime").Equals(""))
            {
                string publishTime = root.GetAttribute("publishTime");
                manifest.PublishTime = XmlConvert.ToDateTimeOffset(publishTime);
            }
            else
            {
                manifest.PublishTime = DateTimeOffset.MinValue;
            }
            Windows.Data.Xml.Dom.XmlNodeList periods = root.GetElementsByTagName("Period");
            if (periods.Count() > 1)
            {
                manifest.HasMultiplePeriods = true;
            }

            IXmlNode lastPeriod = periods.Last <IXmlNode>();

            if (lastPeriod.Attributes.GetNamedItem("duration") != null)
            {
                manifest.LastPeriodDuration = XmlConvert.ToTimeSpan(lastPeriod.Attributes.GetNamedItem("duration").InnerText);
            }
        }
Пример #2
0
 string getNodeValue(XmlElement element, string name)
 {
     try
     {
         if (element.GetElementsByTagName(name).Count > 0)
         {
             return element.GetElementsByTagName(name)[0].InnerText;
         }
         return "";
     }
     catch (Exception e)
     {
         Debug.WriteLine("Problem geting value " + name + "element null" + (element == null) + " =" + (element.GetElementsByTagName(name) == null));
         Debug.WriteLine("element " + element.GetXml());
         return e.Message;
     }
 }
Пример #3
0
 string getNodeAttribute(XmlElement element, string node, string attribute)
 {
     try
     {
         if (element.GetElementsByTagName(node).Count > 0)
         {
             if (element.GetElementsByTagName(node)[0].Attributes.GetNamedItem(attribute) != null)
             {
                 return element.GetElementsByTagName(node)[0].Attributes.GetNamedItem(attribute).NodeValue.ToString();
             }
         }
         return "";
     }
     catch (Exception e)
     {
         Debug.WriteLine("Problem geting value " + attribute);
         Debug.WriteLine("element " + element.GetXml());
         return e.Message;
     }
 }
Пример #4
0
        private void SetText (XmlElement binding, string[] notifications)
        {
            var textElements = binding.GetElementsByTagName("text");

            if (textElements == null || textElements.Count == 0)
            {
                return;
            }

            for (var i = 0; i < Math.Min(4, notifications.Length); i++)
            {
                textElements[i].InnerText = notifications[i];
            }
        }
Пример #5
0
 private void SetImage(XmlElement binding, string imageSource)
 {
     var imageElements = binding.GetElementsByTagName("image");
     var imageSourceAttribute = imageElements[0].Attributes.GetNamedItem("src");
     imageSourceAttribute.NodeValue = imageSource;
 }