use of org.apache.batik.parser.PathHandler in project chordatlas by twak.
the class Extruder method readPath.
private void readPath(String name) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
// Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
// parse using builder to get DOM representation of the XML file
Document dom = db.parse(name);
NodeList paths = dom.getElementsByTagName("path");
PathParser pathParser = new PathParser();
PathHandler pathHandler = new MyPathHandler();
pathParser.setPathHandler(pathHandler);
for (int i = 0; i < paths.getLength(); i++) {
pathParser.parse(paths.item(i).getAttributes().getNamedItem("d").getTextContent());
}
for (Point2d pt : path) {
System.out.println(pt);
}
} catch (Throwable pce) {
pce.printStackTrace();
}
}
Aggregations