-
Notifications
You must be signed in to change notification settings - Fork 2
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
Check for the correct SVGDOM implementation version in Transcoder #68
Comments
The
The commit isn't tagged in this issue. Mind adding adding a link to the commit hash? |
Yes but
Not sure how you would avoid having
By unknown tag you mean 1.2? Version 1.2 tags inside 1.1 documents are already tolerated.
That should be happening if you do not force validation, but is outside of the scope of this bug.
That's where you have to subclass
See PR #70. |
Right, echosvg/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/DefaultErrorHandler.java Line 40 in 2112c11
Libraries should not write to standard error or standard output. (Applications use standard output for their own purposes, such as creating CSV files or other structured text formats. A third-party library that dumps its output to stdout would invalidate the application's output. KeenWrite, for example, can write XHTML documents to stdout and so I had to override this behaviour to avoid creating malformed XHTML documents. The By unknown tag I meant an unknown XML tag that's neither SVG 1.1 nor SVG 1.2. The PR looks okay. Could consider |
The solution is to override that behaviour, as you did. It has always worked this way, and it is likely that quite a few people would become upset if it changed.
If you find problems with a non-validating parser/transcoder, please open an issue.
The extensions are only for the testing infrastructure: The library uses It should not even need that (I personally find somewhat silly that one must know the document element and the NS URI in advance, just to parse a document from a stream), but it's how it always has worked and we aren't going to change it now. People hate changes to the old Batik API even when there are good reasons for it. |
That's appeal to tradition, which isn't a great reason to keep poor decisions around. I don't know how many people are using EchoSVG at the moment, but I'd change it and let people override to add writing to standard output if they needed it. My guess is that they'd be in the vast minority, but without a survey, it's anyone's guess. |
There is no "appeal to tradition" when we are talking about a software that was written about 20 years ago. With legacy software one talks about backward compatibility. |
It's a toughie, that's for sure. For me, I'd prefer erring on the side of not introducing latent bugs in unsuspecting developers' code. :-) Like there's nothing that tells any developer that their stderr/stdout streams could be corrupted by this library. Maybe consider adding a warning somewhere in the README.md file, then? (Again, I wouldn't be overly concerned with being 100% backwards compatible with Batik in this particular case, because they got this one wrong, unfortunately.) |
Currently, in
TranscoderInput
the possibility exists to pass a SVG 1.2 input document contained in aSVGDocument
coming fromSVGDOMImplementation
(1.1) instead of the correctSVG12DOMImplementation
(1.2). This is presumably the source of issues like #3.I'm currently working with the transcoder stuff and perhaps it would be convenient to check for the actual SVG version of the
SVGDocument
and use the 1.2 factory where convenient (unlessKEY_DOM_IMPLEMENTATION
was explicitly set to a 1.1SVGDOMImplementation
).This implies removing the current default value for
KEY_DOM_IMPLEMENTATION
which would now benull
, otherwise I cannot know whether a 1.1 implementation was specified purposely.I've already implemented it and everything seems fine. Any thoughts @DaveJarvis? Anyone would have objections to this change being committed?
The text was updated successfully, but these errors were encountered: