Hi Steven,
the PathParser class is not for parsing entire SVG files, instead it is a
helper class to parse SVG path elements. There
http://xmlgraphics.apache.org/batik/using/parsers.html#parsersHandlersAndPro
ducers you can find some help about parsers. But I think that's not exactly
what you want to do?

Regards,
Steffen

-----Ursprüngliche Nachricht-----
Von: steven reinisch [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 28. Januar 2008 18:49
An: [email protected]
Betreff: ParseException: Unexpected character (code: 60)


hello,

I am using batik 1.7 with the following vm:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
on a macBook.
I am running my code from within eclipse Version: 3.3.1.1
Build id: M20071023-1652.
if I parse any svg from the samples directory using the following
code, I get an org.apache.batik.parser.ParseException:


public static void main(String[] args) {

                BufferedInputStream in = null;
                ByteArrayOutputStream baos = null;

                try {
                        in = new BufferedInputStream(new FileInputStream(new
File(
                                        "data/mines.svg")));
                        baos = new ByteArrayOutputStream();

                        int read;
                        while ((read = in.read()) != -1) {
                                baos.write(read);
                        }
                } catch (Exception e) {
                        throw new RuntimeException(e);
                }

                if (in != null) {
                        try {
                                PathParser pp = new PathParser();
                                MyPathHandler mph = new MyPathHandler();
                                pp.setPathHandler(mph);
                                pp.parse(new String(baos.toByteArray()));
                        } catch (ParseException e) {
                                System.out.println("line: " +
e.getLineNumber());
                                System.out.println("column: " +
e.getColumnNumber());
                                e.printStackTrace();
                        }
                } else {
                        System.out.println("no data");
                }

        }
}


output:

line: 1
column: 0
org.apache.batik.parser.ParseException: Unexpected character (code: 60).
        at
org.apache.batik.parser.AbstractParser.reportError(AbstractParser.java:172)
        at
org.apache.batik.parser.AbstractParser.reportUnexpectedCharacterError(Abstra
ctParser.java:198)
        at
org.apache.batik.parser.PathParser.reportUnexpected(PathParser.java:705)
        at org.apache.batik.parser.PathParser.doParse(PathParser.java:104)
        at
org.apache.batik.parser.AbstractParser.parse(AbstractParser.java:150)
        at parser.Parser.main(Parser.java:36)


the class MyPathHandler implements org.apache.batik.parser.PathHandler. It
just prints to the console,
if org.apache.batik.parser.PathHandler#startPath() and #endPath() is called.
no further processing.

I tried to read the file with a java.io.FileReader with the same exception
as a result.

the character with code 60 is '<' .. obviously not a misplaced character at
the beginning of an xml
document.
is this a configuration problem? do I have set any system properties?


thanks for your help!

steven
_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220


---------------------------------------------------------------------
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]

Reply via email to