Archive: Writing to XML .settings file


Writing to XML .settings file
Hi, I have been using NSIS for a couple of years now and am very pleased with the installer, it is very powerful.

I have recently updated some middleware I use so that instead of using .ini files to store configuration settings I use an XML .settings file.

However, I am now faced with the double challenge of trying to get to grips with XML and the NSIS XML plugin.

My settings file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<shell>
<settings>
<setting id="timeout">30</setting>
<setting id="refresh">180</setting>
<setting id="page_background">splash_aa_v1.jpg</setting>
<setting id="hide_cursor">True</setting>
<setting id="disable_right_click">True</setting>
<setting id="only_allow_from_whitelist"></setting>
<setting id="always_deny_from_blacklist">list_black.xml</setting>
<setting id="page_denied_url">http://localhost/xxxx/denied.html</setting>
<setting id="logoff_password">xxxx</setting>
<setting id="keyboard_available_via_tab">True</setting>
<setting id="enable_control_popup">True</setting>
<setting id="update_url">http://192.168.0.55/config.asp?Where=XXX1&XXX2=3</setting>
<setting id="show_update_page">True</setting>
</settings>
<buttons>
<button>
<setting id="url">shell://logoff</setting>
<setting id="x">0</setting>
<setting id="y">0</setting>
<setting id="width">50</setting>
<setting id="height">50</setting>
<setting id="background">00000000</setting>
<setting id="background_down">00000000</setting>
</button>
<button>
<setting id="url">http://192.168.0.55/XXX.asp?XXX=XXX1</setting>
<setting id="x">0</setting>
<setting id="y">0</setting>
<setting id="width">1024</setting>
<setting id="height">768</setting>
<setting id="background">00000000</setting>
<setting id="background_down">00000000</setting>
<setting id="keyboard_always_on">False</setting>
<setting id="keyboard_available_via_tab">False</setting>
</button>
</buttons>
<flash_movies>

etc.... etc....

I want to edit the:

<settings>
<setting id="update_url">http:/XXX.XXX.XXXX.XXX/config.asp? Where=XXX1&XXX2=3</setting>
</settings>

node with the XXX bits (I can write the whole entry out in the installer as required)

and

<buttons>
<button>
<setting id="url">http://192.168.0.55/XXX.asp?XXX=XXX1</setting>
<setting id="x">0</setting>
<setting id="y">0</setting>
<setting id="width">1024</setting>
<setting id="height">768</setting>
<setting id="background">00000000</setting>
<setting id="background_down">00000000</setting>
<setting id="keyboard_always_on">False</setting>
<setting id="keyboard_available_via_tab">False</setting>
</button>
</buttons>

the setting id="url" nodes with values entered into the installer.

I can collect the values OK in my installer (already coded and working) and assign them to variables, but am struggling with where to start with the XML plugin.

I have read the posts on this subject and the help files and examples in the plugin, but am still struggling.

Can anyone show me what I need to write into the installer to write those entries?

Thanks in anticipation.


Most XML plug-ins come with example files that show basic editing scenarios. Did they not work?