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

Handling of doctype entities #109

Open
noahbald opened this issue Feb 16, 2025 · 1 comment
Open

Handling of doctype entities #109

noahbald opened this issue Feb 16, 2025 · 1 comment

Comments

@noahbald
Copy link
Owner

xml5ever/html5ever doesn't support full doctype parsing for entity declarations. We may need to consider a different parser

@noahbald
Copy link
Owner Author

noahbald commented Mar 17, 2025

I was also hoping html5ever might still be usable since it parses entities into comments, however it seems to be unreliable and can drop DTD Entity declarations.
e.g.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY st1 "opacity:.34;"><!ENTITY st2 "fill:#231F20;">]>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>

Given this input svg, the first entity is lost

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- ENTITY st2 "fill:#231F20;" -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
</svg>

This would have been useful in prechecks (#119) but sadly would make it unreliable

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