Inno Setup modify XML file based on custom input

2020-02-12 09:22发布

问题:

I'm not too familiar with pascal but I got a script going that currently detects whether java is installed, if not it installs it. Then it copies a Jboss folder to the directory that the user chooses.

I want to allow the user to enter some database IP/schema information then take those values and put it inside the correct namespaces in an XML file inside the Jboss directory. Found some threads saying that you can append to it but I think I might need to be able to parse the xml file.

回答1:

You can either use the MS XML DOM to find and edit the nodes (see the included CodeAutomation.iss for an example) or do a simple string replace with a dummy file and markers using LoadStringFromFile()/StringChange()/SaveStringToFile().