static void SimpleBooksImport(BooksDAO booksDao, string xmlFilePath)
{
XmlDocument catalogDocument = new XmlDocument();
catalogDocument.Load(xmlFilePath);
string xPathQuery = "/catalog/book";
XmlNodeList bookNodesList = catalogDocument.SelectNodes(xPathQuery);
foreach (XmlNode bookNode in bookNodesList)
{
string author = GetInnerXml(bookNode, "author").Trim();
string title = GetInnerXml(bookNode, "title").Trim();
string isbn = GetInnerXml(bookNode, "isbn");
if (isbn != null)
{
isbn = isbn.Trim();
}
string webSite = GetInnerXml(bookNode, "web-site");
if (webSite != null)
{
webSite = webSite.Trim();
}
decimal? price = null;
string priceAsString = GetInnerXml(bookNode, "price");
if (priceAsString != null)
{
price = decimal.Parse(priceAsString);
}
booksDao.SimpleImportOfBook(author, title, isbn, price, webSite);
}
}