Skip to content
⌘ NSIS Forum Archive

Reading tag info in an xml file.

7 posts

bnicer#

Reading tag info in an xml file.

I'm a little rusty. I probably need a new NSIS version too. My question is this:

<temp>C:\program files\SomeProgram\temp</temp>

How can I retrieve that path information from an xml file?

I want to use the path to install to. It would be fantastic if I only had to copy the code from somewhere, if it exists. The rest of the installation is standard fare, and it would save me a lot of time. Thanks.
JasonFriday13#
Links to xml plugins here:



bnicer#
Thank you. I had a brief look at one XML plugin. I don't think was designed for reading tag info, so my search continues. I will download the other plugins.

I was more or less hoping I would not need a plugin, because the file could be opened and read as text. I don't know if you can seek a text string based on the string being between two other strings. Can you do that?
bnicer#
My NSIS 2.05 User Manual refers to FileOpen, FileRead and FileSeek. FileRead reads a string, but to what effect, if you already know what the string is? "<temp>" At least it could position the file pointer at the end of the string and return the position in the file as an integer. Am I correct that it doesn't?
bnicer#
This is one of the reasons I would have preferred reading xml files as text. Of course, I had no idea this would be the case, so I'm a liar. I'm not blaming the plugins.

Suppose an xml file has a really tiny mistake, like if an opening tag and an end tag don't match up because one was misspelled ... when you try to read anything in that file, you will get a Visual C++ runtime error, and thus endeth the setup.

Can anyone think of a work-around? I want to continue the installation despite the error, or at least be able to terminate the installation with an error message informing the user that the particular xml file is corrupted.

The plugins are nsisXML by Joel and nsisXML by Olivier Marcoux.
bnicer#
I'm not just a liar, I'm an idiot. Instructor's XML plugin v1.7 does the trick. Should have tried that one first.🙂