From b42a91770d43cd1c057559b648fbca49e9eedca0 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Fri, 27 Jul 2001 13:49:03 +0000 Subject: [PATCH] handles xml only input, assumes fo file git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194376 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/tools/TestConverter.java | 35 +++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/org/apache/fop/tools/TestConverter.java b/src/org/apache/fop/tools/TestConverter.java index 57a9c04e6..c3328377b 100644 --- a/src/org/apache/fop/tools/TestConverter.java +++ b/src/org/apache/fop/tools/TestConverter.java @@ -94,7 +94,7 @@ public class TestConverter { * The document is read as a dom and each testcase is covered. */ public Hashtable runTests(String fname, String dest, String compDir) { - System.out.println("running tests in file:" + fname); + //System.out.println("running tests in file:" + fname); try { if (compDir != null) { compare = new File(baseDir + "/" + compDir); @@ -118,7 +118,7 @@ public class TestConverter { if (testsuite.hasAttributes()) { String profile = testsuite.getAttributes().getNamedItem( "profile").getNodeValue(); - System.out.println("testing test suite:" + profile); + //System.out.println("testing test suite:" + profile); } NodeList testcases = testsuite.getChildNodes(); for (int count = 0; count < testcases.getLength(); count++) { @@ -143,7 +143,7 @@ public class TestConverter { if (tcase.hasAttributes()) { String profile = tcase.getAttributes().getNamedItem( "profile").getNodeValue(); - System.out.println("testing profile:" + profile); + //System.out.println("testing profile:" + profile); } NodeList cases = tcase.getChildNodes(); for (int count = 0; count < cases.getLength(); count++) { @@ -182,22 +182,31 @@ public class TestConverter { String xml = test.getAttributes().getNamedItem("xml").getNodeValue(); - String xsl = - test.getAttributes().getNamedItem("xsl").getNodeValue(); - System.out.println("converting xml:" + xml + " and xsl:" + - xsl + " to area tree"); + Node xslNode = test.getAttributes().getNamedItem("xsl"); + String xsl = null; + if (xslNode != null) { + xsl = xslNode.getNodeValue(); + } + //System.out.println("converting xml:" + xml + " and xsl:" + + // xsl + " to area tree"); try { File xmlFile = new File(baseDir + "/" + xml); try { - Configuration.put("baseDir", xmlFile.getParentFile().toURL().toExternalForm()); + Configuration.put("baseDir", + xmlFile.getParentFile().toURL().toExternalForm()); } catch (Exception e) { System.err.println("Error setting base directory"); } - InputHandler inputHandler = new XSLTInputHandler(xmlFile, - new File(baseDir + "/" + xsl)); + InputHandler inputHandler = null; + if (xsl == null) { + inputHandler = new FOInputHandler(xmlFile); + } else { + inputHandler = new XSLTInputHandler(xmlFile, + new File(baseDir + "/" + xsl)); + } XMLReader parser = inputHandler.getParser(); setParserFeatures(parser); @@ -220,9 +229,9 @@ public class TestConverter { if (outname.endsWith(".xml")) { outname = outname.substring(0, outname.length() - 4); } - driver.setOutputStream( - new FileOutputStream(new File(destdir, outname + (outputPDF ? ".pdf" : ".at.xml")))); -System.out.println("ddir:" + destdir + " on:" + outname + ".pdf"); + driver.setOutputStream( new FileOutputStream( + new File(destdir, outname + (outputPDF ? ".pdf" : ".at.xml")))); + //System.out.println("ddir:" + destdir + " on:" + outname + ".pdf"); driver.render(); // check difference -- 2.39.5