xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Couch <jus...@vlc.com.au>
Subject GVTBuilder error with custom DOMs
Date Wed, 13 Mar 2002 22:21:41 GMT
G'day Folks,

Popping my head out of the woodwork here to ask a few questions about 
the Batik implementation, and to point out a bug or two. This one is a 
bug report, advice request to follow in the next email....

The bug: - The GVTBuilder crashes if I pass the code a Document instance 
created by the default JAXP parser. The code in GraphicsNode assumes 
that you will be getting a DOM Document that happens to support the 
Views extension. This is not always the case - we use our own custom DOM 
builder (we're creating DOM Level3 documents and providing our own DOM 
implementation). The crash we get is this line:

public GraphicsNode build(BridgeContext ctx, Document document) {
    // set the media type
    AbstractViewCSS view;
    view = (AbstractViewCSS)((DocumentView)document).getDefaultView();

System - JDK 1.4.0FCS, Batik 1.1.1 binary download.

I'm finding that the Batik code is making a hell of a lot of assumptions 
about who generated the DOM instance for it. In general, the testing 
looks like you've only assumed that you're using the Apache DOM 
implementation (probably crimson by the looks of the included download 
JARs). The code should be more rigid by first checking what capabilities 
the Document has that is being passed to you. ie, You need to insert at 
least these lines:

DOMImplementation impl =  document.getImplementation();
if(impl.hasFeature("views", null)) {
    AbstractViewCSS view;
    view = (AbstractViewCSS)((DocumentView)document).getDefaultView();
    ....
}

Either that, or state up front in the documentation that the generator 
of the document must support XYZ features for it to be usable with Batik.

-- 
Justin Couch                         http://www.vlc.com.au/~justin/
Java Architect & Bit Twiddler              http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                               - Greg Bear, Slant
-------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message