Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xml file with similar nodes
#1
I would like to be able to change any of the links in the following xml file to some else. For example http://localhost:4861/Banking/BankingWebService.asmx to http://192.168.0.12:81/BankingWebService.asmx".

For some reason I cannot figure the out. I used the example function in the help doc to read all the nodes but cannot figure out how to write to it. I have used xml files before but not of this type.

Code:
Copy      Help
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <appSettings>
        <!-- Comination Which we need enter with earch webservice link-->
        <add key="1" value="http://localhost/OSI/ConvergysBankingOSIWebService.asmx" />
        <add key="2" value="http://localhost:4861/Banking/BankingWebService.asmx" />
        <add key="3" value="http://localhost/CBS/ConvergysBankingCBS.asmx" />
        <add key="4" value="http://localhost:30938/ConvergysVUITester.asmx" />
        <!--<add key="4" value ="http://localhost/DemoWebservice/ConvergysVUITester.asmx"/>-->
        <add key="OSIProxy" value="Convergys.Banking.Proxy.OSI.ProxyOSI" />
        <add key="ITIProxy" value="Convergys.Banking.Proxy.ITI.ProxyITI" />
        <add key="CBSProxy" value="Convergys.Banking.Proxy.CBS.ProxyCBS" />
        <add key="VUITesterProxy" value="Convergys.Banking.Proxy.Demo.VUITesterProxy" />
        <add key="OSI" value="1" />
        <add key="ITI" value="2" />
        <add key="CBS" value="3" />
        <add key="VUITester" value="4" />
        <add key="HostAttached" value="OSI,ITI,CBS,VUITester" />
        <add key="TraceWriting" value="true" />
    </appSettings>
</configuration>
#2
Macro Macro1991
Code:
Copy      Help
str s=
;<?xml version="1.0" encoding="UTF-8" ?>
;<configuration>
;;;;<appSettings>
;;;;;;;<!-- Comination Which we need enter with earch webservice link-->
;;;;;;;<add key="1" value="http://localhost/OSI/ConvergysBankingOSIWebService.asmx" />
;;;;;;;<add key="2" value="http://localhost:4861/Banking/BankingWebService.asmx" />
;;;;;;;<add key="3" value="http://localhost/CBS/ConvergysBankingCBS.asmx" />
;;;;;;;<add key="4" value="http://localhost:30938/ConvergysVUITester.asmx" />
;;;;;;;<!--<add key="4" value ="http://localhost/DemoWebservice/ConvergysVUITester.asmx"/>-->
;;;;;;;<add key="OSIProxy" value="Convergys.Banking.Proxy.OSI.ProxyOSI" />
;;;;;;;<add key="ITIProxy" value="Convergys.Banking.Proxy.ITI.ProxyITI" />
;;;;;;;<add key="CBSProxy" value="Convergys.Banking.Proxy.CBS.ProxyCBS" />
;;;;;;;<add key="VUITesterProxy" value="Convergys.Banking.Proxy.Demo.VUITesterProxy" />
;;;;;;;<add key="OSI" value="1" />
;;;;;;;<add key="ITI" value="2" />
;;;;;;;<add key="CBS" value="3" />
;;;;;;;<add key="VUITester" value="4" />
;;;;;;;<add key="HostAttached" value="OSI,ITI,CBS,VUITester" />
;;;;;;;<add key="TraceWriting" value="true" />
;;;;</appSettings>
;</configuration>

IXml x._create
x.FromString(s)
ARRAY(IXmlNode) a
x.Path("configuration/appSettings/add" a)
int i
for i 0 a.len
,IXmlNode attr=a[i].Attribute("value")
,str s2=attr.Value
,s2.ucase
,attr.Value=s2
x.ToString(s)
out s
#3
Thanks Gintaras. If anybody cares this is what I wound up doing.

Macro test
Code:
Copy      Help
str s=
;<?xml version="1.0" encoding="UTF-8" ?>
;<configuration>
;;;;<appSettings>
;;;;;;;<!-- Comination Which we need enter with earch webservice link-->
;;;;;;;<add key="1" value="http://localhost/OSI/ConvergysBankingOSIWebService.asmx" />
;;;;;;;<add key="2" value="http://localhost:4861/Banking/BankingWebService.asmx" />
;;;;;;;<add key="3" value="http://localhost/CBS/ConvergysBankingCBS.asmx" />
;;;;;;;<add key="4" value="http://localhost:30938/ConvergysVUITester.asmx" />
;;;;;;;<!--<add key="4" value ="http://localhost/DemoWebservice/ConvergysVUITester.asmx"/>-->
;;;;;;;<add key="OSIProxy" value="Convergys.Banking.Proxy.OSI.ProxyOSI" />
;;;;;;;<add key="ITIProxy" value="Convergys.Banking.Proxy.ITI.ProxyITI" />
;;;;;;;<add key="CBSProxy" value="Convergys.Banking.Proxy.CBS.ProxyCBS" />
;;;;;;;<add key="VUITesterProxy" value="Convergys.Banking.Proxy.Demo.VUITesterProxy" />
;;;;;;;<add key="OSI" value="1" />
;;;;;;;<add key="ITI" value="2" />
;;;;;;;<add key="CBS" value="3" />
;;;;;;;<add key="VUITester" value="4" />
;;;;;;;<add key="HostAttached" value="OSI,ITI,CBS,VUITester" />
;;;;;;;<add key="TraceWriting" value="true" />
;;;;</appSettings>
;</configuration>

IXml x._create
x.FromString(s)
ARRAY(IXmlNode) a
x.Path("configuration/appSettings/add" a)
int i
for i 0 a.len
,
,IXmlNode attr=a[i].Attribute("value")
,str s2=attr.Value
,sel s2
,,case "http://localhost:4861/Banking/BankingWebService.asmx"
,,attr.Value="http://192.168.0.4:81/Banking/BankingWebService.asmx"
x.ToString(s)
out s
#4
Ok one more. The following only find the first node. I see there is an allMatching parameter but could not get it to work. How would you be able to get all of the <app-value> values to be capitalized?


Macro xmltest2
Code:
Copy      Help
str s=
;<?xml version="1.0" encoding="UTF-8"?>
;<domains xmlns="http://www.intervoice.com/schema/property/3.0">
;;;<audit savedby="IC Translate Table" timestamp="Mon Dec 31 18:19:45 IST 2012" version="3.0.0.0"/>
;;;<domain allow-add="false" displayable="true" domain-type="TT" id="" preprocessor="application/ecmascript">
;;;;<description value="This IC Translate Table has to be used for configuraing various application level properties."/>
;;;'<display-name value="setup.tt"/>
;;;:<property key="transferSpanish">
;;;;;<app-value value="false"/>
;;;;;;<description value="Property that indicates whether a caller should be transferred immediately upon selecting Spanish at language selection."/>
;;;;</property>
;;;;<property key="playBroadcast">
;;;;;<app-value value="false"/>
;;;;;;<description value="property that indicates whether to play broadcast message or not at the starting."/>
;;;;</property>
;;;;<property key="broadcastMessages">
;;;;;<app-value value="'YV_000'"/>
;;;;;;<description value="Property that indicates which broadcast audio file will be played; 000 gets replaced with the bank code (Citi, HSBC, etc)"/>
;;;;</property>
;;;;<property key="broadcastMsgDirectory">
;;;;;<app-value value="'d:\\Intervoice\\Tomcat\\webapps\\WebAudio\\resources\\audio\\en-US\\default\\'"/>
;;;;;;<description value="Property to indicate what is the location of bradcast message file. This property will be used by jsp file in Your Voice feature."/>
;;;;</property>
;;;;<property key="startMainMenu">
;;;;;<app-value value="true"/>
;;;;;;;<description value="Property which indicates whether to play the Main Menu to caller or not. If it is set to true then Main Menu will be played otherwise it will be skipped and call will directly go for login."/>
;;;;</property>
;;;</domain>
;/<domains>
IXml x._create
x.FromString(s)
ARRAY(IXmlNode) a
x.Path("domains/domain/property/app-value" a)
int i
for i 0 a.len
,
,IXmlNode attr=a[i].Attribute("value")
,str s2=attr.Value
,s2.ucase
,attr.Value=s2
x.ToString(s)
out s
#5
Path does not work in this case. Use GetAll.
Macro Macro1993
Code:
Copy      Help
str s=
;<?xml version="1.0" encoding="UTF-8"?>
;<domains xmlns="http://www.intervoice.com/schema/property/3.0">
;;;<audit savedby="IC Translate Table" timestamp="Mon Dec 31 18:19:45 IST 2012" version="3.0.0.0"/>
;;;<domain allow-add="false" displayable="true" domain-type="TT" id="" preprocessor="application/ecmascript">
;;;;<description value="This IC Translate Table has to be used for configuraing various application level properties."/>
;;;'<display-name value="setup.tt"/>
;;;:<property key="transferSpanish">
;;;;;<app-value value="false"/>
;;;;;;<description value="Property that indicates whether a caller should be transferred immediately upon selecting Spanish at language selection."/>
;;;;</property>
;;;;<property key="playBroadcast">
;;;;;<app-value value="false"/>
;;;;;;<description value="property that indicates whether to play broadcast message or not at the starting."/>
;;;;</property>
;;;;<property key="broadcastMessages">
;;;;;<app-value value="'YV_000'"/>
;;;;;;<description value="Property that indicates which broadcast audio file will be played; 000 gets replaced with the bank code (Citi, HSBC, etc)"/>
;;;;</property>
;;;;<property key="broadcastMsgDirectory">
;;;;;<app-value value="'d:\\Intervoice\\Tomcat\\webapps\\WebAudio\\resources\\audio\\en-US\\default\\'"/>
;;;;;;<description value="Property to indicate what is the location of bradcast message file. This property will be used by jsp file in Your Voice feature."/>
;;;;</property>
;;;;<property key="startMainMenu">
;;;;;<app-value value="true"/>
;;;;;;;<description value="Property which indicates whether to play the Main Menu to caller or not. If it is set to true then Main Menu will be played otherwise it will be skipped and call will directly go for login."/>
;;;;</property>
;;;</domain>
;/<domains>
IXml x._create
x.FromString(s)
ARRAY(IXmlNode) a
x.RootElement.GetAll(0 a) ;;or x.Path("domains/domain").GetAll(0 a)
int i
for i 0 a.len
,sel a[i].Name
,,case "app-value"
,,IXmlNode attr=a[i].Attribute("value")
,,str s2=attr.Value
,,s2.ucase
,,attr.Value=s2
x.ToString(s)
out s
#6
Thanks


Forum Jump:


Users browsing this thread: 1 Guest(s)