当前位置: 首页>>代码示例>>C#>>正文


C# XmlDocument.GetChildText方法代码示例

本文整理汇总了C#中XmlDocument.GetChildText方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument.GetChildText方法的具体用法?C# XmlDocument.GetChildText怎么用?C# XmlDocument.GetChildText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlDocument的用法示例。


在下文中一共展示了XmlDocument.GetChildText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main()
    {
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load("../../simple-query.xml");
        string title = xmlDoc.GetChildText("/query/title");
        string author = xmlDoc.GetChildText("/query/author");
        string isbn = xmlDoc.GetChildText("/query/isbn");
        //Console.WriteLine(title);
        //Console.WriteLine(author);

        var books = BookstoreDAL.FindBooksByAuthor(author);
        if (books.Count > 0)
        {
            Console.WriteLine("{0} books found:", books.Count);
            foreach (var book in books)
            {
                int reviewCount = book.Reviews.Count;
                string noReviews = "no";

                if (reviewCount == 0)
                {
                    Console.WriteLine("{0} --> {1} reviews", book.Title, noReviews);
                }
                else
                { 
                    Console.WriteLine("{0} --> {1} reviews", book.Title, reviewCount);
                }
            }
        }
        else
        {
            Console.WriteLine("Nothing Found");
        }
    }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:34,代码来源:BookstoreSearch.cs

示例2: Main

    static void Main()
    {
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load("../../simple-query.xml");
        string username = xmlDoc.GetChildText("/query/username");
        string tag = xmlDoc.GetChildText("/query/tag");
        //Console.WriteLine(username);
        //Console.WriteLine(tag);
        var bookmarks = BookmarksDAL.FindBookmarksByUsernameAndTag(username, tag);
        if (bookmarks.Count > 0)
        {
            foreach (var bookmark in bookmarks)
            {
                Console.WriteLine(bookmark.URL);
            }
        }
        else 
        { 
            Console.WriteLine("Nothing Found"); 
        }
        

        //XmlNodeList bookmarksList = xmlDoc.SelectNodes(xPathQuery);
        //foreach (XmlNode bookmarkNode in bookmarksList)
        //{
        //    string username = bookmarkNode.GetChildText("username");
        //}
    }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:28,代码来源:BookmarksSearch.cs

示例3: Main

        static void Main()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load("../../simple-query.xml");
            string title = xmlDoc.GetChildText("/query/title");
            string isbn = xmlDoc.GetChildText("/query/isbn");
            string author = xmlDoc.GetChildText("/query/author");

           BookStoreDAL.FindBook(title, isbn, author);


          
        }
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:13,代码来源:Program.cs

示例4: Main

	static void Main()
	{
		XmlDocument xmlDoc = new XmlDocument();
		xmlDoc.Load("../../simple-query.xml");
		string username = xmlDoc.GetChildText("/query/username");
		string tag = xmlDoc.GetChildText("/query/tag");
		var bookmarks = 
			BookmarksDAL.FindBookmarksByUsernameAndTag(
				username, tag);
		if (bookmarks.Count > 0)
		{
			foreach (var bookmark in bookmarks)
			{
				Console.WriteLine(bookmark.URL);
			}
		}
		else
		{
			Console.WriteLine("Nothing found");
		}
	}
开发者ID:aleks-todorov,项目名称:HomeWorks,代码行数:21,代码来源:BookmarkSearch.cs

示例5: Main

        static void Main(string[] args)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load("../../simple-query.xml");
            string useName = xmlDoc.GetChildText(useName);

            XmlNodeList bookmarksList = xmlDoc.SelectNodes(xPathQuery);
            foreach (XmlNode bookmarkNode in bookmarksList)
            {
                string userName = bookmarkNode.GetChildText("query/username");
            }
        }
开发者ID:aleks-todorov,项目名称:HomeWorks,代码行数:12,代码来源:BookmarkSearch.cs


注:本文中的XmlDocument.GetChildText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。