HTML is the standard language used to represent rich content on the World Wide Web. It is also commonly used to represent data exported from diverse office suite applications such as word processors and spreadsheets.
HTML can be extremely complicated and parsing it to produce ADF is not straight-forward. Anchor links, relative URLs, and media references are all difficult to support. Further, HTML has features like forms, scalable vector graphics, cascading style sheets, canvas graphics, and more that are unlikely to ever be supported by ADF.
This library provides a separate adf-builder-java-html module that uses JSoup to parse HTML, then transforms the output into its own ADF nodes. At this time, this support should be considered EXPERIMENTAL, as it was thrown together hastily and has not undergone extensive testing to ensure its production readiness.
Both of these should result in the same (or at least very similar) ADF:
1 2 3 4 5 6 7<h2>Heading 2</h2> <p>Paragraph text</p> <ol> <li>List item 1</li> <li>List item 2</li> </ol>
1 2 3 4 5 6 7 8 9doc( h2("Heading 2"), p("Paragraph text"), ol( li("List item 1"), li("List item 2") ) )
1 2 3 4String html = "<h2>Heading 2</h2>\n<p>Paragraph text</p>…"; HtmlParser parser = new HtmlParser(); Doc doc = parser.unmarshall(html);
Rate this page: