本文整理汇总了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");
}
}
示例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");
//}
}
示例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);
}
示例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");
}
}
示例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");
}
}