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


C# XmlDocument.GetChildText方法代码示例

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


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

示例1: Main

 /*Problem 5. Simple Search for Books. */
 static void Main()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load("..\\..\\test6.xml");
     string title = xmlDoc.GetChildText("/query/title");
     string author = xmlDoc.GetChildText("/query/author");
     string isbn = xmlDoc.GetChildText("/query/isbn");
     var books = BookstoreDAL.FindBooksByTitleAndAuthorAndISBN(title, author, isbn);
     if (books.Count > 0)
     {
         Console.WriteLine("{0} {1} found:", books.Count, books.Count != 1 ? "books":"book");
         foreach (var book in books)
         {
             Console.WriteLine("{0} --> {1} {2}", book.Key, book.Value == 0 ? "no" : book.Value.ToString(), book.Value != 1 ? "reviews" : "review");
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
开发者ID:nkolarov,项目名称:telerik-academy,代码行数:22,代码来源:BookstoreSimpleSearch.cs

示例2: Main

 public static void Main(string[] args)
 {
     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");
     var books = BookstoreDAL.FindBooksByTitleAuthorAndIsbn(title, author, isbn);
     if (books.Count > 0)
     {
         Console.WriteLine("{0} books found:", books.Count);
         foreach (var book in books)
         {
             Console.WriteLine("{0} --> {1} reviews", book.Title, book.Reviews.Count);
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
开发者ID:krasimirkrustev,项目名称:ta-bookstore,代码行数:21,代码来源:SimpleSearch.cs

示例3: Main

 static void Main()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load("../../simple-query.xml");
     string authorname = xmlDoc.GetChildText("/query/author");
     string title = xmlDoc.GetChildText("/query/title");
     string isbn = xmlDoc.GetChildText("/query/isbn");
     var books =
         BookstoreDAL.FindBookByTitleAuthorOrISBN(authorname, title, isbn);
     if (books.Count > 0)
     {
         foreach (var book in books)
         {
             Console.WriteLine("{0} books found:");
             Console.WriteLine("{0} --> ", book.Title);
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
开发者ID:VesiBaleva,项目名称:TelerikAcademy,代码行数:22,代码来源:simpleSearcherBook.cs

示例4: FindBooks

        public static void FindBooks(string filePath)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(filePath);

            string title = xmlDoc.GetChildText("query/title");
            string authorName = xmlDoc.GetChildText("query/author");
            string isbn = xmlDoc.GetChildText("query/isbn");

            List<Book> books = BookstoreDAL.FindBooksByTitleAuthorIsbn(title, authorName, isbn);
            if (books.Count > 0)
            {
                Console.WriteLine("{0} books found:", books.Count());
                foreach (Book book in books)
                {
                    Console.WriteLine(book.Title);
                }
            }
            else
            {
                Console.WriteLine("Nothing found");
            }
        }
开发者ID:stoskov,项目名称:bookstore,代码行数:23,代码来源:XMLFinder.cs


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