XPath Online
XPath Tester is a free and easy-to-use tool that can navigate an HTML document and extract data you need. Extraction tool runs in your browser and does not require installing anything on your computer. Start data extraction now!
- Enter a site URL to extract data.
- Enter an expression, for example
//img
for XPath. In this case, the extraction tool selects all<img>
elements no matter where they are in the document. We covered in detail how to use XPath expressions in the How to use XPath documentation article. - Push the Find button, get the result and copy it to the clipboard.
How to Use XPath Query in C#
Using
Aspose.HTML for the .NET API
, you can easily create your own application because our API provides a powerful set of tools for parsing and gathering information from HTML documents. XPath queries are mainly made using the Document class’s Evaluate(expression, contextNode, resolver, type, result)
method. This method accepts an XPath expression and other given parameters and returns a result of the specified type. This code is a basic example of data extraction using the Aspose.HTML library and XPath expressions.
Steps to Extract Data using XPath
- Use the HTMLDocument() constructor to initialize an HTML document from a URL.
- Use the Evaluate() method of the Document class and pass XPath expression and other parameters to it.
- Iterate through the list of elements and print the content of the element.
- Copy C# code and use it in your project.
XPath Query – Documentation
XPath is a powerful query language that gives you much freedom to customize queries. In the How-to Articles chapter you will find answers to popular questions about XPath use. In addition, the articles contain C# examples that provide the necessary information about using the Aspose.HTML class library to solve specific tasks.
- HTML Navigation – In this article, you learn how to perform a detailed inspection of the HTML document and its elements using the API, about custom filters usage for iterating over the document elements, and how to navigate over the document by using CSS Selector or XPath.
- How to use XPath Query in HTML – Evaluate() method – This article introduces how to navigate through an HTML document and select nodes by various criteria. You will learn with C# examples, how to select all Nodes with specified Name using XPath query.
- How To Use XPath To Select XML Nodes – You will learn how to navigate through an XML document and select nodes using XPath. The article considers a С# example of selecting the required information from an XML file using XPath queries.
FAQ
This extraction tool is great for people who want to extract data from the Web. No registration, plugin, or software installation is required for you. Work from your favorite device! Moreover, you can copy and use C# code to extract data programmatically. This will be useful for developers who want to learn more about data extraction and quickly and easily create C# code for their own applications.
The XPath Tester takes a URL and parses the entire HTML code for the page to extract all the specific data selected by the user. Finally, the XPath Tester will output all the collected data, which you can copy.
You can apply a free XPath Tester on any operating system with a web browser. Use this extracting tool on a computer, tablet, or smartphone. You can scrape data quickly and easily regardless of whether you use Windows, Mac OS, Linux, Android, or iOS. Automate your tasks with our XPath Tester!
Get Started with Aspose.HTML for .NET API
You can use several ways to install the Aspose.HTML for .NET library on your system:
- Install a NuGet Package using the NuGet Package Manager GUI.
- Install a NuGet Package using the Package Manager Console. You may use the following command
PM> Install-Package Aspose.Html
. - Install Aspose.HTML for .NET through MSI.
Aspose.HTML is an advanced HTML parsing library. One can create, edit, navigate through nodes, extract data, merge and convert HTML, XHTML, MD, EPUB, and MHTML files to PDF, DOCX, Images, and other popular formats. Moreover, it also handles CSS, HTML Canvas, SVG, XPath, and JavaScript out-of-the-box to extend manipulation tasks. It’s a standalone API and does not require any software installation. Use the Aspose.HTML C# library to convert, merge, edit HTML documents, extract data from the web, and more! For more details about C# library installation and system requirements, please refer to Aspose.HTML Documentation.
Other Supported Aspose.HTML for .NET API Features
Use the Aspose.HTML for .NET library to convert, merge, edit HTML, EPUB, MHTML, XHTML, MD documents, extract data from the web, and more!