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

Namespace prefix inkscape for pageopacity on namedview is not defined #25

Closed
ain opened this issue May 26, 2014 · 9 comments
Closed

Namespace prefix inkscape for pageopacity on namedview is not defined #25

ain opened this issue May 26, 2014 · 9 comments

Comments

@ain
Copy link
Contributor

ain commented May 26, 2014

SVGs created by Inkscape have a following problem once concatenated (from Safari):

error on line 1 at column 351: Namespace prefix inkscape for pageopacity on namedview is not defined

1st SVG:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="64"
   height="64"
   id="svg3315"
   version="1.1"
   inkscape:version="0.48.2 r9819"
   sodipodi:docname="icon-logout.svg">
  <defs
     id="defs3317" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="2.8"
     inkscape:cx="37.921858"
     inkscape:cy="38.336"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:window-width="767"
     inkscape:window-height="517"
     inkscape:window-x="276"
     inkscape:window-y="77"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata3320">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-988.36218)">
    <path
       inkscape:connector-curvature="0"
       d="m 53.808483,1050.3713 -43.429508,0 0,-32.8261 43.429508,0 0,32.8261 z m -6.260221,-35.1727 -0.978409,0 -26.604522,0 0,-0.1591 0,-10.1364 0,-1.9931 c 0,-6.68862 5.440904,-12.12838 12.128398,-12.12838 6.686358,0 12.128399,5.44204 12.128399,12.12838 l 0,1.9931 2.347725,0 0,-1.9931 c 0,-7.98293 -6.493176,-14.47611 -14.476124,-14.47611 -7.982947,0 -14.476124,6.49431 -14.476124,14.47731 l 0,12.2886 -9.586355,0 0,37.5192 48.124959,0 0,-37.5204 -8.607947,0 z"
       style="fill:#1d1d1d;fill-opacity:1;fill-rule:nonzero;stroke:none"
       id="path28" />
  </g>
</svg>

2nd SVG:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="64"
   height="64"
   id="svg3315"
   version="1.1"
   inkscape:version="0.48.2 r9819"
   sodipodi:docname="Uus dokument 2">
  <defs
     id="defs3317" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="2.8"
     inkscape:cx="37.921858"
     inkscape:cy="38.336"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:window-width="767"
     inkscape:window-height="517"
     inkscape:window-x="276"
     inkscape:window-y="77"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata3320">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-988.36218)">
    <g
       id="g3369"
       transform="matrix(0.74062091,0,0,0.74062091,14.528,262.00513)">
      <g
         transform="matrix(1.25,0,0,-1.25,17.483881,988.80851)"
         id="g62">
        <path
           id="path64"
           style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none"
           d="m 0,0 0,-2.358 37.499,0 0,-51.83 -37.499,0 0,-2.355 39.854,0 L 39.854,0 0,0 z"
           inkscape:connector-curvature="0" />
      </g>
      <g
         transform="matrix(1.25,0,0,-1.25,28.513261,1046.5049)"
         id="g66">
        <path
           id="path68"
           style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none"
           d="M 0,0 1.829,-1.829 21.543,17.884 1.829,37.597 0,35.771 16.596,19.177 l -54.962,0 0,-2.584 54.958,0 L 0,0 z"
           inkscape:connector-curvature="0" />
      </g>
    </g>
  </g>
</svg>

Result by grunt-svgstore:

<svg xmlns="http://www.w3.org/2000/svg"><symbol id="icon-access"><title>icon-access</title>  <sodipodi:namedview id="56cf8a18af9ca0581ded35b784df5896base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.8" inkscape:cx="37.921858" inkscape:cy="38.336" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="767" inkscape:window-height="517" inkscape:window-x="276" inkscape:window-y="77" inkscape:window-maximized="0"/> <metadata id="56cf8a18af9ca0581ded35b784df5896metadata3320"> <rdf:rdf> <cc:work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> </cc:work> </rdf:rdf> </metadata> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="56cf8a18af9ca0581ded35b784df5896layer1" transform="translate(0,-988.36218)"> <path inkscape:connector-curvature="0" d="m 53.808483,1050.3713 -43.429508,0 0,-32.8261 43.429508,0 0,32.8261 z m -6.260221,-35.1727 -0.978409,0 -26.604522,0 0,-0.1591 0,-10.1364 0,-1.9931 c 0,-6.68862 5.440904,-12.12838 12.128398,-12.12838 6.686358,0 12.128399,5.44204 12.128399,12.12838 l 0,1.9931 2.347725,0 0,-1.9931 c 0,-7.98293 -6.493176,-14.47611 -14.476124,-14.47611 -7.982947,0 -14.476124,6.49431 -14.476124,14.47731 l 0,12.2886 -9.586355,0 0,37.5192 48.124959,0 0,-37.5204 -8.607947,0 z" style="fill:#1d1d1d;fill-opacity:1;fill-rule:nonzero;stroke:none" id="56cf8a18af9ca0581ded35b784df5896path28"/> </g> </symbol><symbol id="icon-exit"><title>icon-exit</title>  <sodipodi:namedview id="ebe72facf38321d9649f2e005f1957b2base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.8" inkscape:cx="37.921858" inkscape:cy="38.336" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="767" inkscape:window-height="517" inkscape:window-x="276" inkscape:window-y="77" inkscape:window-maximized="0"/> <metadata id="ebe72facf38321d9649f2e005f1957b2metadata3320"> <rdf:rdf> <cc:work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> </cc:work> </rdf:rdf> </metadata> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="ebe72facf38321d9649f2e005f1957b2layer1" transform="translate(0,-988.36218)"> <g id="ebe72facf38321d9649f2e005f1957b2g3369" transform="matrix(0.74062091,0,0,0.74062091,14.528,262.00513)"> <g transform="matrix(1.25,0,0,-1.25,17.483881,988.80851)" id="ebe72facf38321d9649f2e005f1957b2g62"> <path id="ebe72facf38321d9649f2e005f1957b2path64" style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 0,0 0,-2.358 37.499,0 0,-51.83 -37.499,0 0,-2.355 39.854,0 L 39.854,0 0,0 z" inkscape:connector-curvature="0"/> </g> <g transform="matrix(1.25,0,0,-1.25,28.513261,1046.5049)" id="ebe72facf38321d9649f2e005f1957b2g66"> <path id="ebe72facf38321d9649f2e005f1957b2path68" style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none" d="M 0,0 1.829,-1.829 21.543,17.884 1.829,37.597 0,35.771 16.596,19.177 l -54.962,0 0,-2.584 54.958,0 L 0,0 z" inkscape:connector-curvature="0"/> </g> </g> </g> </symbol></svg>
@ain
Copy link
Contributor Author

ain commented May 26, 2014

Giving up on Inkscape's SVG and going for what they call Standard SVG, results in an error error on line 1 at column 68: Namespace prefix rdf on rdf is not defined and the file:

<svg xmlns="http://www.w3.org/2000/svg"><symbol id="icon-access"><title>access</title>  <metadata id="44525ed4f3f262f8e7b5d78a1566e05bmetadata3320"> <rdf:rdf> <cc:work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> </cc:work> </rdf:rdf> </metadata> <g transform="translate(0,-988.36218)" id="44525ed4f3f262f8e7b5d78a1566e05blayer1"> <path d="m 53.808483,1050.3713 -43.429508,0 0,-32.8261 43.429508,0 0,32.8261 z m -6.260221,-35.1727 -0.978409,0 -26.604522,0 0,-0.1591 0,-10.1364 0,-1.9931 c 0,-6.68862 5.440904,-12.12838 12.128398,-12.12838 6.686358,0 12.128399,5.44204 12.128399,12.12838 l 0,1.9931 2.347725,0 0,-1.9931 c 0,-7.98293 -6.493176,-14.47611 -14.476124,-14.47611 -7.982947,0 -14.476124,6.49431 -14.476124,14.47731 l 0,12.2886 -9.586355,0 0,37.5192 48.124959,0 0,-37.5204 -8.607947,0 z" id="44525ed4f3f262f8e7b5d78a1566e05bpath28" style="fill:#1d1d1d;fill-opacity:1;fill-rule:nonzero;stroke:none"/> </g> </symbol><symbol id="icon-exit"><title>exit</title>  <metadata id="5f7179d7382a436c2da07e38504e6d57metadata3320"> <rdf:rdf> <cc:work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> </cc:work> </rdf:rdf> </metadata> <g transform="translate(0,-988.36218)" id="5f7179d7382a436c2da07e38504e6d57layer1"> <g transform="matrix(0.74062091,0,0,0.74062091,14.528,262.00513)" id="5f7179d7382a436c2da07e38504e6d57g3369"> <g transform="matrix(1.25,0,0,-1.25,17.483881,988.80851)" id="5f7179d7382a436c2da07e38504e6d57g62"> <path d="m 0,0 0,-2.358 37.499,0 0,-51.83 -37.499,0 0,-2.355 39.854,0 L 39.854,0 0,0 z" id="5f7179d7382a436c2da07e38504e6d57path64" style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none"/> </g> <g transform="matrix(1.25,0,0,-1.25,28.513261,1046.5049)" id="5f7179d7382a436c2da07e38504e6d57g66"> <path d="M 0,0 1.829,-1.829 21.543,17.884 1.829,37.597 0,35.771 16.596,19.177 l -54.962,0 0,-2.584 54.958,0 L 0,0 z" id="5f7179d7382a436c2da07e38504e6d57path68" style="fill:#2f2d2d;fill-opacity:1;fill-rule:nonzero;stroke:none"/> </g> </g> </g> </symbol></svg>

@FWeinb
Copy link
Owner

FWeinb commented May 26, 2014

You have to manually add the appropriate namespace as an attribute in your svgstore config like:

svgstore : {
   options : {
        svg : {
           'xmlns:inkscape' : 'http://www.inkscape.org/namespaces/inkscape'
        }
   }
}

As mentioned above you have to add each custom namespace you are using like that.

@ain
Copy link
Contributor Author

ain commented May 26, 2014

Ok, I'll work it out and push you a PR once I have a working solution. Maybe we can auto detect Inkscape's SVG and take over the namespaces automagically.

@ain
Copy link
Contributor Author

ain commented May 26, 2014

Unfortunately it's not so simple. Just pushing the namespaces won't resolve, it's corrupt. Rendered view ends up empty on Safari and in Inkscape itself.

@FWeinb
Copy link
Owner

FWeinb commented May 26, 2014

Yeah I would like an auto detect feature ( not explicitly bound to Inkscape though) it would be possible to collect all attributes (namespace related) and add them to the resulting svg.
But this should be implemented behind a feature flag like includenamespaces.

@ain
Copy link
Contributor Author

ain commented May 26, 2014

Yup, I was thinking down the same path, shouldn't be limited anyhow.

@FWeinb
Copy link
Owner

FWeinb commented May 26, 2014

If you are just displaying the generated svg it should not display anything on its on. So it is working as intended. Have a look at the includedemo option described in the readme.

@ain
Copy link
Contributor Author

ain commented May 26, 2014

Very nice, it works!

So for Inkscape, a working task configuration needs to look like the following:

    svgstore: {
      options: {
        prefix: 'icon-',
        includedemo: true,
        svg: {
          'xmlns:dc': "http://purl.org/dc/elements/1.1/",
          'xmlns:cc': "http://creativecommons.org/ns#",
          'xmlns:rdf': "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
          'xmlns:svg': "http://www.w3.org/2000/svg",
          'xmlns': "http://www.w3.org/2000/svg",
          'xmlns:sodipodi': "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
          'xmlns:inkscape': "http://www.inkscape.org/namespaces/inkscape"
        }
      },
      default: {
        files: {
          '<%= config.app %>/images/svg-defs.svg': ['<%= config.app %>/images/svg/icon/*.svg']
        }
      },
    }

@ain ain closed this as completed May 26, 2014
@teles
Copy link

teles commented Jun 10, 2014

Thank you so much for this information @ain , I got the same issue using inkscape generated svg and this fixed my problem.

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

3 participants