Get HTML fragments using CSS Selector

Introduction

This article explain how to get the HTML fragments from the HTML document that match the specified CSS selector. Aspose.HTML Cloud provide two APIs to get the list of HTML fragments:

API Information

API Type Description Swagger Link
/html/{name}/fragments/css/{outFormat} GET Return list of HTML fragments matching the specified CSS selector GetDocumentFragmentsByCSSSelector
/html/fragments/css/{outFormat} GET Return list of HTML fragments matching the specified CSS selector by the source page URL GetDocumentFragmentsByCSSSelectorByUrl

cURL Example

Available SDKs

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Checkout our GitHub repository for a complete list of Aspose.HTML SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.

SDK Examples

Case 1: Get list of HTML fragments matching the specified CSS selector:

Case 2: Get list of HTML fragments matching the specified CSS selector by the source page URL: