Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting values from an XML File
Message
From
20/10/2006 08:34:08
 
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01162072
Message ID:
01163612
Views:
13
Viv,

I've got one more question, which I hope you may be able to answer. One of the strings I need to change in the XML file is stored like this:
<configuration>
	<connectionStrings>
<add name="MistRep.My.MySettings.mist2006ConnectionString" connectionString="Data Source=(local);Initial Catalog=mist2006;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
Is there a way for me to change the "Data Source=(local);Initial Catalog=mist2006;Integrated Security=True" providerName="System.Data.SqlClient" to something else?

Thanks for all your help.


>>>>>Shouldn't that be:
>>>>>oxml.save("c:\program files\mist 2006\reports\mistrep.exe.config")
>>>>
>>>>Thanks! Good catch oh ye of the eagle eye!
>>>
>>>I get plenty of practice from looking at my own code! :-{
>>>Looks like it should work apart from that...
>>>Best,
>>>Viv
>>
>>Hi Viv,
>>
>>in this case I was mixing my code with code I got off the net. I tend to use "m.lo" and the code off the net used just plain "o".
>>
>>Do you see any way that I can try to get a particular node based on it's name, rather than using the hardcoded numbers I've used? I'm worried about the developer adding more stuff into the config file which might then break this code.
>
>Safer to use the element and attribute names. e.g:
>oMySettingsNode = oXML.documentElement.selectSingleNode("//MistRep.My.MySettings")
>MistReportFolderNode = oMySettingsNode.selectSingleNode("//*[@name='MistReportFolder']/value")
>MistReportFolderNode.Text = "Some newvalue"
>* or just:
>oMySettingsNode.selectSingleNode("//*[@name='MistReportFolder']/value").Text="Some new value"
>HTH,
>Viv
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform