This page details information atbout Batik’s implementation of features from SVG 1.2, Tiny and Full. Note that the information on this page is based on the code in the Subversion repository trunk.
DOM Level 3 Core,
Events and XPath
are all supported. These features are available regardless of whether
the document has version="1.1" or
version="1.2" set on the root svg element.
There are a few issues with the DOM Level 3 Core implementation:
Document.compareDocumentPosition method does not give
the correct result when used on DTD notation or entity nodes in the
document.
Node.renameNode always creates a new node and replaces
the old node with it. This is technically allowed, but sub-optimal.
schemaTypeInfo attribute
on the Attr and Element interfaces) do not
do so.
Document.normalizeDocument ignores the
"entities" parameter in the document’s
DOMConfiguration.
JREs before 1.5 include the DOM Level 2 interfaces and this can cause
problems when trying to use the DOM Level 3 versions of these same interface
files (org.w3c.dom.*). Though the concrete Batik DOM
classes implement the DOM Level 3 functionality, you won’t be able to access
those methods through the org.w3c.dom interfaces on these
earlier JREs.
There are two ways to overcome this problem. The first
is to install the DOM Level 3 interfaces using the
Endorsed
Standards Override Mechanism. Copy the file
lib/xml-apis-ext.jar into the endorsed standards override
directory and the DOM Level 3 interfaces will be visible. You can then write
code against them (for example, call Document.renameNode
directly). However, this will mean that other people cannot run or
compile your code unless they have JRE 1.5 or later, or they have also
installed the xml-apis-ext.jar in the same way.
The second method, which requires less messing about with the JRE, is
to cast your DOM objects to the concrete Batik DOM objects and call
your DOM Level 3 methods directly on them. The Batik DOM classes are in the
org.apache.batik.dom package. The classes named
Abstract* implement the DOM interfaces, and also contain
the DOM Level 3 methods. The advantage of this method is that for your code
to compile and run in others’ environments, they need not install any
jars with the endorsed standards overrides.
Here is an example of using the second method to get access to DOM Level 3 specific methods:
For cases where the DOM Level 3 versions of these interfaces contain constants that you wish to use, the constants have been copied into the Batik DOM classes. For example:
Note that using these org.apache.batik.dom interfaces is only needed
for the DOM Level 3 Core and Events interfaces. There were no earlier
versions of the DOM XPath interfaces to conflict with, so these can be
used directly (org.w3c.dom.xpath).
Of course, none of this matters if you are just using the DOM 3 functionality in ECMAScript, as the matter of interfaces is hidden from the scripting environment.
sXBL is supported in documents with version="1.2". However,
the following issues exist:
traitDef element is not implemented.
Two content selector languages are supported: XPath 1.0 Patterns and the
drastically reduced XPath subset. XPath Patterns is the default
language. To change the language used to the XPath subset, put an
attribute batik:selectorLanguage="XPathSubset" on the
xbl:content element or on the svg document
element. (The batik extension namespace prefix should be
declared with
xmlns:batik="http://xml.apache.org/batik/ext".)
Note that sXBL is likely to be dropped in favor of XBL 2.0 in SVG 1.2 Full.
The flowRoot, flowRegion,
flowDiv, flowPara, flowSpan,
flowRegionBreak and flowLine elements
from SVG 1.2 Full’s
Flowing
Text and Graphics chapter are supported in documents with
version="1.2".
The more recent SVG 1.2 Tiny draft specifies a different syntax for (a more restricted version of) flowing text, and the full flowing text syntax is therefore likely to change.
The following other features from SVG 1.2 are supported:
solidColor
paint server element,
multiImage, subImageRef and
subImage elements for
Alternate
content based on display resolutions,
handler
element,
boundingBox attribute of the RenderedBBoxChange event is not
used), and
startMouseCapture and stopMouseCapture
methods on the
global
object.