williamfl
asked on
I am looking at creating a vb script to replace a value in multiple xml files quickly.
I am looking at creating a vb script to replace a value in multiple xml files quickly. It is a single xml file called dbid.xml and it is in each project folder. There are thousands of projects under different file folders under one main directory. Also would like to create a log of change to help validate change.
I have all the location in a variable file so just need code to run.
I need to replace the value in the parameters <PHYSICAL_DIRECTORY> </PHYSICAL_DIRECTORY>
Example
From
<PHYSICAL_DIRECTORY>\\serv er21\qc\Te st_Target_ Project1\< /PHYSICAL_ DIRECTORY>
To
<PHYSICAL_DIRECTORY>\\serv er311\qc11 \Test_Targ et_Project 1\</PHYSIC AL_DIRECTO RY>
Sample dbid.xml file
<?xml version="1.0" encoding="UTF-8"?>
<ProjectDescription>
<PROJECT_NAME>Test_Target_ Project1</ PROJECT_NA ME>
<DB_TYPE>2</DB_TYPE>
<DESCRIPTION>Created on 2013-08-02 09:36:37</DESCRIPTION>
<DB_CONNSTR_FORMAT>jdbc:me rcury:sqls erver://te stqlserver :1433</DB_ CONNSTR_FO RMAT>
<DB_NATIVE_AUTHENTICATION> Y</DB_NATI VE_AUTHENT ICATION>
<DB_NAME>project1_db</DB_N AME>
<DBSERVER_NAME>testdbserve r</DBSERVE R_NAME>
<DB_USER_PASS>qwertyuio</D B_USER_PAS S>
<PR_HAS_VCSDB>N</PR_HAS_VC SDB>
<PHYSICAL_DIRECTORY>\\serv er21\qc\Te st_Target_ Project1\< /PHYSICAL_ DIRECTORY>
<USERS_QUOTA>-1</USERS_QUO TA>
<PR_IS_ACTIVE>Y</PR_IS_ACT IVE>
<SAQ_IS_ACTIVE>N</SAQ_IS_A CTIVE>
<VM_REPOSITORY></VM_REPOSI TORY>
<PR_LANGUAGE>English</PR_L ANGUAGE>
<PROJECT_TYPE>Standard</PR OJECT_TYPE >
<IS_TEMPLATE>N</IS_TEMPLAT E>
<PROJECT_UID>lkjhgfdsa1123 4</PROJECT _UID>
<PR_SMART_REPOSITORY_ENABL ED>Y</PR_S MART_REPOS ITORY_ENAB LED>
<PR_IS_QPM_AUTO_CALC_ENABL ED>Y</PR_I S_QPM_AUTO _CALC_ENAB LED>
</ProjectDescription>
I have all the location in a variable file so just need code to run.
I need to replace the value in the parameters <PHYSICAL_DIRECTORY> </PHYSICAL_DIRECTORY>
Example
From
<PHYSICAL_DIRECTORY>\\serv
To
<PHYSICAL_DIRECTORY>\\serv
Sample dbid.xml file
<?xml version="1.0" encoding="UTF-8"?>
<ProjectDescription>
<PROJECT_NAME>Test_Target_
<DB_TYPE>2</DB_TYPE>
<DESCRIPTION>Created on 2013-08-02 09:36:37</DESCRIPTION>
<DB_CONNSTR_FORMAT>jdbc:me
<DB_NATIVE_AUTHENTICATION>
<DB_NAME>project1_db</DB_N
<DBSERVER_NAME>testdbserve
<DB_USER_PASS>qwertyuio</D
<PR_HAS_VCSDB>N</PR_HAS_VC
<PHYSICAL_DIRECTORY>\\serv
<USERS_QUOTA>-1</USERS_QUO
<PR_IS_ACTIVE>Y</PR_IS_ACT
<SAQ_IS_ACTIVE>N</SAQ_IS_A
<VM_REPOSITORY></VM_REPOSI
<PR_LANGUAGE>English</PR_L
<PROJECT_TYPE>Standard</PR
<IS_TEMPLATE>N</IS_TEMPLAT
<PROJECT_UID>lkjhgfdsa1123
<PR_SMART_REPOSITORY_ENABL
<PR_IS_QPM_AUTO_CALC_ENABL
</ProjectDescription>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Okay, glad that worked for you, let me know if you have any further questions.
~bp
~bp
ASKER