Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Batik - parsing a SVG
Batik - parsing a SVG [message #221581] Wed, 16 August 2006 09:21
Eclipse UserFriend
Originally posted by: dscholz.htwm.de

Hello,

I have an SVG-File and for example I want to parse a path. I know there
are Parsers in Batik like the PathParser but I don't know exactly how tu
use it. Here are some lines of code where I try to use the PathParser:

PathParser pp = new PathParser();
PHandler ph = new PHandler();
pp.setPathHandler(ph);
File file = null;
FileReader freader;
BufferedReader bufreader;
try {
file = new File("test.svg");
freader = new FileReader(file);
bufreader = new BufferedReader(freader);
bufreader.mark((int)file.length() + 1);
String line = bufreader.readLine();
do {
System.out.println(line);
line = bufreader.readLine();
} while (line != null);
bufreader.reset();
pp.parse(bufreader);
freader.close();
bufreader.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}

I check the input of the file by printing the lines of the SVG (XML) to
the console which is correct. I also can view the SVG without problems but
when pp.parse(...) is called I got the following errors:

org.apache.batik.parser.ParseException: Unexpected character (code: 60).
at org.apache.batik.parser.AbstractParser.reportError(Unknown Source)
at org.apache.batik.parser.PathParser.doParse(Unknown Source)
at org.apache.batik.parser.AbstractParser.parse(Unknown Source)

Does anybody know how to use the Parsers? Thanks for your help and hints
in advance.
Previous Topic:nested palette containers
Next Topic:people using gef
Goto Forum:
  


Current Time: Thu Apr 25 21:48:14 GMT 2024

Powered by FUDForum. Page generated in 0.03358 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top