Created
November 9, 2018 21:17
-
-
Save Atulin/9734d3c15d40a3bac285e8b018da4aa0 to your computer and use it in GitHub Desktop.
A short and sweet Xpath checker. Made with .NET Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using HtmlAgilityPack; | |
namespace XpathStuff | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.Write("URL to parse: "); | |
string url = Console.ReadLine(); | |
HtmlWeb web = new HtmlWeb(); | |
HtmlDocument doc = web.Load (url); | |
Console.Write("XPath to check against: "); | |
string xpath = Console.ReadLine(); | |
HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(xpath); | |
foreach (HtmlNode node in nodes) | |
{ | |
Console.WriteLine(node.InnerText); | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment