GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — [jsp] Fix #5092: Allow XML declaration and doctype after other content by InnoxCodes · Pull Request #7252 · pmd/pmd Conversation
Contributor
Describe the PR
New test Related issuesReady?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ctype
The prolog of a JSP only accepted comments in front of the doctype
declaration, so the very common
<%@ page contentType="text/html" %>
<!DOCTYPE html>
failed with `Encountered "<!DOCTYPE"`. JSP directives, scriptlets,
declarations and comments are now accepted before the doctype.
|
There was an error while loading. Please reload this page.
|
Compared to main: (comment created at 2026-11-20 13:08:44+00:00 for 1c9fb74) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Instead of extending the prolog with a list of JSP constructs, which can never be complete, accept Declaration and DoctypeDeclaration as regular content elements. According to the Jakarta Pages grammar there is no prolog; both are just template text that may appear anywhere. The prolog is unchanged, so ASTs of files that parsed before stay the same. Directives before the doctype stay under Content, so JspEncoding still finds the page directive. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I'll use a slightly different approach: The JSP actually doesn't have a Prolog, so the grammar is not really correct here. And there could be more content appearing before the doctype. The official grammar is specificied here: https://jakarta.ee/specifications/pages/4.0/jakarta-server-pages-spec-4.0.html#ebnf-grammar-for-jsp-syntax
I'll update the PR myself.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[jsp] Parse error when<!DOCTYPE> or <?xml?> follows other content
There was an error while loading. Please reload this page.