Skip to main content
August 3, 2017
Question

SVG Invalid

  • August 3, 2017
  • 4 replies
  • 4567 views

Hello,

I created an SVG file in Illustrator and it kept adding a couple of extra characters to the file that would show up on the screen. I removed them in a text editor and the file renders fine, but now I can't open the file in AI as it tells me the file needs to be validated. I can't figure out what the code is that I need to put back into the file so that I can open it, but I need to edit the file in AI now and am stuck.

Here are the first few lines of the code. I think it was adding some sort of a closing tag related to DOCTYPE, but I can't figure it out now.

<?xml version="1.0" encoding="utf-8"?>

<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [

    <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">

    <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">

    <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">

    <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">

    <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">

    <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">

    <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">

    <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="735px" height="700px"

     viewBox="0 0 800 700" style="enable-background:new 0 0 800 700;" xml:space="preserve">

<style type="text/css">

    .st0{fill:#1A1A1A;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st1{fill:#808080;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st2{fill:#FFFFFF;}

    .st3{fill:#808080;stroke:#3FA9F5;stroke-width:2;stroke-miterlimit:10;}

    .st4{fill:#009245;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st5{fill:#666666;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st6{enable-background:new    ;}

    .st7{fill:none;}

    .st8{fill:#F2F2F2;}

    .st9{stroke:#3FA9F5;stroke-miterlimit:10;}

    .st10{fill:#3FA9F5;}

    .st11{fill:#62BB46;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st12{fill:#E2DED9;stroke:#3FA9F5;stroke-miterlimit:10;}

    .st13{fill:#F05144;stroke:#3FA9F5;stroke-miterlimit:10;}

</style>

<switch>

    <foreignObject requiredExtensions="&ns_ai;" x="0" y="0" width="1" height="1">

        <i:pgfRef  xlink:href="#adobe_illustrator_pgf">

        </i:pgfRef>

    </foreignObject>

    <g i:extraneous="self">

        <path class="st0" d="M567.1,365.6c0,3.6-2.8,6.4-6.4,6.4c-3.6,0-6.4-2.8-6.4-6.4s2.8-6.4,6.4-6.4

            C564.3,359.2,567.1,362,567.1,365.6z M568.7,366.4h-1.6c-0.4,2.8-2.7,5.1-5.5,5.5v1.6c0,1,0.8,1.8,1.8,1.8h5.2

            c1,0,1.8-0.8,1.8-1.8v-5.2C570.5,367.3,569.7,366.4,568.7,366.4z M554.4,366.4h-1.9c-1,0-1.8,0.8-1.8,1.8v5.2c0,1,0.8,1.8,1.8,1.8

            h5.2c1,0,1.8-0.8,1.8-1.8v-1.7C556.9,371.4,554.7,369.2,554.4,366.4z M568.7,355.4h-5.2c-1,0-1.8,0.8-1.8,1.8v1.9

            c2.8,0.4,5,2.5,5.4,5.1h1.7c1,0,1.8-0.8,1.8-1.8v-5.2C570.5,356.2,569.7,355.4,568.7,355.4z M559.5,359.3v-2c0-1-0.8-1.8-1.8-1.8

            h-5.2c-1,0-1.8,0.8-1.8,1.8v5.2c0,1,0.8,1.8,1.8,1.8h2C554.9,361.8,556.9,359.7,559.5,359.3z"/>

        <g>

This topic has been closed for replies.

4 replies

TYNW
Participant
September 16, 2019

How do you solve this problem?I can't identify files, and I can't open them.

QAQ
Monika Gause
Community Expert
Community Expert
September 16, 2019
Try the W3C validator. It should point out the issues. If that doesn't work for you, try and open the files in Inkscape.
Inspiring
January 4, 2018

You need to add codes back within the pgfRef tag, or just delete the tag. 

<i:pgfRef  xlink:href="#adobe_illustrator_pgf">

        </i:pgfRef>

Monika Gause
Community Expert
Community Expert
August 3, 2017

Did you validate the file using a validator service? What does the service say?

When you create a new SVG with Illustrator, you could try and copy the header and then paste into the SVG source (always do this on a copy of the file).

Try and open the file in Inkscape. Maybe it can open it.

It's a bad idea to have SVG as the file format for your work file. It is an even worse idea to edit an SVG file outside of Illustrator and then expect this edit to even be recognized by Illustrator.

Kanikas
Community Manager
Community Manager
August 3, 2017

Moving to Illustrator