Coder Social home page Coder Social logo

inscriptis-java's Introduction

Maven Build Maven Central javadoc

inscriptis - HTML to text conversion library for Java

A Java-based HTML to text conversion library with support for nested tables and a subset of CSS. Please take a look at the Rendering document for a demonstration of Inscriptis conversion quality.

This is a Java port of inscriptis for Python.

Getting Started

Here is a quick teaser of an application using inscriptis for Java:

package example;

import org.jsoup.Jsoup;
import org.jsoup.helper.W3CDom;
import org.w3c.dom.Document;

import ch.x28.inscriptis.Inscriptis;

public class Example {

	public static void main(String[] args) {

		String htmlContent = "<p style=\"margin-top:0px\">Hello World!</p>";

		// use jsoup to parse HTML and convert it to W3C Document (https://jsoup.org)
		Document document = W3CDom.convert(Jsoup.parse(htmlContent));

		Inscriptis inscriptis = new Inscriptis(document);
		String text = inscriptis.getText();

		System.out.println(text); // Hello World!
	}
}

Maven configuration

Add the Maven dependency:

<dependency>
  <groupId>ch.x28.inscriptis</groupId>
  <artifactId>inscriptis</artifactId>
  <version>1.0</version>
</dependency>

HTML parser

inscriptis requires a W3C document, so it's up to you which parser you choose. Here is a list of parsers that support a W3C document result.

jsoup

https://jsoup.org/

nu-validator HTML Parser

https://mvnrepository.com/artifact/nu.validator/htmlparser

License

inscriptis for Java is an Open Source software released under the Apache License, Version 2.0

inscriptis-java's People

Contributors

dependabot[bot] avatar mazzex28 avatar xsawo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.