schmmd
schmmd

Reputation: 19468

Manipulate SVG XML for Batik

I am using Batik to manipulate SVG XML and display the changes. By default, however, this involves using org.w3c.dom which is exceedingly difficult to use. Is it possible to use another DOM library to modify the XML but have it still work with Batik? Maybe there is a wrapper for org.w3c.dom? I believe the objects in the DOM representation are actually Batik subclasses, so I can't convert to another representation and back unless I want to re-render the entire SVG.

Upvotes: 1

Views: 891

Answers (1)

Has QUIT--Anony-Mousse
Has QUIT--Anony-Mousse

Reputation: 77454

The dom libraries are not that hard to use. You need to understand the factory pattern, and then they are pretty much straightforward. A bit verbose, but straightforward. It's also fairly simple to write a number of helper functions that suit your needs, such as a drawLine function that just produces a line element etc.

Give it a try, and practise your DOM skills. You know, all the web browsers use DOM, too.

As far as I know, Batik will "annotate" the document with a rendering tree. But I'd not try to manipulate the rendering tree directly.

Oh, and make sure to wrap any changes in the update queue. Just like you'd do with the EDT for Swing/AWT on Java.

Upvotes: 2

Related Questions