Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find package org.w3c.dom.svg?

Tags:

batik

I cannot seem to find it and Netbeans says that the package does not exist? Which jar do I have to get to have package org.w3c.dom.svg? I'm using batik SVG

like image 575
Bashir Beikzadeh Avatar asked Dec 26 '22 13:12

Bashir Beikzadeh


1 Answers

The W3C reference link in Jelle Fresen's answer is v.1.1 of the spec, from 2010. Unfortunately Batik 1.9 (the latest as of this writing) is written against the much older 1.0 spec, from 2001.

There are surely other incompatibilities between the 1.0 and 1.1 specs, but the first one I encountered was a java.lang.NoSuchMethodError: org.w3c.dom.svg.SVGTransformList.getNumberOfItems()I because Apache expects ints, whereas SVG 1.1 API speaks in long values.

The W3C's SVG 1.0 reference implementation can be found here, at least for now: https://www.w3.org/TR/SVG10/java.html

Unfortunately that package has a dependency on SMIL; 3.0 is the newest version that predates SVG 1.1, and only contains two Java classes, which you can find here: https://www.w3.org/TR/SMIL3/smil-timing.html#q142

You can simply build your own JAR from that code. Or you can probably just use Maven to resolve all your problems. Unfortunately, the client I'm working with still lives in dependency hell and these things need to be resolved manually.

Many thanks to Jelle Fresen, whose link led me to what I was looking for.

Update: OK, it looks like the Batik distribution contains these libraries too, unsurprisingly. You can download it here, as I already had: https://xmlgraphics.apache.org/batik/download.html

Confusingly, batik-all-1.9.jar (included in batik-bin-1.9.zip) doesn't contain everything you need.

So the real (most practical, if you're not blessed by Maven) answer to the original question is that the package org.w3c.dom.svg can be found in xml-apis-ext-1.3.04.jar, provided with the Batik distribution.

like image 126
Lambart Avatar answered Jun 10 '23 16:06

Lambart