Improve openpdf-html with htmlunit-neko DOMParser integration and HTML5 feature tests#1490
Merged
andreasrosdal merged 3 commits intomasterfrom Feb 17, 2026
Merged
Conversation
- Created HtmlResource class for direct HTML5 parsing using htmlunit-neko's DOMParser - Created HtmlParserConfig for configurable HTML parsing options - Added comprehensive Html5FeaturesTest demonstrating modern HTML5 features - Added HtmlResourceTest validating htmlunit-neko integration - Updated README with documentation for new features Co-authored-by: andreasrosdal <259156774+andreasrosdal@users.noreply.github.com>
Co-authored-by: andreasrosdal <259156774+andreasrosdal@users.noreply.github.com>
|
Copilot
AI
changed the title
[WIP] Improve HTML parsing with HtmlUnit-Neko support
Improve openpdf-html with htmlunit-neko DOMParser integration and HTML5 feature tests
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description of the new Feature/Bugfix
Better utilizes htmlunit-neko as an HTML5 parser by adding a new
HtmlResourceclass that usesDOMParserdirectly instead of only SAXParser. Adds comprehensive HTML5 feature tests demonstrating current capabilities and areas for future improvement.New classes:
HtmlResource- HTML5-compliant parsing via htmlunit-neko's DOMParser with error tolerance and automatic tag balancingHtmlParserConfig- Builder API for parser configuration (error reporting, self-closing tags, encoding, element/attribute name casing)Usage:
Documentation:
Unit-Tests for the new Feature/Bugfix
Html5FeaturesTest (7 tests): HTML5 semantic elements, data-* attributes, malformed HTML handling, form elements, CSS3 features, void elements, comprehensive document
HtmlResourceTest (12 tests): Parsing from String/Reader/InputStream, HTML5 elements, malformed HTML tolerance, custom config, error reporting, config builder validation
Compatibilities Issues
No breaking changes. New classes only; existing
XMLResourceandITextRendererAPIs unchanged.Your real name
GitHub Copilot
Testing details
Run tests:
mvn test -pl openpdf-html -Dtest=Html5FeaturesTest,HtmlResourceTestAll 19 new tests pass. Existing test suite (121 tests) unaffected.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.w3.org/usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -Dnet.bytebuddy.experimental=true -jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire/surefirebooter-20260217180107067_3.jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire 2026-02-17T18-01-05_892-jvmRun1 surefire-20260217180107067_1tmp surefire_0-20260217180107067_2tmp(dns block)/usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -Dnet.bytebuddy.experimental=true -jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire/surefirebooter-20260217180827797_3.jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire 2026-02-17T18-08-27_719-jvmRun1 surefire-20260217180827797_1tmp surefire_0-20260217180827797_2tmp(dns block)/usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -Dnet.bytebuddy.experimental=true -jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire/surefirebooter-20260217181015121_3.jar /home/REDACTED/work/OpenPDF/OpenPDF/openpdf-html/target/surefire 2026-02-17T18-10-15_053-jvmRun1 surefire-20260217181015121_1tmp surefire_0-20260217181015121_2tmp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.