Re: Java SAX and SVG files
Thank you Thomas, I set factory.setValidating(false); than the the SAx Parser gave me the right reading of the SVG file. But the error (below) showed up at the end. Hopufully when I add this class to my tool it won't make the whole sapplication crash. Do you suggest any free-ware that converts jpg to svg and conform to the SVG DTD? I think the example I am using was a SVG created by WebDwarf V2. Error: org.xml.sax.SAXParseException: The processing instruction target matching [xX][mM][lL] is not allowed. at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at javax.xml.parsers.SAXParser.parse(SAXParser.java:281) at drawtool.ParseSVG.main(ParseSVG.java:154) Quoting Thomas DeWeese [EMAIL PROTECTED]: Hi Alice, Alice Cavallo wrote: I am trying to read and process SVG files from a Java application. I am trying to use SAX, but there is some characters that are not understood by SAX. For example, the only way SaxParser could read properly the SVG file (without any error and outputing the right information) was after removing the following comment line : !DOCTYPE svg PUBLIC -//W3C//DTD SVG 20010904//EN http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd; This probably indicates that the document doesn't conform to the SVG DTD. Seeing the errors would help confirm this. Can I really read SVG using SaxParser? Yes, this is exactly what Batik does. Any advice? Either turn of validation or fix your content so it conforms to the DTD. I do need a generic method to read any given SVG file and parse the tags and attributes. You could look at the Batik batik.dom.svg.SAXSVGDocumentFactory Thank you so much and I hope you all had good holidays (for the american crew). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java SAX and SVG files
Alice Cavallo wrote: I set factory.setValidating(false); than the the SAx Parser gave me the right reading of the SVG file. But the error (below) showed up at the end. I get this error if I have two ?xml ... lines in my Document. As to your other sample file that was a gzip compressed SVG file (it should have .svgz as it's extension). Hopufully when I add this class to my tool it won't make the whole sapplication crash. Well, hopefully you are catching exceptions and notifying the user when problems are encountered. Do you suggest any free-ware that converts jpg to svg and conform to the SVG DTD? I've played with AutoTrace it did a decent job. You might check out: http://www.gy.com/Computer/CAD_and_CAM/Raster_to_Vector/ I think the example I am using was a SVG created by WebDwarf V2. Error: org.xml.sax.SAXParseException: The processing instruction target matching [xX][mM][lL] is not allowed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java SAX and SVG files
Hi, Do you suggest any free-ware that converts jpg to svg and conform to the SVG DTD? Maybe you could try - PoTrace - AutoTrace - Delinate - front end for PoTrace and Autotrace All those available at sourceforge.net Regards Tonny Kohar -- Sketsa SVG Graphics Editor http://www.kiyut.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java SAX and SVG files
Hi Alice, Alice Cavallo wrote: I am trying to read and process SVG files from a Java application. I am trying to use SAX, but there is some characters that are not understood by SAX. For example, the only way SaxParser could read properly the SVG file (without any error and outputing the right information) was after removing the following comment line : !DOCTYPE svg PUBLIC -//W3C//DTD SVG 20010904//EN http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd; This probably indicates that the document doesn't conform to the SVG DTD. Seeing the errors would help confirm this. Can I really read SVG using SaxParser? Yes, this is exactly what Batik does. Any advice? Either turn of validation or fix your content so it conforms to the DTD. I do need a generic method to read any given SVG file and parse the tags and attributes. You could look at the Batik batik.dom.svg.SAXSVGDocumentFactory Thank you so much and I hope you all had good holidays (for the american crew). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]