Easily open HTML documents with just a few lines of Java code. Our Java library will provide you with everything you need to access HTML document content programmatically.
The task of reading HTML documents is the task of reading hierarchical data structures within the DOM model. This implies knowing the format of each individual HTML data element, including all of its possible child elements and attributes.
Our Java library is a cloud-based solution that will allow you to open HTML files for reading and writing easily. This distributed approach gives you flexibility in software development using Java language, as all resource-intensive HTML document processing will take place on Aspose servers. All you need is to get private keys to access Cloud API in Java code.
You can iterate over all elements of a HTML document or you can search for specific elements in a DOM tree. We provide a wide range of Java functions both for working with the structure of the HTML file and with the data contained in the document nodes.
The following code example will help you quickly figure out how to load a HTML file using Java and perform some actions on it.
import com.aspose.words.cloud.*;
ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);
String fileName = "Input.html";
byte[] requestFileContent = Files.readAllBytes(Paths.get(new String(Files.readAllBytes(
Paths.get(fileName)), "utf8")).toAbsolutePath());
UploadFileRequest uploadDocumentRequest = new UploadFileRequest(requestFileContent, fileName, null);
wordsApi.uploadFile(uploadDocumentRequest);
ParagraphInsert requestParagraph = new ParagraphInsert();
requestParagraph.setText("Reading and writing to the file in the cloud occurs automatically.");
InsertParagraphRequest insertParagraphRequest = new InsertParagraphRequest(
fileName, requestParagraph, null, null, null, null, null, null, null, null, null, null);
wordsApi.insertParagraph(insertParagraphRequest);
DownloadFileRequest downloadDocumentRequest = new DownloadFileRequest(fileName, null, null);
wordsApi.downloadFile(downloadDocumentRequest);
Install 'Aspose.Words Cloud SDK for Java' using Maven build automation tool.
Add this dependency to your project's POM:
As an alternative, you can clone Aspose.Words Cloud SDK for Java source code from GitHub and use it in your project. Please follow these Instructions to quickly get the necessary security credentials and access our REST API.
Refer to the Repository Documentation to see the details.