Skip to content
⌘ NSIS Forum Archive

nsisXML: XML reader for Nsis

45 posts

Joel#
nsisXML (build 1.0.6)

More updates: includes function to remove attributes, a tidy function for xml files and a few debug functions that help you test your xpath syntaxes without saving the file 🙂

TODO:
1.- Tidy a inputed XML string (the last one) 😛

@Commander: if you want to modify nsisxml.nsh send me the updated one by PM, thanks 🙂
gbanfill#
Character Limit

Hi all,

I'm using ${nsisXML->SetElementText} to set a change a config file and set a connection string. However I get an "Runtime Error! abnormal program Termination" popup window and the instrcution is not executed.

The character string I am trying to set is greater than 64 characters long. If I try with a different (shorter) string, it works correctly.

Does anyone know anything about a character limit on the SetElementText method?

If it helps the simpleiset form of

Name "installer"

OutFile "C:\installer.exe"

!include "nsisXML.nsh"


Section "Installer"

${nsisXML->OpenXML} "C:\test.xml"

; If there are 63 x's the program will run, if there are 65 then an error will occur.

${nsisXML->SetElementText} "/a" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

${nsisXML->Release} "C:\test.xml"

SectionEnd

Thanks in advance for any help you can give.
George
gbanfill#
HI Joel,

Here is a cut down version of what I am trying to do. Ziped up so there arent so many files to worry about.

Include & plugins contain the dll of nsisXML that I have been using. This is more for your reference than anything else.

Example.xml is the xml file I am trying to use. I am using this as the example as this file can't change in stucture or namespace (which has added other problems!).

Installer.exe is the installer as build on my machine.

Any more information you want let me know.

Cheers 🙂

George
Joel#
I'll look it..this weekend, maybe the begin of the next one, I'll post an updated version dll one.
AaronLS#
Multiple elemnts for SetElementText

I have a single Processed element, containing multiple Form elements, each with a single Path element.

I want to set all of the Path elements(across all the form elements) to the same value:
${nsisXML->SetElementText} "/Processed[0]/Form/Path[0]" "dsfgsdgsd"

However, this is only setting the Path element under the first form. Is there a way to iterate? Maybe using an iterator in the string? If that, then how would I know that I've gone past the last Form element? Would an error code be set that I can check each iteration of my loop, or can I use one of the other functions to test for the existance of the element before I try to set it?
ripper17#
I know this thread has been dead quite some time, however I found the plug-in very useful - except for one thing: I was trying to set an ElementText with more than 64 characters, which failed.
So I downloaded the sources (thanks Joel for providing them) and did the quick change to now support 1024 characters. I've also created a simple project for Visual Studio 2008 to build this plug-in.

NOTE: I have not tested this code AT ALL! It does what I need and I haven't really changed much else. So most likely, no issues have been added by my change, but I don't know if this plug-in had any issues before that. Use at your own risk.

NOTE2: I don't know if I am allowed to upload msxml5.dll (the version I used to compile) - so I did not. If you need to compile the nsisXML.dll for yourself, you will have to find it or any other version > 2 and put it in the same folder as "main.cpp" and adapt the line "#import "msxml5.dll" " to the correct version number.

The ZIP file contains the sources, the project and the newly build nsisXML.dll (copy to your NSIS\plugins dir) and the (unchanged) nsisxml.nsh (copy to your NSIS\include dir)

Best

Martin

Please note that the attached plug-in depends on VS 2008 runtimes, msvcr90.dll may not be present on the customer comp (or you should handle the situation and install VS runtimes). Original plug-in from Joel created in VS 6 and depends on mcvcrt.dll, but this is acceptable. - Takhir
Takhir#
ripper17 (and release users - 20 downloads) - please note that plug-in depends on VS 2008 runtimes, msvcr90.dll may not present on the customer comp (or you should handle the situation and install VS runtimes). Original plug-in from Joel created in VS 6 and depends on mcvcrt.dll, but this is acceptable.
Wizou#
if I may suggest...

You can use this "other" nsisXML plug-in
which is compiled under VC6 for ANSI & Unicode NSIS and shouldn't have problem with long ElementText

It does however requires MSXML which is installed on every windows since Win98/IE4
Angel89#
Hello
I have an XML FIle wish contain a directory.Now I want to Use Nsis.But i don't know how can i pars the value of the attribute wish contain the directory from the XML File.
Also nsis should check if this directory exist.if not should Print a message, Like : "Le Dossier n'existe pas " ,Else,It terminate the execution of the rest of program
This is my XML FIle:
< v1>
<v2>
<v3 chemin= "c:\Dossier" taille=100>
<\v3>
<\v2>
<\v1>

in nsis,i want to get the value of Chemin.
Please,Can you write me what should i write in the nsi??
MSG#
You already asked this question in your own thread. Please do not ask the same question twice. http://forums.winamp.com/showthread.php?t=332038
Kyle_1988#
I notice this plugin formats an XML file by converting spaces to tabs. Is there any way to have it leave the whitespace alone?