You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
807 B

7 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.XPath;
using System.IO;
namespace VXML
{
class parser
{
public void getXML()
{
XmlDocument doc = new XmlDocument();
doc.Load("C:\\Users\\golubev\\Documents\\Личное\\xmlDeser\\bookstore.xml");
XmlNode root = doc.DocumentElement;
XmlNamespaceManager nsmg = new XmlNamespaceManager(doc.NameTable);
nsmg.AddNamespace("bk", "url:newbooks-schema");
XmlNode node = root.SelectSingleNode(
"descendant::bk:book[bk:author/bk:last-name='Kingsolver']", nsmg);
Console.WriteLine(node.InnerXml);
}
}
}