Hi

My environment : (Java 1.4.2_6;  Ant 1.7.1; OS : Ubuntu 10.10; 
Xmltask-v1.14.2.jar)

I am copying a configuration file from source to destination and using xmltask 
to apply some environment dependent configuration settings.

This
<environments DefaultEnvironment="development">
            <environment Id="development" DBPlatform="Oracle" 
ConnectionString="jdbc:oracle:thin:@10.184.192.13:1521:ORCL"                    
                                            
Driver="oracle.jdbc.driver.OracleDriver" UserId="pwis2" Password="copycat" 
DbPoolValidationSql="Select sysdate from dual"/>
</environments>

Ends up looking like that below, with the following string at the start of the 
environment element simply missing :  Id="development" DBPlatform="Oracle"
<environments DefaultEnvironment="development">
<environment ConnectionString="jdbc:oracle:thin:@10.184.192.13:1521:ORCL" 
DBPlatform="Oracle" DbPoolValidationSql="Select sysdate from dual"
Driver="oracle.jdbc.driver.OracleDriver" Id="development" Password="copycat" 
UserId="pwis2"/>
</environments>


ANT BUILD FILE :

<project name="test" default="copyFiles" basedir=".">

<property name="root.dir" value="${basedir}"/>

<property name="source.dir" value="${basedir}/sourceDir"/>
<property name="target.dir" value="${basedir}/targetDir"/>

<property file="development.properties"/>

<path id="build.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar" />
</fileset>
</path>

<target name="clean" description="does a clean up of the target directory">
<delete>
<fileset dir="${target.dir}">
     <include name="*.xml"/>
</fileset>
</delete>
</target>
<target name="copyFiles" depends="clean">
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" 
classpathref="build.classpath"/>
<xmltask source="${source.dir}/framework_startup.xml" 
dest="${target.dir}/framework_startup.xml">
<insert 
path="Root/ApplicationsCollection/ApplicationObject"><![CDATA[${environment}]]></insert>
</xmltask>
</target>

</project>

SOURCE FILE :
<?xml version="1.0"?>
<Root>
  <ApplicationsCollection>
    <ApplicationObject>
    </ApplicationObject>
  </ApplicationsCollection>
</Root>

TARGET FILE :
<?xml version="1.0" encoding="UTF-8"?>
<Root>
  <ApplicationsCollection>
    <ApplicationObject>
    <environments DefaultEnvironment="development">
<environment ConnectionString="jdbc:oracle:thin:@10.184.192.13:1521:ORCL" 
DBPlatform="Oracle" DbPoolValidationSql="Select sysdate from dual" 
Driver="oracle.jdbc.driver.OracleDriver" Id="development" Password="copycat" 
UserId="pwis2"/>
</environments>
</ApplicationObject>
  </ApplicationsCollection>
</Root>

Any help would be appreciated.

Kind regards

Grant Edwards


PS : I am dealing with a legacy system that requires a 1.4 JVM, so not 
something that can be easily changed.


"All views or opinions expressed in this electronic message and its attachments 
are the view of the sender and do not necessarily reflect the views and 
opinions of the Provincial Government of the Western Cape ("the PGWC'). No 
employee of the PGWC is entitled to conclude a binding contract on behalf of 
the PGWC unless he/she is an accounting officer of the PGWC, or his or her 
authorised representative. The information contained in this message and its 
attachments may be confidential or privileged and is for the use of the named 
recipient only, except where the sender specifically states otherwise. If you 
are not the intended recipient you may not copy or deliver this message to 
anyone."
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to