-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
Invalid DOCTYPE when parsing svg file #546
Comments
I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it. |
So many things were changed in version 3 and 4. Please check Changelog |
I checked the changelog, nothing can be found about xml being invalid with entities in doctype. Is the provided example a valid xml in your opinion ? Should it trigger the exception of invalid doctype ? |
After 4.0.0-beta.3 DOCTYPE are supported but with very limited features. You may probably want to set |
I tried already with this option set, the behavior was the same, an error was still triggered |
Have you tried with new version recently published? |
I used the latest version 4.1.3 published, now everything is working perfectly, thanks |
Description
Library is-svg was using version 3.19.0. When upgrading to 4.1.2, some test cases are not successful anymore when parsing valid xml input samples
Branch with the change can be found here
Input
test cases from is-svg library is using this svg file
<?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 Smile " <rect x='.5' y='.5' width='29' height='39' fill='black' stroke='red'/> <g transform='translate(0, 5)'> <circle cx='15' cy='15' r='10' fill='yellow'/><circle cx='12' cy='12' r='1.5' fill='black'/><circle cx='17' cy='12' r='1.5' fill='black'/><path d='M 10 19 L 15 23 20 19' stroke='black' stroke-width='2'/></g>"> ]><svg width="850px" height="700px" version="1.1" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(16,0,0,16,0,0)">&Smile;</g></svg>
Code
Output
Error: Invalid DOCTYPE
at readDocType (/Users/larustue/depots/is-svg/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js:73:27)
at OrderedObjParser.parseXml (/Users/larustue/depots/is-svg/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js:246:24)
at XMLParser.parse (/Users/larustue/depots/is-svg/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js:35:48)
at isSvg (/Users/larustue/depots/is-svg/index.js:24:23)
at /Users/larustue/depots/is-svg/test.js:66:14
at Test.callFn (/Users/larustue/depots/is-svg/node_modules/ava/lib/test.js:364:21)
at Test.run (/Users/larustue/depots/is-svg/node_modules/ava/lib/test.js:377:23)
at Runner.runSingle (/Users/larustue/depots/is-svg/node_modules/ava/lib/runner.js:259:19)
at /Users/larustue/depots/is-svg/node_modules/ava/lib/runner.js:322:16
at processTicksAndRejections (node:internal/process/task_queues:95:5)
expected data
I guess it should not failed because the XML is valid and doctype used to be correct, there seems to be backward compatibility broken somewhere
Would you like to work on this issue?
Bookmark this repository for further updates.
The text was updated successfully, but these errors were encountered: