{I+=codeWee;}
[NSIS] NSIS : How to modify XML file
; https://nsis.sourceforge.io/XML_plug-in 
; You should move ...\NSIS\Plugins\xml.dll file to ...\NSIS\Plugins\x86-ansi folder

!include "XML.nsh"

Unicode false

Section "Test"

...


	${xml::LoadFile} "$INSTDIR\myprogram.exe.config" $0
	${xml::GotoPath} "/configuration/userSettings" $0
	${xml::FirstChildElement} "" $0 $1
	${xml::FirstChildElement} "setting" $0 $1
	${xml::NodeHandle} $R0

	${While} $1 == 0
		${xml::GetAttribute} "name" $0 $1 
		${xml::FirstChildElement} "value" $2 $3
		${xml::GetText} $4 $5
		MessageBox MB_OK "$0=$\n$4"

		${if} $0 == "name1" 
			${xml::SetText} "value1" $6
		${elseif} $0 == "name2" 
			${xml::SetText} "value2" $6 

		${endif}

		${xml::GotoHandle} "$R0" $0
		${xml::NextSiblingElement} "setting" $0 $1
		${xml::NodeHandle} $R0
	${EndWhile}


	${xml::SaveFile} "$INSTDIR\myprogram.exe.config" $0

	${xml::Unload}

...

SectionEnd
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.