You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Jane Singer <js...@cc.huji.ac.il> on 2003/01/13 19:41:28 UTC

W3C "valid" SVG documents

Hello,

I'm creating an SVG file by importing a basic SVG document (along with a lot
of <def> elements), then appending various graphic, text and use elements,
using the various defs.

I created the file like this:

 File file = new File("F:\\input_output\\basic_document.svg");
    try {
          String uri = file.toURL().toString();
          SVGDocumentFactory df  =
          new SAXSVGDocumentFactory
          ("org.apache.crimson.parser.XMLReaderImpl");

          SVGdoc =  df.createDocument(uri);
        } catch (java.io.IOException ioe) {
        ioe.printStackTrace();
    }

The imported file has a structure like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="600" height="800" viewBox="-10 30 120 80"  >

<defs>
.
.
.
</defs>
</svg>
</xml>

However, when I try to validate the document at the W3C site
(http://validator.w3.org/check), I get an error. The problem is an element
that gets inserted right before the defs element:
<svg contentScriptType="text/ecmascript"
     xmlns:xlink="http://www.w3.org/1999/xlink" width="600"
zoomAndPan="magnify"
     contentStyleType="text/css" viewBox="-10 30 120 80" height="800"
     preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
     version="1.0">

I'm not sure how this gets inserted. The document validates fine when I
remove it. What is going on?

(I am also getting errors when I try to view it in JSVGCanvas, which is why
I thought to validate it.)

Thanks for any tips.

Jane




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: W3C "valid" SVG documents

Posted by Jane Singer <js...@cc.huji.ac.il>.
OK, I typed that  into the example by mistake, it is not in the document.

I guess my general question is, are the documents created by the
org.apache.batik.dom.svg.SVGDocumentFactory valid W3C documents?
I'm having a lot of trouble combining W3C component with those created by
batik and others. It seems most of my problems have to do with the order I
list things in the classpath.
Jane

----- Original Message -----
From: "Vincent Hardy" <vi...@sun.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Wednesday, January 15, 2003 7:52 AM
Subject: Re: W3C "valid" SVG documents


> Hello Jane,
>
> Try your file without the trailing </xml>. It should work better.
> Vincent.
>
> Jane Singer wrote:
> > Hello,
> >
> > I'm creating an SVG file by importing a basic SVG document (along with a
lot
> > of <def> elements), then appending various graphic, text and use
elements,
> > using the various defs.
> >
> > I created the file like this:
> >
> >  File file = new File("F:\\input_output\\basic_document.svg");
> >     try {
> >           String uri = file.toURL().toString();
> >           SVGDocumentFactory df  =
> >           new SAXSVGDocumentFactory
> >           ("org.apache.crimson.parser.XMLReaderImpl");
> >
> >           SVGdoc =  df.createDocument(uri);
> >         } catch (java.io.IOException ioe) {
> >         ioe.printStackTrace();
> >     }
> >
> > The imported file has a structure like this:
> >
> > <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> > "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> > <svg width="600" height="800" viewBox="-10 30 120 80"  >
> >
> > <defs>
> > .
> > .
> > .
> > </defs>
> > </svg>
> > </xml>
> >
> > However, when I try to validate the document at the W3C site
> > (http://validator.w3.org/check), I get an error. The problem is an
element
> > that gets inserted right before the defs element:
> > <svg contentScriptType="text/ecmascript"
> >      xmlns:xlink="http://www.w3.org/1999/xlink" width="600"
> > zoomAndPan="magnify"
> >      contentStyleType="text/css" viewBox="-10 30 120 80" height="800"
> >      preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"
> >      version="1.0">
> >
> > I'm not sure how this gets inserted. The document validates fine when I
> > remove it. What is going on?
> >
> > (I am also getting errors when I try to view it in JSVGCanvas, which is
why
> > I thought to validate it.)
> >
> > Thanks for any tips.
> >
> > Jane
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: W3C "valid" SVG documents

Posted by Vincent Hardy <vi...@sun.com>.
Hello Jane,

Try your file without the trailing </xml>. It should work better.
Vincent.

Jane Singer wrote:
> Hello,
> 
> I'm creating an SVG file by importing a basic SVG document (along with a lot
> of <def> elements), then appending various graphic, text and use elements,
> using the various defs.
> 
> I created the file like this:
> 
>  File file = new File("F:\\input_output\\basic_document.svg");
>     try {
>           String uri = file.toURL().toString();
>           SVGDocumentFactory df  =
>           new SAXSVGDocumentFactory
>           ("org.apache.crimson.parser.XMLReaderImpl");
> 
>           SVGdoc =  df.createDocument(uri);
>         } catch (java.io.IOException ioe) {
>         ioe.printStackTrace();
>     }
> 
> The imported file has a structure like this:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg width="600" height="800" viewBox="-10 30 120 80"  >
> 
> <defs>
> .
> .
> .
> </defs>
> </svg>
> </xml>
> 
> However, when I try to validate the document at the W3C site
> (http://validator.w3.org/check), I get an error. The problem is an element
> that gets inserted right before the defs element:
> <svg contentScriptType="text/ecmascript"
>      xmlns:xlink="http://www.w3.org/1999/xlink" width="600"
> zoomAndPan="magnify"
>      contentStyleType="text/css" viewBox="-10 30 120 80" height="800"
>      preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
>      version="1.0">
> 
> I'm not sure how this gets inserted. The document validates fine when I
> remove it. What is going on?
> 
> (I am also getting errors when I try to view it in JSVGCanvas, which is why
> I thought to validate it.)
> 
> Thanks for any tips.
> 
> Jane
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org