Dwayne Schultz wrote:

I am trying to figure out the easiest way to take the result of an XSL transformation, through Batik, then send the resulting PNG file to a web client.

[...]


  Looking at the code the error below should only happen if you
have two 'elements' at the top level of the source document.
Alternatively if the Xerces document doesn't return the true
root of the document from getDocumentElement().

  So my guess is that the Xerces DOM is returning 'null' from
getDocumentElement(), or your XSL transform is generating
multiple 'top level' elements (which isn't allowed) I don't
know if XSLT checks for this sort of error.

> TranscoderInput says that it takes a
> org.w3c.dom.Document but I get the following error when I try to
> pass in a Xerces DOM tree:
>
> org.w3c.dom.DOMException: The current node (type: 9, name: #document)
> do not allow children of the given type (type: 1, name: svg:svg)
> at org.apache.batik.dom.AbstractNode.createDOMException(Unknown
> Source)
> at org.apache.batik.dom.AbstractDocument.checkChildType(Unknown
> Source)
> at
> org.apache.batik.dom.AbstractParentNode.checkAndRemove(Unknown Source)
> at org.apache.batik.dom.AbstractParentNode.insertBefore(Unknown
> Source)
> at
> org.apache.batik.dom.util.DOMUtilities.deepCloneDocument(Unknown Source)
> at




I am currently making the XSL result a SVGDocument like this:

The result of my translation looks like this:


    <svg:svg xmlns:svg="http://www.w3.org/2000/svg";
        width="185"
        height="100"
        viewBox="0 0 185 100">
        <svg:title>Market Indices Chart</svg:title>
        ...
    </svg:svg>

The resulting SVGDocument looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="http://www.w3.org/2000/svg";
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg";

org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
at net.sf.colle.xml.BatikPlugin.finalizeResult(BatikPlugin.java:132)
at net.sf.colle.xml.Transformation.transform(Transformation.java:407)
at net.sf.colle.web.Context.transform(Context.java:509)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at net.sf.colle.web.KnownManager.service(KnownManager.java:158)
at net.sf.colle.web.ControlServlet.service(ControlServlet.java:128)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH andler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java: 567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon text.java:514)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java: 196)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)


Dwayne


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to