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

XML parser parses comments inside doctype subset into Xml.Ident #4930

Open
knutwannheden opened this issue Jan 21, 2025 · 0 comments
Open

XML parser parses comments inside doctype subset into Xml.Ident #4930

knutwannheden opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working parser-xml

Comments

@knutwannheden
Copy link
Contributor

Given an XML document like the following:

  <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
  <!DOCTYPE xsl:stylesheet [
  <!-- EXSLT-Math -->
  <!ENTITY foons "https://www.foo.org/bar">
  ]>
  <xsl:stylesheet version="1.0"/>

the parser parses the comment into an Xml.Ident element rather than creating an Xml.Comment:

for (int i = 0; i < children.size(); i++) {
ParserRuleContext element = (ParserRuleContext) children.get(i);
// Markup declarations are not fully implemented.
// n.getText() includes element subsets.
Xml.Ident ident = convert(element, (n, p) -> new Xml.Ident(randomId(), p, Markers.EMPTY, n.getText()));
.

The name of the created Xml.Ident is <!-- EXSLT-Math --> which then can cause recipes to fail processing this.

@knutwannheden knutwannheden added bug Something isn't working parser-xml labels Jan 21, 2025
@timtebeek timtebeek moved this to Backlog in OpenRewrite Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-xml
Projects
Status: Backlog
Development

No branches or pull requests

1 participant