Hello,
I'm having a problem using compareDocumentPosition in Batik 1.6 running
under Java 1.5 on Windows XP. Whenever I call it, my code compiles
fine, but I get an AbstractMethodError at runtime. I found that this
even happens when I use the example code from
http://wiki.apache.org/xmlgraphics-batik/UsingDOM3. I've attached the
example code to this email. What I've been able to find online suggests
that this is a problem with using a Java version before 1.5, but I've
verified that I'm using 1.5 at runtime. Any suggestions?
Alternately, is there a better way to figure out which of two elements
has a higher "z-index" than using compareDocumentPosition? I need this
information for the image processing I'm doing, but I haven't been able
to find a cleaner way to determine this with Batik.
Thank you for your help,
Xavid Pretzer
package jp.co.ricoh.src.trevor.test;
import org.apache.batik.Version;
import org.apache.batik.dom.AbstractNode;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class BatikTestCase {
public static void main(String[] args) {
System.out.println(System.getProperty("java.version"));
System.out.println(Version.getVersion());
// Create a new SVG document
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
Document doc = impl.createDocument("http://www.w3.org/2000/svg", "svg",
null);
// Create a 'g' element and append it to the root 'svg' element
Element svg = doc.getDocumentElement();
Element e = doc.createElementNS("http://www.w3.org/2000/svg", "g");
svg.appendChild(e);
AbstractNode n1 = (AbstractNode) svg;
AbstractNode n2 = (AbstractNode) e;
int position = n1.compareDocumentPosition(n2);
if (position == (AbstractNode.DOCUMENT_POSITION_PRECEDING
| AbstractNode.DOCUMENT_POSITION_CONTAINS)) {
System.out.println("The svg element contains the g element.");
} else {
System.out.println("Something is wrong!");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]