Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML parsing library for visualizations messes up divs #97

Open
AlexLandau opened this issue Nov 19, 2015 · 4 comments
Open

HTML parsing library for visualizations messes up divs #97

AlexLandau opened this issue Nov 19, 2015 · 4 comments

Comments

@AlexLandau
Copy link
Member

In preparing games for the coming competition, I'm seeing several cases where visualization code like

<div id="d1"/>
<div id="d2"/>
<div id="d3"/>

turns into

<div id="d1">
<div id="d2">
<div id="d3">
</div></div></div>

This wreaks havoc with visualizations (I believe Hex is an example).

Debugging indicates this error is introduced by the "new HtmlDocumentBuilder().parse(is)" call in GameStateRenderer#renderImagefromGameXML. The input "xhtml" string is correct, the created dom object is incorrect.

@AlexLandau
Copy link
Member Author

Per https://about.validator.nu/htmlparser/ we're on the latest released version (though they note they're behind on actual releases).

@AlexLandau
Copy link
Member Author

A long-term solution would be to use an actual web browser, but as we recently learned this is blocked on Google App Engine (which runs Tiltyard) supporting Java 8. (Unless we split up GGP-Base into separate projects/jars as suggested in #91, in which case UI code could use Java 8 and core library code Java 7.)

In lieu of that I'm trying out Jsoup as a replacement library.

@AlexLandau
Copy link
Member Author

Jsoup seems to work, though there's more stuff involved in getting an input for Flying Saucer. I'll port this back from Alloy to GGP-Base at some point.

@AlexLandau
Copy link
Member Author

Another possible solution: JxBrowser allows for embedding a web browser, and does not require Java 8 like the JavaFX browser approach. However, it is a very large and heavyweight dependency; it basically runs Chromium within the application.

Another approach would be to run a servlet and (within the Java app) just provide a link to the actual visualization(s), which would be shown in a user's browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant