On Dec 13, 2003, at 19:44, Thomas DeWeese wrote:

   The ideal thing would be to take the existing test case
for converting a 'generic' dom (which still uses the
Batik DOM) to the SVG DOM and modify it slightly to use
a Xerces parser/DOM.  Then if you choose to contribute it our
regression testing would ensure that we don't break this code
path in the future.

The existing test is:
xml-batik/test-sources/org/apache/batik/transcoder/image/ GenericDocumentTest.java

Hello Thomas:


Ok, here's what I came up with. I downloaded the source and attempted to run the test suite on my mac, OS X 10.3. Here's what an 'ant regard' returned:

regard:
Loading document ...
Running test run...
Error while running test suite : Cannot build Test instance of class : . Got exception of class : java.lang.IllegalArgumentException with messages test-references/../../beSuite/rendering-orderGr-BE-01.svg and stack trace : java.lang.IllegalArgumentException: test-references/../../beSuite/rendering-orderGr-BE-01.svg
at org.apache.batik.test.svg.AbstractRenderingAccuracyTest.resolveURL(Unkno wn Source)
at org.apache.batik.test.svg.AbstractRenderingAccuracyTest.setConfig(Unknow n Source)
at org.apache.batik.test.svg.PreconfiguredRenderingTest.setId(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteLoader.buildTest(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteLoader.buildTestSuite(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteLoader.buildTestSuite(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteLoader.loadTestSuite(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteRunner.buildTestRunTestSuite(Unkno wn Source)
at org.apache.batik.test.xml.XMLTestSuiteRunner.run(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteRunner.run(Unknown Source)
at org.apache.batik.test.xml.XMLTestSuiteRunner.main(Unknown Source)



BUILD SUCCESSFUL Total time: 31 seconds

It looks like the test is looking for a non-existent .svg. I downloaded http://www.w3.org/Graphics/SVG/Test/20030813/archives/ W3C_SVG_1.1_FullTestsEmbeddedTestinfo.tgz as the MAINTAIN doc specifies but it doesn't contain a rendering-orderGr-BE-01.svg file.

Failing that, I didn't try much harder to make a new test case, but I think we should be able to modify this little command line class to suit our needs:

XercesTest.java:

import java.io.IOException;
import java.io.File;
import java.io.FileOutputStream;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;

public class XercesTest
{
        public static void main(String pxArgs[]) throws
                        ParserConfigurationException,
                        SAXException,
                        IOException,
                        TranscoderException
        {
                DocumentBuilder lxBuilder = null;
                //lxBuilder = org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
                lxBuilder = org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
                                .newInstance().newDocumentBuilder();

                Document lxDoc = lxBuilder.parse(new File(pxArgs[0]));
                TranscoderInput lxInput = new TranscoderInput(
                                lxDoc);

                TranscoderOutput lxOutput = new TranscoderOutput(
                                new FileOutputStream("/dev/null"));

ImageTranscoder lxTranscoder = new PNGTranscoder();

                lxTranscoder.transcode(lxInput, lxOutput);
        }

}

As you can see, there is a line for Xerces' document builder and Crimson's document builder. They both give me the following ClassCastException:

Exception in thread "main" java.lang.ClassCastException
at org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown Source)
at 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 XercesTest.main(XercesTest.java:40)


I'm a bit confused since that isn't the same error I was getting late last week. If you can help me get my test environment set or help me along with the new exception I am seeing above, I would be glad to help Batik however I can.

Thanks again
Dwayne


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



Reply via email to