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]