Suppressing sxml/ssax warnings
sschwarzer opened this issue · comments
In case anyone else runs into this ...
Parsing an SVG file with ssax:xml->sxml
gave me the warning
ssax:warn: warning at position 137: DOCTYPE DECL svg http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd found and skipped
I couldn't find an "official" way to suppress the warning, short of redirecting current-output-port
or current-error-port
. Looking around in the sxml source code eventually led me to
(require
; For `current-sxml-warning-handler`
sxml/ssax/errors-and-warnings)
...
(parameterize ([current-sxml-warning-handler (lambda args void)])
(ssax:xml->sxml port '()))
I don't know if there should be an official API for this. Maybe it's enough to document current-sxml-warning-handler
and provide it under a nicer module path, for example sxml
.
Yes, this kind of thing does not surprise me; the sxml library is written to run across multiple scheme implementations, so this kind of issue is definitely present.
I like your proposed solution. Any interest in making a pull request?
I like your proposed solution.
I assume you're referring to exposing and documenting current-sxml-warning-handler
, not redirecting current-output-port
or current-error-port
?
Any interest in making a pull request?
Kind of yes, but that may take a while. At the earliest after Racketfest. So I won't be upset if you do it yourself. :-)