1

I have XML file named TIBCOUniversalInstaller_TRA_5.10.0.silent as below.I want to replace values in XML file using "replace" target in ant script using xmltask task. XML File is below:

<?xml  version="1.0"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>---Universal Installer Silent Installation Properties---</comment>

<!--accept the license agreement-->
<entry key="acceptLicense">true</entry>
<entry key="installationRoot">/opt/tibco</entry>
<entry key="environmentName">TRA</entry>
</properties>

At time of parsing XML file ,since my server can not reach java.sun.com , so i had downloaded properties.dtd on my local machine and using xmlcatalog task i am forcing ant script to read local copy of properties.dtd.Below is my ant script

 <xmlcatalog id="dtd">
      <dtd  publicId="SYSTEM" location="/home/tibco/BW-AUTOMATION- 
     PROJECT/Environments/properties.dtd"/>
 </xmlcatalog>
 <xmltask source="${TRASoftwareFolder}/TIBCOUniversalInstaller_TRA_5.10.0.silent" dest="${TRASoftwareFolder}/TIBCOUniversalInstaller_TRA_5.10.0.silent">
 <xmlcatalog refid="dtd">
 </xmlcatalog>
 <replace path="/:properties/:entry/:[@key='installationRoot']/text()" 
 withText="/home/tibco"/>
</xmltask>

But still at time of parsing XML contents , everytime it is going to http://java.sun.com/dtd/properties.dtd and i get "Connection Refused Error". When i did debug i see below which i believe can be issue and it is always going to website instead of local dtd file.

DEBUG LOGS:

"No matching catalog entry found, parser will use: 'http://java.sun.com/dtd/properties.dtd'"

I believe it is because i gave "SYSTEM" as value in "publicId" attribute inside dtd element. Can you please advise what should be correct value for "publicID" attribute for this given dtd so that it matches catalog at the time of parsing.

If there is another way of reading/replacing this XML file please advise.

Thanks

0 Answers0