Hi Gentlemen,
I have a question on the xmltask when using it for xml config file manipulation
-- I found it will be harmful to the original format of specified xml document
during its processing replacement whenever the attributes of preservetype
or/and outputter are use or not. Below is the ant build script and attached
please find are the example and replaced file. May I get your time and effort
to do some support? Thanks for your kindly help.~
Ant scriopt:
<?xml version="1.0" encoding="UTF-8"?>
<project default="datasource_replacement" basedir=".">
<property name="libs.dir"
value="D:/tmp/cruisecontrol-2.7.2/apache-ant-1.7.0/lib"/>
<path id="project.classpath">
<pathelement location="${libs.dir}/ant-contrib.jar" />
<pathelement
location="D:/tmp/cruisecontrol-2.7.2/apache-ant-1.7.1/lib/xmltask-v1.15.1.jar"/>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
<target name="datasource_replacement">
<xmltask omitHeader="no" source="kodo-dao-context.xml"
dest="kodo-dao-context_00.xml" outputter="default" preservetype="true">
<replace
path="/:beans/:be...@id='platDataSource']/:proper...@name='url']/@value"
withText='jdbc:oracle:thin:@16.158.48.90:1521:PF'/>
</xmltask>
</target>
</project>
Sean
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
<bean id="logAdvice" class="com.bitfone.smartdm.facade.util.PersistentLogAdvice"/>
<bean id="logAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<constructor-arg ref="logAdvice"/>
<property name="pattern" value=".*insert.*"/>
</bean>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<bean id="transAdvise" class="com.bitfone.smartdm.datasource.DBContextResetAdvise"/>
<aop:config>
<aop:aspect ref="transAdvise">
<aop:around
pointcut="execution(* com.bitfone.smartdm.facade.service.impl.*.*(..))"
method="invoke"/>
</aop:aspect>
</aop:config>
<!--
<jee:jndi-lookup id="platDataSource" jndi-name="jdbc/smartdm0"/>
<jee:jndi-lookup id="core1DataSource" jndi-name="jdbc/smartdm1"/>
<jee:jndi-lookup id="core2DataSource" jndi-name="jdbc/smartdm2"/>
<jee:jndi-lookup id="core3DataSource" jndi-name="jdbc/smartdm3"/>
-->
<bean id="platDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:PF"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean id="core1DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE1"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean id="core2DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE2"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean id="core3DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE3"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean id="smartDataSource" class="com.bitfone.smartdm.datasource.SmartDataSource">
<property name="targetDataSources">
<map key-type="java.lang.String">
<entry key="0" value-ref="platDataSource"/>
<entry key="1" value-ref="core1DataSource"/>
<entry key="2" value-ref="core2DataSource"/>
<entry key="3" value-ref="core3DataSource"/>
</map>
</property>
<property name="defaultTargetDataSource" ref="platDataSource"/>
<property name="locationFinder" ref="locationFinder"/>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="platDataSource" />
</bean>
<bean id="locationFinder" class="com.bitfone.smartdm.datasource.LocationFinderDBImpl">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="persistenceManagerFactory"
class="com.bitfone.smartdm.facade.util.KodoPersistenceManagerFactoryBean">
<property name="connectionFactory">
<ref bean="smartDataSource"/>
</property>
<property name="jdoProperties">
<props>
<prop key="kodo.LicenseKey">6F70-71A4-EC74-7645-6500</prop>
<prop key="javax.jdo.PersistenceManagerFactoryClass">kodo.jdbc.runtime.JDBCPersistenceManagerFactory</prop>
<prop key="javax.jdo.option.Optimistic">true</prop>
<prop key="javax.jdo.option.RetainValues">true</prop>
<prop key="javax.jdo.option.NontransactionalRead">true</prop>
<prop key="javax.jdo.option.NontransactionalWrite">true</prop>
<prop key="kodo.PersistenceManagerImpl">DetachFields=loaded, DetachOnClose=true</prop>
<prop key="kodo.jdbc.ForeignKeyConstraints">true</prop>
<prop key="kodo.jdbc.MappingFactory">metadata</prop>
<!--
<prop key="kodo.jdbc.SchemaFactory">dynamic</prop>
<prop key="kodo.Log">DefaultLevel=TRACE</prop>
-->
<!-- we have FKs pointing to entities with auto-increment PKs -->
<!-- this needs to be set on config for enhancer too! -->
<!--
<prop key="kodo.jdbc.AutoIncrementConstraints">true</prop>
-->
<!-- now make sure we don't have to do manual flushes to get queries to see
newly added or deleted objects -->
<!--
<prop key="javax.jdo.option.IgnoreCache">false</prop>
<prop key="kodo.FlushBeforeQueries">true</prop>
<prop key="kodo.ConnectionRetainMode">transaction</prop>
-->
</props>
</property>
</bean>
<bean id="abstractDAOTarget" abstract="true" class="com.bitfone.smartdm.dao.impl.BaseDAO">
<property name="persistenceManagerFactory" ref="persistenceManagerFactory"/>
</bean>
<bean id="baseDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.BaseDAO">
</bean>
<bean id="deviceModelDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.DeviceModelDAO">
</bean>
<bean id="manufactureDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.ManufactureDao"/>
<bean id="notificationDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.NotificationDAO">
<property name="deviceModelDAO" ref="deviceModelDAO"/>
<property name="manufactureDAO" ref="manufactureDAO"/>
</bean>
<bean id="operationDomainDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.OperationDomainDAO">
<!--property name="preInterceptors">
<list>
<ref bean="logAdvisor"/>
</list>
</property-->
</bean>
<bean id="bulkPolicyDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.BulkPolicyDAO">
<property name="deviceModelDAO" ref="deviceModelDAO"/>
<property name="manufactureDAO" ref="manufactureDAO"/>
</bean>
<bean id="bulkTaskDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.BulkTaskDAO">
</bean>
<bean id="updatePackageDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.UpdatePackageDAO">
</bean>
<bean id="fusionUserDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.FusionUserDAO">
</bean>
<bean id="deviceStaticInfoDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.DeviceStaticInfoDAO">
</bean>
<bean id="deviceCapabilityDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.DeviceCapabilityDAO">
</bean>
<bean id="downloadGroupDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.DownloadGroupDAO">
</bean>
<bean id="configCatalogDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.ConfigCatalogDAO">
</bean>
<bean id="configRuleDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.ConfigRuleDAO" >
</bean>
<bean id="taskStatisticsDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.TaskStatisticsDAO">
</bean>
<bean id="packageTransferStatusDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.PackageTransferStatusDAO">
</bean>
<bean id="functionCatalogDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.FunctionCatalogDAO"/>
<bean id="selfregisterHistoryDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.SelfregisterHistoryDAO"/>
<bean id="updatePackageStasticsDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.UpdatePackageStasticsDAO"/>
<bean id="groupDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.GroupDAO"/>
<bean id="groupMsisdnDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.GroupMsisdnDAO"/>
<bean id="dataExportDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.DataExportDAO"/>
<bean id="bulkScheduleTmpDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.BulkScheduleTmpDAO"/>
<bean id="upgradeStasticsDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.UpgradeStasticsDAO"/>
<bean id="provinceInfoDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.ProvinceInfoDAO"/>
<bean id="cityInfoDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.CityInfoDAO"/>
<bean id="areaCodeDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.AreaCodeDAO"/>
<bean id="blackListDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.BlackListDAO"/>
<bean id="testPortalDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.TestPortalDAO"/>
<bean id="rangeDAO" parent="abstractDAOTarget" class="com.bitfone.smartdm.dao.impl.QueryRangeDAO"/>
<bean id="nodeBaseDAO" class="com.bitfone.smartdm.dao.impl.NodeBaseDAO"/>
</beans>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
<bean class="com.bitfone.smartdm.facade.util.PersistentLogAdvice" id="logAdvice"/>
<bean class="org.springframework.aop.support.RegexpMethodPointcutAdvisor" id="logAdvisor">
<constructor-arg ref="logAdvice"/>
<property name="pattern" value=".*insert.*"/>
</bean>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<bean class="com.bitfone.smartdm.datasource.DBContextResetAdvise" id="transAdvise"/>
<aop:config>
<aop:aspect ref="transAdvise">
<aop:around method="invoke" pointcut="execution(* com.bitfone.smartdm.facade.service.impl.*.*(..))"/>
</aop:aspect>
</aop:config>
<!--
<jee:jndi-lookup id="platDataSource" jndi-name="jdbc/smartdm0"/>
<jee:jndi-lookup id="core1DataSource" jndi-name="jdbc/smartdm1"/>
<jee:jndi-lookup id="core2DataSource" jndi-name="jdbc/smartdm2"/>
<jee:jndi-lookup id="core3DataSource" jndi-name="jdbc/smartdm3"/>
-->
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="platDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@16.158.48.90:1521:PF"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="core1DataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE1"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="core2DataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE2"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="core3DataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@15.154.146.90:1521:CORE3"/>
<property name="username" value="odomain"/>
<property name="password" value="odomain"/>
</bean>
<bean class="com.bitfone.smartdm.datasource.SmartDataSource" id="smartDataSource">
<property name="targetDataSources">
<map key-type="java.lang.String">
<entry key="0" value-ref="platDataSource"/>
<entry key="1" value-ref="core1DataSource"/>
<entry key="2" value-ref="core2DataSource"/>
<entry key="3" value-ref="core3DataSource"/>
</map>
</property>
<property name="defaultTargetDataSource" ref="platDataSource"/>
<property name="locationFinder" ref="locationFinder"/>
</bean>
<bean class="org.springframework.jdbc.core.JdbcTemplate" id="jdbcTemplate">
<property name="dataSource" ref="platDataSource"/>
</bean>
<bean class="com.bitfone.smartdm.datasource.LocationFinderDBImpl" id="locationFinder">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<bean class="com.bitfone.smartdm.facade.util.KodoPersistenceManagerFactoryBean" id="persistenceManagerFactory">
<property name="connectionFactory">
<ref bean="smartDataSource"/>
</property>
<property name="jdoProperties">
<props>
<prop key="kodo.LicenseKey">6F70-71A4-EC74-7645-6500</prop>
<prop key="javax.jdo.PersistenceManagerFactoryClass">kodo.jdbc.runtime.JDBCPersistenceManagerFactory</prop>
<prop key="javax.jdo.option.Optimistic">true</prop>
<prop key="javax.jdo.option.RetainValues">true</prop>
<prop key="javax.jdo.option.NontransactionalRead">true</prop>
<prop key="javax.jdo.option.NontransactionalWrite">true</prop>
<prop key="kodo.PersistenceManagerImpl">DetachFields=loaded, DetachOnClose=true</prop>
<prop key="kodo.jdbc.ForeignKeyConstraints">true</prop>
<prop key="kodo.jdbc.MappingFactory">metadata</prop>
<!--
<prop key="kodo.jdbc.SchemaFactory">dynamic</prop>
<prop key="kodo.Log">DefaultLevel=TRACE</prop>
-->
<!-- we have FKs pointing to entities with auto-increment PKs -->
<!-- this needs to be set on config for enhancer too! -->
<!--
<prop key="kodo.jdbc.AutoIncrementConstraints">true</prop>
-->
<!-- now make sure we don't have to do manual flushes to get queries to see
newly added or deleted objects -->
<!--
<prop key="javax.jdo.option.IgnoreCache">false</prop>
<prop key="kodo.FlushBeforeQueries">true</prop>
<prop key="kodo.ConnectionRetainMode">transaction</prop>
-->
</props>
</property>
</bean>
<bean abstract="true" class="com.bitfone.smartdm.dao.impl.BaseDAO" id="abstractDAOTarget">
<property name="persistenceManagerFactory" ref="persistenceManagerFactory"/>
</bean>
<bean class="com.bitfone.smartdm.dao.impl.BaseDAO" id="baseDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.DeviceModelDAO" id="deviceModelDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.ManufactureDao" id="manufactureDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.NotificationDAO" id="notificationDAO" parent="abstractDAOTarget">
<property name="deviceModelDAO" ref="deviceModelDAO"/>
<property name="manufactureDAO" ref="manufactureDAO"/>
</bean>
<bean class="com.bitfone.smartdm.dao.impl.OperationDomainDAO" id="operationDomainDAO" parent="abstractDAOTarget">
<!--property name="preInterceptors">
<list>
<ref bean="logAdvisor"/>
</list>
</property-->
</bean>
<bean class="com.bitfone.smartdm.dao.impl.BulkPolicyDAO" id="bulkPolicyDAO" parent="abstractDAOTarget">
<property name="deviceModelDAO" ref="deviceModelDAO"/>
<property name="manufactureDAO" ref="manufactureDAO"/>
</bean>
<bean class="com.bitfone.smartdm.dao.impl.BulkTaskDAO" id="bulkTaskDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.UpdatePackageDAO" id="updatePackageDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.FusionUserDAO" id="fusionUserDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.DeviceStaticInfoDAO" id="deviceStaticInfoDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.DeviceCapabilityDAO" id="deviceCapabilityDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.DownloadGroupDAO" id="downloadGroupDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.ConfigCatalogDAO" id="configCatalogDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.ConfigRuleDAO" id="configRuleDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.TaskStatisticsDAO" id="taskStatisticsDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.PackageTransferStatusDAO" id="packageTransferStatusDAO" parent="abstractDAOTarget">
</bean>
<bean class="com.bitfone.smartdm.dao.impl.FunctionCatalogDAO" id="functionCatalogDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.SelfregisterHistoryDAO" id="selfregisterHistoryDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.UpdatePackageStasticsDAO" id="updatePackageStasticsDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.GroupDAO" id="groupDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.GroupMsisdnDAO" id="groupMsisdnDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.DataExportDAO" id="dataExportDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.BulkScheduleTmpDAO" id="bulkScheduleTmpDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.UpgradeStasticsDAO" id="upgradeStasticsDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.ProvinceInfoDAO" id="provinceInfoDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.CityInfoDAO" id="cityInfoDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.AreaCodeDAO" id="areaCodeDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.BlackListDAO" id="blackListDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.TestPortalDAO" id="testPortalDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.QueryRangeDAO" id="rangeDAO" parent="abstractDAOTarget"/>
<bean class="com.bitfone.smartdm.dao.impl.NodeBaseDAO" id="nodeBaseDAO"/>
</beans>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users