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 André Ávila <as...@nextech.com.br> on 2006/03/09 23:20:18 UTC

Problem with SAXSVGDocumentFactory

Hello, 

I'm using SAXSVGDocumentFactory to create SVGDocument objects from ByteBuffer objects in memory. The code is very simple:
                       
ByteBuffer fileBuffer; // initialized somewhere else

ByteArrayInputStream file = new ByteArrayInputStream(fileBuffer.array());
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
SVGDocument doc = factory.createSVGDocument(null, file);

This code works fine most of the times, but for some SVGs the SAXSVGDocumentFactory raises a "java.io.IOException: Content is not allowed in trailing section", which would indicate that the content is corrupted or somehow malformed. However, those same SVGs work fine when I load them in Batik with the JSVGCanvas.setURI() method. 

Why do I get different results? Am I doing something wrong with SAXSVGDocumentFactory? 

Thanks for any ideas!

André

Re: Problem with SAXSVGDocumentFactory

Posted by André Ávila <as...@nextech.com.br>.
Never mind. There was a problem with the ByteBuffer we were using. Sorry about that.
  ----- Original Message ----- 
  From: André Ávila 
  To: batik-users@xmlgraphics.apache.org 
  Sent: Thursday, March 09, 2006 7:20 PM
  Subject: Problem with SAXSVGDocumentFactory


  Hello, 

  I'm using SAXSVGDocumentFactory to create SVGDocument objects from ByteBuffer objects in memory. The code is very simple:
                         
  ByteBuffer fileBuffer; // initialized somewhere else

  ByteArrayInputStream file = new ByteArrayInputStream(fileBuffer.array());
  String parser = XMLResourceDescriptor.getXMLParserClassName();
  SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
  SVGDocument doc = factory.createSVGDocument(null, file);

  This code works fine most of the times, but for some SVGs the SAXSVGDocumentFactory raises a "java.io.IOException: Content is not allowed in trailing section", which would indicate that the content is corrupted or somehow malformed. However, those same SVGs work fine when I load them in Batik with the JSVGCanvas.setURI() method. 

  Why do I get different results? Am I doing something wrong with SAXSVGDocumentFactory? 

  Thanks for any ideas!

  André


------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Free Edition.
  Version: 7.1.375 / Virus Database: 268.2.1/278 - Release Date: 9/3/2006