xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harry Kao <ha...@hairycow.name>
Subject error casting to SVGSVGElement
Date Sat, 05 Jun 2010 06:09:31 GMT
I'm trying to embed a stylesheet into an SVG document but the sample
code isn't working for me:


If I do this:

  org.w3c.dom.Document svgDoc =
      .createDocument("http://www.w3.org/2000/svg", "svg", null);
  System.out.println("el: " + svgDoc.getDocumentElement());
  System.out.println("ns: " + svgDoc.getDocumentElement().getNamespaceURI());
  System.out.println("name: " + svgDoc.getDocumentElement().getNodeName());
  SVGSVGElement s = (SVGSVGElement)svgDoc.getDocumentElement();

I get the following output:

  el: org.apache.batik.dom.GenericElementNS@1ac88440
  ns: http://www.w3.org/2000/svg
  name: svg
  Exception in thread "main" java.lang.ClassCastException: org.apache.batik.dom.GenericElementNS
cannot be cast to org.w3c.dom.svg.SVGSVGElement
    at ReportRenderer.main(ReportRenderer.java:120)

Is there an obvious reason why this cast is failing?

Fri Jun 4 23:09:25 PDT 2010

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

View raw message