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


C# XmlDocument.GetElementsByTagName方法代碼示例

本文整理匯總了C#中Windows.Data.Xml.Dom.XmlDocument.GetElementsByTagName方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlDocument.GetElementsByTagName方法的具體用法?C# XmlDocument.GetElementsByTagName怎麽用?C# XmlDocument.GetElementsByTagName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.Data.Xml.Dom.XmlDocument的用法示例。


在下文中一共展示了XmlDocument.GetElementsByTagName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetNotificacion

        public override TileNotification GetNotificacion()
        {
            tile = new XmlDocument();            
            tile.LoadXml(stile);

            //System.Diagnostics.Debug.Write(tile.GetXml());

            var nodevisual = tile.GetElementsByTagName("binding");
            if (Title != null && Title != "")
            {
                ((XmlElement)nodevisual[1]).SetAttribute("displayName", this.Title);
            }

            var nodeImage = tile.GetElementsByTagName("image");
            ((Windows.Data.Xml.Dom.XmlElement)nodeImage[0]).SetAttribute("src", BackgroundImage.OriginalString);
            ((Windows.Data.Xml.Dom.XmlElement)nodeImage[1]).SetAttribute("src", BackgroundImage.OriginalString);
            //((Windows.Data.Xml.Dom.XmlElement)nodeImage[2]).SetAttribute("src", BackgroundImage.OriginalString);

            var nodeText = tile.GetElementsByTagName("text");
            nodeText[0].InnerText = BackTitle.ToString();
            nodeText[1].InnerText = BackContent.ToString();
            //nodeText[2].InnerText = BackContent.ToString();

            //System.Diagnostics.Debug.Write(this.tile.GetXml());
            var tileNotc = new TileNotification(this.tile);           
            return tileNotc;
        }
開發者ID:karolzak,項目名稱:MVA-Channel9,代碼行數:27,代碼來源:StandardTileData.cs

示例2: SetTileImages

 private static void SetTileImages(XmlDocument xmlDocument, params string[] images)
 {
     if (images != null)
     {
         try
         {
             var imageElements = xmlDocument.GetElementsByTagName("image").ToArray();
             for (int n = 0; n < images.Length; n++)
             {
                 var imageElement = imageElements[n] as XmlElement;
                 if (images[n].StartsWith("ms-appx:", StringComparison.OrdinalIgnoreCase) || images[n].StartsWith("ms-appdata:", StringComparison.OrdinalIgnoreCase))
                 {
                     imageElement.SetAttribute("src", images[n]);
                 }
                 else
                 {
                     imageElement.SetAttribute("src", String.Format("ms-appx:///Assets/{0}", images[n]));
                 }
             }
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex);
         }
     }
 }
開發者ID:ricardodemauro,項目名稱:TradeBeansApp,代碼行數:26,代碼來源:TileServices.cs

示例3: actionsToast

 public static async void actionsToast(string title, string content, string id)
 {
     string xml = "<toast>" +
                     "<visual>" +
                         "<binding template=\"ToastGeneric\">" +
                             "<text></text>" +
                             "<text></text>" +
                         "</binding>" +
                     "</visual>" +
                     "<actions>" +
                         "<input id=\"content\" type=\"text\" placeHolderContent=\"請輸入評論\" />" +
                         "<action content = \"確定\" arguments = \"ok" + id + "\" activationType=\"background\" />" +
                         "<action content = \"取消\" arguments = \"cancel\" activationType=\"background\"/>" +
                     "</actions >" +
                  "</toast>";
     // 創建並加載XML文檔
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(xml);
     XmlNodeList elements = doc.GetElementsByTagName("text");
     elements[0].AppendChild(doc.CreateTextNode(title));
     elements[1].AppendChild(doc.CreateTextNode(content));
     // 創建通知實例
     ToastNotification notification = new ToastNotification(doc);
     //// 顯示通知
     //DateTime statTime = DateTime.Now.AddSeconds(10);  //指定應傳遞 Toast 通知的時間
     //ScheduledToastNotification recurringToast = new ScheduledToastNotification(doc, statTime);  //創建計劃的 Toast 通知對象
     //ToastNotificationManager.CreateToastNotifier().AddToSchedule(recurringToast); //向計劃中添加 Toast 通知
     ToastNotifier nt = ToastNotificationManager.CreateToastNotifier();
     nt.Show(notification);
 }
開發者ID:RedrockMobile,項目名稱:CyxbsMobile_Win,代碼行數:30,代碼來源:Utils.cs

示例4: ToastText

        public ToastText(string message, ToastTemplateType type)
        {
            xmlDoc = ToastNotificationManager.GetTemplateContent(type);
            var textTag = xmlDoc.GetElementsByTagName("text").First();
            textTag.AppendChild(xmlDoc.CreateTextNode(message));

        }
開發者ID:garicchi,項目名稱:Neuronia,代碼行數:7,代碼來源:Toast.cs

示例5: RefreshClubMembers

 public async Task<MembersReport> RefreshClubMembers()
 {
     MembersReport membersReport;
     var responseMessage = await ExecuteMembersRequest();
     var xml = await responseMessage.Content.ReadAsStringAsync();
     if (responseMessage.StatusCode == HttpStatusCode.InternalServerError && xml.Contains("InvalidSessionFault"))
     {
         var report = await _authenticationService.LoginWithStoredCredentials();
         if (report.Successful)
             await RefreshClubMembers();
         else
         {
             membersReport = new MembersReport(false, null) { Error = report.Error };
             return membersReport;
         }
     }
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(xml);
     var members = new List<Member>();
     var nodeList = doc.GetElementsByTagName("b:MemberIdentification");
     foreach (var memberNode in nodeList)
     {
         var node = memberNode.ChildNodes.FirstOrDefault(c => c.NodeName == "Name");
         members.Add(new Member(node.InnerText));
     }
     var storageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("members.txt", CreationCollisionOption.OpenIfExists);
     await FileIO.WriteTextAsync(storageFile, JsonConvert.SerializeObject(members));
     membersReport = new MembersReport(true, members);
     return membersReport;
 }
開發者ID:thewindev,項目名稱:Toastmaster-Tools,代碼行數:30,代碼來源:MembersRepository.cs

示例6: AppendImageToNotification

        private static void AppendImageToNotification(ToastContent toastContent, XmlDocument xml)
        {
            var imageElements = xml.GetElementsByTagName(ImageNode);
            if (!imageElements.Any())
                return;

            ((XmlElement)imageElements[0]).SetAttribute(SrcAttr, toastContent.Image ?? string.Empty);
            ((XmlElement)imageElements[0]).SetAttribute(AltAttr, toastContent.AltText ?? string.Empty);
        }
開發者ID:DanTheManSWE,項目名稱:Template10,代碼行數:9,代碼來源:ToastHelper.cs

示例7: WriteAutoCommandsToHandler

        protected void WriteAutoCommandsToHandler(XmlDocument voiceXml)
        {
            var commandSet = voiceXml.GetElementsByTagName("Command").Where(n => n.Attributes.GetNamedItem("Name").NodeValue.ToString().StartsWith("auto"));
            foreach (var c in commandSet)
            {

                VoiceHandler.AddCommand(GenerateAutoVoiceCommand(c));
            }
        }
開發者ID:CRuppert,項目名稱:CortanaMyWife,代碼行數:9,代碼來源:Bootstrap.cs

示例8: OnHtmlChanged

        private static void OnHtmlChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs)
        {
            RichTextBlock parent = (RichTextBlock)sender;
            parent.Blocks.Clear();

            XmlDocument document = new XmlDocument();
            document.LoadXml((string)eventArgs.NewValue);

            ParseElement((XmlElement)(document.GetElementsByTagName("body")[0]), new RichTextBlockTextContainer(parent));
        }
開發者ID:paratodosyparanadie,項目名稱:HtmlToXaml,代碼行數:10,代碼來源:ItemDetailPage.xaml.cs

示例9: ParseChapter

        public static Chapter ParseChapter(string html)
        {
            Chapter chapter = new Chapter();
            XmlDocument document = new XmlDocument();
            document.LoadXml(html);

            ParseElement((XmlElement)(document.GetElementsByTagName("body")[0]), chapter, Style.NORMAL);

            return chapter;
        }
開發者ID:nguyer,項目名稱:OpenBible,代碼行數:10,代碼來源:ChapterParser.cs

示例10: ConvertHtmlToRtf

        public static BlockCollection ConvertHtmlToRtf(string html)
        {
            RichTextBlock parent = new RichTextBlock();
            XmlDocument document = new XmlDocument();
            document.LoadXml(html);

            ParseElement((XmlElement)(document.GetElementsByTagName("body")[0]), new RichTextBlockTextContainer(parent));

            return parent.Blocks;
        }
開發者ID:nguyer,項目名稱:OpenBible,代碼行數:10,代碼來源:NewHtmlToRtfConverter.cs

示例11: listApps

        /*
        public static List<Apps> listApps()
        {
            List<AppInfo> mFileList = new List<AppInfo>();
            SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
            Resources res = context.getResources();
            AssetManager am = res.getAssets();
            string appList[], iconList[];
            try
            {
                appList = am.list("Apps");
                iconList = am.list("Icons");
                if (appList != null)
                {
                    for (int i = 0; i < appList.length; i++)
                    {
                        AppInfo app = new AppInfo();
                        app.Name = (appList[i].substring(0, appList[i].indexOf(".buildmlearn")));
                        if (!SP.contains(app.Name))
                        {
                            SharedPreferences.Editor editor1 = SP.edit();
                            editor1.putBoolean(app.Name, false);
                            editor1.commit(); continue;
                        }
                        if (!SP.getBoolean(app.Name, false)) continue;

                        app.AppIcon = BitmapFactory.decodeStream(am.open("Icons/" + iconList[i]));
                        BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("Apps/" + appList[i])));
                        string type = br.readLine();
                        if (type.contains("InfoTemplate")) app.Type = 0;
                        else if (type.contains("QuizTemplate")) app.Type = 2;
                        else if (type.contains("FlashCardsTemplate")) app.Type = 1;
                        else if (type.contains("SpellingTemplate")) app.Type = 3;
                        br.readLine();
                        type = br.readLine();
                        int x = type.indexOf("<name>") + 6;
                        int y = type.indexOf("<", x + 1);
                        app.Author = type.substring(x, y);
                        mFileList.add(app);
                    }
                }
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            AppList = mFileList;
            return mFileList;
        }
        */
        /// <summary>
        /// It reads the Info App-Template, from the .buildmlearn file.
        /// </summary>
        /// <param name="fileName">Name of the file</param>
        public static void readInfoFile(string fileName)
        {
            try
            {
                InfoModel model = InfoModel.getInstance();
                List<string> infoTitleList = new List<string>();
                List<string> infoDescriptionList = new List<string>();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
                model.setInfoName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
                model.setInfoDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
                string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
                model.setInfoAuthor(author[1].Trim());
                model.setInfoAuthorEmail(author[2].Trim());
                model.setInfoVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
                XmlNodeList info_title = doc.GetElementsByTagName("item_title");
                XmlNodeList info_description = doc.GetElementsByTagName("item_description");
                for (int i = 0; i < info_title.Length; i++)
                {
                    infoTitleList.Add(info_title.ElementAt(i).InnerText.Trim());
                    infoDescriptionList.Add(info_description.ElementAt(i).InnerText.Trim());
                }
                model.setInfoTitleList(infoTitleList);
                model.setInfoDescriptionList(infoDescriptionList);
            }
            catch (Exception e)
            { }
        }
開發者ID:BuildmLearn,項目名稱:BuildmLearn-Store,代碼行數:82,代碼來源:AppReader.cs

示例12: parse

        public async Task parse(string url)
        {
            doc = new XmlDocument();
            string xml = await getXML(url);
            xmlStr = xml.Replace("itunes:", "itunes-");
            doc.LoadXml(xmlStr);

            itemCount = doc.GetElementsByTagName("item").Count;

            foreach (XmlElement elem in doc.GetElementsByTagName("item"))
            {
                Episodes.Add(new Episode
                {
                    title = getNodeValue(elem, "title"),
                    description = getNodeValue(elem, "description"),
                    summary = getNodeValue(elem, "itunes-summary"),

                    duration = getNodeValue(elem, "itunes-duration"),

                    url = getNodeAttribute(elem, "enclosure", "url"),
                    length = getNodeAttribute(elem, "enclosure", "length"),
                    type = getNodeAttribute(elem, "enclosure", "type"),

                    pubDate = getNodeValue(elem, "pubDate"),
                    isExplicit = getNodeValue(elem, "itunes-explicit"),
                    isPermalink = getNodeAttribute(elem, "guid", "isPermaLink"),
                    author = getNodeValue(elem, "itunes-author"),

                }
                    );
            }

            //foreach (Episode e in _episodes)
            //{
            //    Debug.WriteLine(e);
            //}
        }
開發者ID:rogerms,項目名稱:BuildPodcast,代碼行數:37,代碼來源:EpisodeParser.cs

示例13: UpdateTileImages

        private static void UpdateTileImages(XmlDocument tile, IEnumerable<string> images)
        {
            var imagesCount = images.Count();

            if (imagesCount == 0) return;

            var imageAttributes = tile.GetElementsByTagName("image");

            for (int i = 0; i < imagesCount && i < imageAttributes.Length; i++)
            {
                var element = (XmlElement)imageAttributes[i];
                var source = "ms-resource:" + images.ElementAt(i);

                element.SetAttribute("src", source);
            }
        }
開發者ID:StevenThuriot,項目名稱:Saber,代碼行數:16,代碼來源:NotificationBuilder.cs

示例14: getFavorites

        async Task<List<string>> getFavorites()
        {
            StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"Assets\data\Favorites.xml");
            string xmlString = await FileIO.ReadTextAsync(file);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xmlString);
            List<string> _podcasts = new List<string>();
            XmlNodeList channels = doc.GetElementsByTagName("url");
            int itemCount = channels.Count;

            foreach (XmlElement elem in channels)
            {
                if (!String.IsNullOrWhiteSpace(elem.InnerText))
                    _podcasts.Add(elem.InnerText);
            }
            return _podcasts;
        }
開發者ID:rogerms,項目名稱:BuildPodcast,代碼行數:17,代碼來源:PeriodicTask.cs

示例15: Run

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Debug.WriteLine("Background task starting");

            tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text04);

            tileText = tileXml.GetElementsByTagName("text")[0] as XmlElement;

            buses = new Bus[]
            {
                new Bus("99", 3),
                new Bus("88", 7),
                new Bus("6", 16),
                new Bus("47", 21),
            };

            new Timer(onTimer, new object(), 0, 1000);
        }
開發者ID:shvelo,項目名稱:tbilisi-bus-wp,代碼行數:18,代碼來源:Updater.cs


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