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

svgo doesn't remove sodipodi:*** attributes #442

Closed
vbarbarosh opened this issue Oct 14, 2015 · 8 comments
Closed

svgo doesn't remove sodipodi:*** attributes #442

vbarbarosh opened this issue Oct 14, 2015 · 8 comments

Comments

@vbarbarosh
Copy link

$ svgo -v

0.5.6

$ cat bulb.svg

<svg
    xmlns="http://www.w3.org/2000/svg"
    xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
    sodipodi:version=".32"
    sodipodi:docbase="/Users/alexwellerstein/Desktop"
    sodipodi:docname="bulb.svg"
    width="100"
    height="100"
    viewBox="219.19 314.209 100 100">
    <path d="M283.944 374.718c.058.514.09 1.063.09 1.63v1.598c0 2.94-.832 5.324-1.856 5.324h-25.974c-1.025 0-1.855-2.383-1.855-5.324v-1.597c0-.57.03-1.12.087-1.633-8.28-5.004-13.818-14.09-13.818-24.473 0-15.78 12.79-28.572 28.57-28.572s28.573 12.792 28.573 28.572c-.002 10.38-5.54 19.47-13.82 24.473zm-1.613 11.75c0-1.023-.733-1.854-1.642-1.854h-22.994c-.907 0-1.643.83-1.643 1.855v.554c0 1.026.737 1.856 1.644 1.856h22.994c.908 0 1.644-.83 1.644-1.855v-.556zm-.716 5.61c0-1.023-.695-1.854-1.553-1.854h-21.74c-.855 0-1.55.83-1.55 1.855v.555c0 1.025.694 1.855 1.552 1.855h21.74c.857 0 1.553-.83 1.553-1.854v-.557zm-1.11 5.612c0-1.024-.635-1.855-1.416-1.855h-19.793c-.78 0-1.414.83-1.414 1.855v.557c0 1.024.634 1.855 1.415 1.855h19.793c.78 0 1.415-.83 1.415-1.855v-.557zm-1.903 3.698h-18.82l1.566 5.356h15.69l1.565-5.356z" />
</svg>

$ svgo bulb.svg

Done in 96 ms!
1.104 KiB - 10% = 0.994 KiB

$ cat bulb.svg

<svg xmlns="http://www.w3.org/2000/svg" sodipodi:version=".32" sodipodi:docbase="/Users/alexwellerstein/Desktop" sodipodi:docname="bulb.svg" width="100" height="100" viewBox="219.19 314.209 100 100"><path d="M283.944 374.718c.058.514.09 1.063.09 1.63v1.598c0 2.94-.832 5.324-1.856 5.324h-25.974c-1.025 0-1.855-2.383-1.855-5.324v-1.597c0-.57.03-1.12.086-1.634-8.28-5.004-13.818-14.09-13.818-24.473 0-15.78 12.79-28.572 28.57-28.572s28.573 12.793 28.573 28.573c0 10.38-5.54 19.47-13.82 24.473zm-1.613 11.75c0-1.023-.732-1.854-1.64-1.854h-22.995c-.907 0-1.643.83-1.643 1.855v.553c0 1.026.737 1.856 1.644 1.856h22.994c.908 0 1.644-.83 1.644-1.856v-.556zm-.715 5.61c0-1.023-.695-1.854-1.553-1.854h-21.74c-.855 0-1.55.83-1.55 1.855v.554c0 1.025.694 1.855 1.552 1.855h21.74c.857 0 1.553-.83 1.553-1.855v-.557zm-1.11 5.612c0-1.024-.635-1.855-1.416-1.855h-19.794c-.78 0-1.414.83-1.414 1.855v.557c0 1.024.634 1.855 1.415 1.855h19.793c.78 0 1.415-.83 1.415-1.855v-.557zm-1.903 3.698h-18.82l1.566 5.356h15.69l1.565-5.356z"/></svg>

$ svgo bulb.svg

Error in parsing: Unbound namespace prefix: "sodipodi"
Error in parsing: Unbound namespace prefix: "sodipodi"
Error in parsing: Unbound namespace prefix: "sodipodi"

In fact it produces malformed xml.

@GreLI GreLI closed this as completed in 6e712f1 Oct 20, 2015
@GreLI
Copy link
Member

GreLI commented Oct 20, 2015

Thanks for reporting! Added the namespace.

@GreLI
Copy link
Member

GreLI commented Nov 8, 2015

v0.6.0 with the fix have been just released.

@birchcode
Copy link

Thanks for making this! Awesome savings on so many of my SVG's.

But are you sure this issue hass been fixed? I just installed SVGO for the first time and tried it on an illustrator file that had lots of sodpodi's.

<g id="g9856" transform="matrix(0.02682851,0,0,0.02682851,118.68105,942.83463)"> <g id="path9858" sodipodi:rx="16.428572" sodipodi:type="arc" sodipodi:cy="472.36218" sodipodi:ry="16.428572" sodipodi:cx="430"> <circle fill="#A9F0F7" cx="-9892.9" cy="13567.6" r="1.7"/> </g>

$ npm show svgo version
0.6.0

Error in parsing: Unbound namespace prefix: "sodipodi"

@GreLI
Copy link
Member

GreLI commented Nov 11, 2015

Since the error in parsing, your file is already broken. SVGO can't do anything until it parse file.

@eden-lane
Copy link

I have same error with Error in parsing: Unbound namespace prefix: «sketch»

@GreLI
Copy link
Member

GreLI commented Jan 11, 2016

Error in parsing — it's parse time error, you will get same in the browser.

@eden-lane
Copy link

I hadn't this error when I used same svg without svgo. Anyway, removing prefixes solved this problem.

@waldyrious
Copy link
Contributor

@GreLI AFAIK a namespace prefix is only valid if the svg has a xmlns binding that prefix to a unique DTD. So if svgo removes the xmlns, it should also remove the corresponding prefix from the elements/attributes, otherwise the svg file is invalid (I'm not 100% sure on this, but that's my understanding).

In any case, according to the inkscape wiki, sodipodi-prefixed attributes and elements are metadata, rather than graphical information needed to render the image, so svgo should remove not just the prefix, but the whole attribute/element as well.

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

5 participants