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 so...@gmx.de on 2004/03/18 14:12:32 UTC
Local DTD for SVGDocument
When Batik generates the SVGDocument, it sets the DTD like this
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" But I need to set the DTD
local, because my Batik runs in a closed enviroment without any internet
connection. I think I need to use a EntityResolver, but I don´t know to handle this.
Has anybody a code example to solve my problem?
THX
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Local DTD for SVGDocument
Posted by Steffen Otto <so...@gmx.de>.
I think you were right! I found the problem...
... the DTD get lost, because I had some problems at validation-time...
I printed the code with SVGGraphics2D.stream method, can you tell me why
I get the standard DTD, when validation fails?
THX
-----Ursprüngliche Nachricht-----
Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
Gesendet: Samstag, 20. März 2004 02:37
An: Batik Users
Betreff: Re: AW: **SPAM** Re: Local DTD for SVGDocument
Steffen Otto wrote:
> /////////////////////////////////////////
> while printing the code on the console, I get this (false) DTD
> settings...
How do you print the code?
It looks to me like the code should preserve your
DOCTYPE decl.
> now I want to transform the SVGDocument via XSLT...
>
> at this time a get an exception (java.net.UnknownHostException:
> www.w3.org), because the upper DTD
Ahh, the DTD reading problem is a problem with the XSLT
engine not Batik.
> ('http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd') need to
> vailidate...
>
> I dont know to tell batik to take the DTD local... did anybody know
the
> solution? (please give me a code example...)
Not off the top of my head, I'm curious how you are
printing the Document.
>
>
> -----Ursprüngliche Nachricht-----
> Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
> Gesendet: Donnerstag, 18. März 2004 14:39
> An: Batik Users
> Betreff: **SPAM** Re: Local DTD for SVGDocument
>
> sotto@gmx.de wrote:
>
>
>>When Batik generates the SVGDocument, it sets the DTD like this
>>"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" But I need
>
> to set the DTD
>
>>local, because my Batik runs in a closed enviroment without any
>
> internet
>
>>connection. I think I need to use a EntityResolver, but I don´t know
>
> to handle this.
>
>>Has anybody a code example to solve my problem?
>
>
> Hi Sotto,
>
> Batik already includes an EntityResolver that maps well known
> DTD decls to a local DTD. So something must be broken in how
> you are reading the files, perhaps you aren't using the Batik
> classes to read the document, or perhaps the local copies of the
> DTD got lost?
>
>
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: AW: **SPAM** Re: Local DTD for SVGDocument
Posted by Thomas DeWeese <Th...@Kodak.com>.
Steffen Otto wrote:
> /////////////////////////////////////////
> while printing the code on the console, I get this (false) DTD
> settings...
How do you print the code?
It looks to me like the code should preserve your
DOCTYPE decl.
> now I want to transform the SVGDocument via XSLT...
>
> at this time a get an exception (java.net.UnknownHostException:
> www.w3.org), because the upper DTD
Ahh, the DTD reading problem is a problem with the XSLT
engine not Batik.
> ('http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd') need to
> vailidate...
>
> I don’t know to tell batik to take the DTD local... did anybody know the
> solution? (please give me a code example...)
Not off the top of my head, I'm curious how you are
printing the Document.
>
>
> -----Ursprüngliche Nachricht-----
> Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
> Gesendet: Donnerstag, 18. März 2004 14:39
> An: Batik Users
> Betreff: **SPAM** Re: Local DTD for SVGDocument
>
> sotto@gmx.de wrote:
>
>
>>When Batik generates the SVGDocument, it sets the DTD like this
>>"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" But I need
>
> to set the DTD
>
>>local, because my Batik runs in a closed enviroment without any
>
> internet
>
>>connection. I think I need to use a EntityResolver, but I don´t know
>
> to handle this.
>
>>Has anybody a code example to solve my problem?
>
>
> Hi Sotto,
>
> Batik already includes an EntityResolver that maps well known
> DTD decls to a local DTD. So something must be broken in how
> you are reading the files, perhaps you aren't using the Batik
> classes to read the document, or perhaps the local copies of the
> DTD got lost?
>
>
>
> ---------------------------------------------------------------------
> 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
AW: **SPAM** Re: Local DTD for SVGDocument
Posted by Steffen Otto <so...@gmx.de>.
I generate a String like this...
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'svg10.dtd'>
<svg width="210mm" xmlns:xlink="http://www.w3.org/1999/xlink" height="
297mm" xmlns="http://www.w3.org/2000/svg" version="1.0">
<g>
...
<g>
</svg>
//////////////////////////////////////////////
then I have method, which creates a SVGDocument from the upper String...
public SVGDocument loadSVGDocument(String svg_code)
{
try
{
DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
ByteArrayInputStream bais = new
ByteArrayInputStream(svg_code.getBytes());
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
f.setValidating(false);
Document svgDocument = f.createSVGDocument(null, stream);
return (SVGDocument) svgDocument;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
/////////////////////////////////////////
while printing the code on the console, I get this (false) DTD
settings...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg ...
///////////////////////////////////////
now I want to transform the SVGDocument via XSLT...
public void convertXML2FO(File xml, File xslt, File fo) throws
IOException, TransformerException
{
//Setup output
OutputStream out = new java.io.FileOutputStream(fo);
try
{
//Setup XSLT
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new
StreamSource(xslt));
//Setup input for XSLT transformation
Source src = new StreamSource(xml);
//Resulting SAX events (the generated FO) must be piped through
to FOP
Result res = new StreamResult(out);
//Start XSLT transformation and FOP processing
transformer.transform(src, res);
}
finally
{
out.close();
}
}
///////////////////////////////////////
at this time a get an exception (java.net.UnknownHostException:
www.w3.org), because the upper DTD
('http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd') need to
vailidate...
I dont know to tell batik to take the DTD local... did anybody know the
solution? (please give me a code example...)
-----Ursprüngliche Nachricht-----
Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
Gesendet: Donnerstag, 18. März 2004 14:39
An: Batik Users
Betreff: **SPAM** Re: Local DTD for SVGDocument
sotto@gmx.de wrote:
> When Batik generates the SVGDocument, it sets the DTD like this
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" But I need
to set the DTD
> local, because my Batik runs in a closed enviroment without any
internet
> connection. I think I need to use a EntityResolver, but I don´t know
to handle this.
> Has anybody a code example to solve my problem?
Hi Sotto,
Batik already includes an EntityResolver that maps well known
DTD decls to a local DTD. So something must be broken in how
you are reading the files, perhaps you aren't using the Batik
classes to read the document, or perhaps the local copies of the
DTD got lost?
---------------------------------------------------------------------
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: Local DTD for SVGDocument
Posted by Thomas DeWeese <Th...@Kodak.com>.
sotto@gmx.de wrote:
> When Batik generates the SVGDocument, it sets the DTD like this
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" But I need to set the DTD
> local, because my Batik runs in a closed enviroment without any internet
> connection. I think I need to use a EntityResolver, but I don´t know to handle this.
> Has anybody a code example to solve my problem?
Hi Sotto,
Batik already includes an EntityResolver that maps well known
DTD decls to a local DTD. So something must be broken in how
you are reading the files, perhaps you aren't using the Batik
classes to read the document, or perhaps the local copies of the
DTD got lost?
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org