ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deryk Sinotte <deryk.sino...@audesi.com>
Subject RE: Ant 1.3 + Xalan 2 : strange behaviour
Date Wed, 14 Mar 2001 00:12:07 GMT
We had problems using the XMLSerializer and had to add another linefeed
(System.out.println("")) after everything was dumped out.  Seemed like it
wasn't flushing the stream properly or something.  We never looked into it
too much further.  Might be related...or not.

Deryk

> -----Original Message-----
> From: Peter Löffler [mailto:Peter.Loeffler@gmx.de]
> Sent: Tuesday, March 13, 2001 3:35 PM
> To: ant-user@jakarta.apache.org
> Subject: Ant 1.3 + Xalan 2 : strange behaviour
> 
> 
> The following sample program creates a minimal DOM document and
> serializes it to System.out using TrAX.
> Calling it via an java task gives me a different (and highly
> unexpected) result than calling it directly from the command line:
> 
> 
>   $ ant -verbose
>   Ant version 1.3 compiled on March 2 2001
>   
>   Buildfile: build.xml
>   Detected Java Version: 1.3
>   Detected OS: SunOS
>   parsing buildfile /home/irafs3/s_loeffl/ant-test/build.xml 
> with URI = file:/home/irafs3/s_loeffl/ant-test/build.xml
>   Project base dir set to: /home/irafs3/s_loeffl/ant-test
>   Build sequence for target `test' is [compile, test]
>   Complete build sequence is [compile, test]
>   
>   compile:
>       [javac] AntXalanTraxTest.java omitted as 
> /home/irafs3/s_loeffl/ant-test/AntXalanTraxTest.class is up to date.
>   
>   test:
>        [java] Forking java -classpath 
> /home/irafs3/s_loeffl/ant-test:/home/irafs3/s_loeffl/Java/xala
> n-j_2_0_0/bin/xerces.jar:/home/irafs3/s_loeffl/Java/xalan-j_2_
> 0_0/bin/xalan.jar AntXalanTraxTest
>        [java] <?xml version="1.0" encoding="UTF-8"?>
>   
>   BUILD SUCCESSFUL
> 
> 
> Taking the command above and executing it from the shell gives me:
> 
> 
>   $  java -classpath 
> /home/irafs3/s_loeffl/ant-test:/home/irafs3/s_loeffl/Java/xala
> n-j_2_0_0/bin/xerces.jar:/home/irafs3/s_loeffl/Java/xalan-j_2_
> 0_0/bin/xalan.jar AntXalanTraxTest
>   <?xml version="1.0" encoding="UTF-8"?>
>   <Test/>
> 
> 
> The first version (via ant) is missing the <Test/> element!
> Could someone try to reproduce this?
> Any explanations?
> ($CLASSPATH isn't set, $JAVA_HOME/jre/lib/ext/ is empty,
> replacing jaxp.jar and parser.jar in $ANT_HOME/lib by xerces.jar
> didn't change anything)
> 
> 
> The java source:
> 
> 
>   import java.io.IOException;
>   
>   import javax.xml.parsers.DocumentBuilderFactory;
>   import javax.xml.parsers.DocumentBuilder;
>   import javax.xml.parsers.ParserConfigurationException;
>   
>   import javax.xml.transform.TransformerFactory;
>   import javax.xml.transform.Transformer;
>   import javax.xml.transform.TransformerConfigurationException;
>   import javax.xml.transform.TransformerException;
>   import javax.xml.transform.dom.DOMSource;
>   import javax.xml.transform.stream.StreamResult;
>   
>   import org.w3c.dom.Document;
>   import org.w3c.dom.Element;
>   
>   public class AntXalanTraxTest {
>   
>       public static void main(String[] args) 
>               throws IOException, TransformerConfigurationException,
>                       TransformerException, 
> ParserConfigurationException  {
>           DocumentBuilderFactory dbFactory =
>                   DocumentBuilderFactory.newInstance();
>           DocumentBuilder docBuilder = dbFactory.newDocumentBuilder();
>   
>           Document doc = docBuilder.newDocument();
>           Element testElement = doc.createElement("Test");
>           doc.appendChild(testElement);
>   
>           TransformerFactory tFactory = 
> TransformerFactory.newInstance();
>           Transformer transformer = tFactory.newTransformer();
>           transformer.transform(new DOMSource(doc),
>                   new StreamResult(System.out));
>       }
>   
>   }
> 
> 
> My build.xml:
> 
> 
>   <project name="Ant-Xalan-TrAX-Test" default="test" basedir=".">
>   
>     <property name="HOME" value="/home/irafs3/s_loeffl"/>
>     <property name="xalanJar" 
> value="${HOME}/Java/xalan-j_2_0_0/bin/xalan.jar"/>
>     <property name="xercesJar" 
> value="${HOME}/Java/xalan-j_2_0_0/bin/xerces.jar"/>
>   
>     <target name="compile">
>       <javac classpath="${xercesJar}:${xalanJar}"
>              srcdir="."
>              includes="AntXalanTraxTest.java"/>
>     </target>
>   
>     <target name="test" depends="compile">
>       <java classname="AntXalanTraxTest"
>             classpath=".:${xercesJar}:${xalanJar}"
>             fork="yes">
>       </java>
>     </target>
>   
>   </project>
>   
> 
> All files are in /home/irafs3/s_loeffl/ant-test
> Xalan version: 2.0.0
> Xerces version: 1.2.3
> 
> 
> Thanks,
> 	Peter
> 

Mime
View raw message