Old 7th January 2010, 09:13   #81
ChocJunkie
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 120
I have a problem in understanding the xml::unload function. What exactly does it do?
Does it unload the plugin or the loaded xml file?
If it unloads the plugin, how can I unload the loaded file?

Thanks.

CJ
ChocJunkie is offline   Reply With Quote
Old 7th January 2010, 14:27   #82
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
From the XML plugin documentation
Quote:
${xml::Unload}
Unload plugin
pengyou is offline   Reply With Quote
Old 7th January 2010, 15:08   #83
ChocJunkie
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 120
Quote:
If it unloads the plugin, how can I unload the loaded file?
ChocJunkie is offline   Reply With Quote
Old 7th January 2010, 15:20   #84
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
Why do you want to "unload" the file?

If you have used the XML plugin to modify the file then use the plugin's "SaveFile" command.
pengyou is offline   Reply With Quote
Old 8th January 2010, 07:05   #85
ChocJunkie
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 120
I just want to read the file, I don't need it to be in memory any more, if I've got what I was looking for. So I would like to erase/unload the file from the memory.
ChocJunkie is offline   Reply With Quote
Old 25th January 2010, 13:23   #86
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
Hi all,

i am trying to use the plugin with the Unicode Version of NSIS but it won't even open the file correctly.

Am i just stupid or does it not work correctly with Unicode NSIS? (2.45)

I use the following script to test....

code:

Name TestSetupSmall

OutFile TestSetupSmall.exe
;Request application privileges for Windows Vista
RequestExecutionLevel highest

!include "XML.nsh"

ShowInstDetails Show

Page Instfiles

Function .onInit
InitPluginsDir
FunctionEnd


Section TEST

SetOutPath $TEMP
File test.xml

${xml::LoadFile} "$TEMP\test.xml" $0

DetailPrint "-$0-"


SectionEnd



The provided example does not work either.

Any help would be much appreciated.

Thanks.
xbarns is offline   Reply With Quote
Old 16th February 2010, 23:25   #87
garygumdrops
Junior Member
 
Join Date: May 2008
Location: Auckland, New Zealand
Posts: 6
Problem if element has missing text when save

I think there is a bug with elements with blank text when the XML doc is saved:

<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<Setting1>hello</Setting1>
<Setting2></Setting2>
</Settings>

if you save this using ${xml::save}
you'll see that the last element is not what it should be and appear as:
<Setting2 />
when it should be:
<Setting2></Setting2>

Everything is good if the element has any text inside it.
garygumdrops is offline   Reply With Quote
Old 16th February 2010, 23:48   #88
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
To an XML parser, the elements <sample/> and <sample></sample> are the same—they're both empty sample elements.

See Extensible Markup Language (XML) 1.0 (Fifth Edition):
http://www.w3.org/TR/REC-xml/#dt-empty
pengyou is offline   Reply With Quote
Old 16th February 2010, 23:52   #89
garygumdrops
Junior Member
 
Join Date: May 2008
Location: Auckland, New Zealand
Posts: 6
Oh yes I see now, thanks for pointing that out :-)
garygumdrops is offline   Reply With Quote
Old 14th July 2010, 07:57   #90
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
FYI:

xml::_Coordinate isn't pushing an error/success value
So the macro, ${xml::Coordinate}, pops one to many !

BTW: great plug-in, anything else seems to work fine, and MSXML.dll independent :-)
gringoloco023 is offline   Reply With Quote
Old 19th August 2010, 13:24   #91
guineapig
Junior Member
 
Join Date: May 2010
Posts: 13
Hi all,
I'm trying to use the xml plugin with nsis unicode v2.46 but it does not work.
The plugin does not load the xml file and return error code is an unknown char (the classic square char). Before spending too much time on it, I would like to know if there are some known compatibility issue.

thank you very much
guineapig is offline   Reply With Quote
Old 19th August 2010, 16:35   #92
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
try the NsisXML plug-in by Wizou, although it works great and also works with utf-16 xml files, it is msxml.dll depended !

Another possibility which I personally am very happy with is calling the Xml plug-in from instructor with a special header file for unicode nsis. but utf-16 files are not supported (alternatively they could be re-encoded to utf-8 and back again)
Attached Files
File Type: nsh CallANSIPlugin.nsh (875 Bytes, 324 views)
File Type: nsh XML.nsh (10.5 KB, 376 views)
gringoloco023 is offline   Reply With Quote
Old 23rd August 2010, 14:59   #93
guineapig
Junior Member
 
Join Date: May 2010
Posts: 13
it works...
thank you very much...
guineapig is offline   Reply With Quote
Old 11th February 2011, 20:50   #94
ssamuels_sv
Junior Member
 
Join Date: Jan 2011
Posts: 7
Remote XML File

I'm curious if anyone knows how to link this plug-in with a file that is hosted on a server. I know that the plug-in can read a file locally, but it would be helpful in my application to read the file remotely rather than have to distribute the file along with the installer. I want to use a generic installer and have it go grab the information that it needs.

Or does anyone know of another plug-in that will simply grab a remote file so that this plug-in can parse the XML tree?

Thanks in advance.
ssamuels_sv is offline   Reply With Quote
Old 11th February 2011, 21:24   #95
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
NSISdl or InetC

Stu
Afrow UK is offline   Reply With Quote
Old 11th February 2011, 22:09   #96
ssamuels_sv
Junior Member
 
Join Date: Jan 2011
Posts: 7
Thank you. I just figured that out and was going to say, never mind. Thanks for the quick reply. I tried inetc, but I'll take a look at NSISdl as well.
ssamuels_sv is offline   Reply With Quote
Old 11th May 2011, 17:49   #97
loyalp
Junior Member
 
Join Date: Jan 2011
Posts: 2
comments

I've just started using this plugin, and so far have it doing everything I need for inserting some new lines in a web.config file. I do not see to be able to figure out how to get a new comment inserted, however.

xml file is setup like:

<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="LogLevel" value="4" />
</appSettings>
</configuration>

I'm adding several new <add key= statements, but would also like to insert a comment at the same level.

Final product would be:

<?xml version="1.0" ?>
<configuration>
<appSettings>
<!--Some Comment-->
<add key="LogLevel" value="4" />
<add key="something" value="" />
<add key="something" value="" />
<add key="something" value="" />
<add key="something" value="" />
</appSettings>
</configuration>

I've tried:

code:

${xml::LoadFile} "$INSTDIR\Web.config" $0
${xml::RootElement} $0 $1
${xml::XPathNode} "/configuration/appSettings" $0
${xml::CreateNode} "<'!-- Some Comment--'/>" $4
${xml::InsertEndChild} $4 $5




and also ${xml::CreateNode} "<'!-- Some Comment--'/>" $4.

What am I missing here?
loyalp is offline   Reply With Quote
Old 5th December 2011, 08:25   #98
fefer
Junior Member
 
Join Date: Dec 2011
Posts: 6
I create Installer that load xml file and read the node value

I stop the installer running, I change the xml file node value and I run the Installer again

at the second time the installer shows me that the value didn't change, and when I run oit again it's show me the value changed

Way the istaller show me the prev value?
fefer is offline   Reply With Quote
Old 5th December 2011, 09:40   #99
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 519
Send a message via ICQ to T.Slappy
The XML file is packed inside installer or not?
Maybe other process/application is working with this file too?

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 13th August 2012, 02:52   #100
gretty
Junior Member
 
Join Date: May 2012
Posts: 20
I am attempting to add a large XML element to an existing XML file but it keeps failing to add the new node. What do you think is going wrong?

I've tried making the XML element smaller(reducing OVERRIDES_TEXT) and that allows me to successfully add the new element/node to the XML file. But I need all the text(xml) in OVERRIDES_TEXT to be added to the element(I cant remove any of it).

Any ideas on how I could achieve this?

code:

${xml::LoadFile} "${xmlFileName}" $R0
${xml::GotoPath} "${elementPath}" $R0
${xml::CreateNode} '<Overrides>${OVERRIDES_TEXT}</Overrides>' $R0
${xml::InsertAfterNode} $R0 $R1 # always fails here $R1 = -1

# below is the string that causes the error
!define OVERRIDES_TEXT "<Override>\
<Key>EXDS_CUSTOMISATION_REVISION</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>CUSTOMER_USER_4D</Key>\
<Value>C:\12d\10.00\Customers\EXDS_Customisation\EXDS_User</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>CUSTOMER_LIB_4D</Key>\
<Value>C:\12d\10.00\Customers\EXDS_Customisation\EXDS_User_Lib</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>USER_4D</Key>\
<Value>C:\12d\10.00\User</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>USER_LIB_4D</Key>\
<Value>C:\12d\10.00\User_Lib</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>EXDS_USER_LIB</Key>\
<Value></Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>EXDS_USER</Key>\
<Value></Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>VERSION_12D_MODEL</Key>\
<Value>10.0</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>CPATH</Key>\
<Value>$$CUSTOMER_LIB_4D:$$CUSTOMER_USER_4D:$$USER_LIB_4D:$$USER_4D:$$LIB_4D:$$SET_UPS_4D</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>AUTHORIZATION_4D</Key>\
<Value>C:\12d\10.00\nodes.4d</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>USE_NAMES_COMMENT_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>FILE_READ_ADD_TO_VIEW_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>GENIO_WILDCARD_4D</Key>\
<Value>*.inp</Value>\
<State>1</State>\
</Override>\
<Override>\
<Key>RUN_MACROS_FILE_4D</Key>\
<Value>$$USER\macros.4d</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>PROJECT_DETAILS_4D</Key>\
<Value>$$USER\project_details.dtl</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>REPORT_HEADER_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>AUTO_TIN_SYNC_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>AUTO_MODEL_SYNC_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>SHARE_CHECK_INTERVAL_4D</Key>\
<Value>300</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>SHARED_ELEMENT_COLOUR_4D</Key>\
<Value>blue</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>SHARING_ELEMENT_COLOUR_4D</Key>\
<Value>red</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>DEFAULT_PLAN_PLOT_SCALE_4D</Key>\
<Value>500</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>DWG_PLOT_SEED_FILE_4D</Key>\
<Value>$$USER\EXDS_Acad_Plot_Template.dwt</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>DEFAULT_RASTER_DPI_4D</Key>\
<Value>600</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>OPENGL_VIEW_BACKING_STORE_4D</Key>\
<Value>2</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>MULTI_LINE_TEXT_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>NEW_MTF_EDITOR_AUTOPAN_DEFAULT_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>WINDOWS_VEHICLE_PATH_4D</Key>\
<Value>C:\Apps\VPath</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>chainage_equality_4d</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>XML_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>\
<Override>\
<Key>USE_V10_BOXING_CALCS_4D</Key>\
<Value>1</Value>\
<State>0</State>\
</Override>"

gretty is offline   Reply With Quote
Old 13th August 2012, 05:31   #101
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Please don't paste such huge amounts of text in a post - use either an attachment or pastebin.

Your problem is probably that the string you're trying to write is much bigger than ${NSIS_MAX_STRLEN}. The default NSIS builds have a max length of 1024 bytes. There is also a large string build of NSIS which supports op to 8192 bytes. But I don't think you're using the xml plugin properly. I've never used it myself, but what you're doing is telling it to write a single, huge textline "<Override><Key>EXDS_CUSTOMISATION_REVISION</Key><Value>1</Value><State>0</State></Override><Override><Key>CUSTOMER_USER_4D</Key><Value>C:\12d\10.00\Customers\EXDS_Customisation\EXDS_User</Value>" etcetc. You could use FileWrite for that, so I doubt that's how the XML plugin is supposed to be used.
MSG is offline   Reply With Quote
Old 17th August 2012, 17:09   #102
dacode
Junior Member
 
Join Date: Aug 2012
Posts: 2
@Instructor -

I would like to use this XML plugin as well as the Registry plugin by instructor, however, I do not see any license.

Are all NSIS plugins licensed under the NSIS license?
dacode is offline   Reply With Quote
Old 6th January 2013, 05:29   #103
PoRtAbLe_StEaLtH
Junior Member
 
Join Date: Jul 2011
Posts: 49
Great Help

Quote:
Originally Posted by xbarns View Post
Hi all,

i need to edit a xml structure like this

PHP Code:
<Configuration
<ConfigModule name="BlaBla">
 </
ConfigModule>
 <
ConfigModule name="FirebirdBridge" DefaultConfig="FALSE">
    <
Section name="FirebirdBridge" description="Configuration for Firebird DB Bridge">
      <
Data name="Host" type="string">127.0.0.1</Data>
      <
Data name="Database" type="string">C:\Program Files\Test\Database\Test.FDB</Data>
      <
Data name="User" type="string">User</Data>
      <
Data name="Password" type="string">Password</Data>
    </
Section>
  </
ConfigModule>
</
Configuration
In order to change the "<Data name="Database" type="string">C:\Program Files\Test\Database\Test.FDB</Data>" is there any other way then looping through the nodes and comparing attributes ?

i am already looping through the "ConfigModule" Nodes and comparing, is there an easier way?

Here is the code i have so far:

PHP Code:
${xml::LoadFile"$EXEDIR\scMaster.ctf" $0
loop
:
${
xml::FindNextElement"ConfigModule" $$1
${xml::ElementPath} $0
${xml::GetAttribute"name" $$

${IF} $== "FirebirdBridge"
        
    
${xml::GotoPath"$0/Section/Data" $1

    Loop here again 
?
         
         
${ELSE}
        Goto 
loop        
${ENDIF}

${
xml::FindCloseElement}
${
xml::SaveFile"$EXEDIR\scMaster2.ctf" $0
${xml::Unload

Thanks for helping



thanks.. this helped me tremendously..
PHP Code:
<Configuration
<ConfigModule name="BlaBla">
 </
ConfigModule>
 <
ConfigModule name="FirebirdBridge" DefaultConfig="FALSE">
    <
Section name="FirebirdBridge" description="Configuration for Firebird DB Bridge">
      <
Data name="Host" type="string">127.0.0.1</Data>
      <
Data name="Database" type="string">C:\Program Files\Test\Database\Test.FDB</Data>
      <
Data name="User" type="string">User</Data>
      <
Data name="Password" type="string">Password</Data>
    </
Section>
  </
ConfigModule>
</
Configuration
Correct XPath:
code:
/Configuration/ConfigModule/Section/Data[@name="Host"]


I was using: (Wrong)
code:
/Configuration/ConfigModule[@name="FirebirdBridge"]/Section[@name="FirebirdBridge"]/Data[@name="Host"]
PoRtAbLe_StEaLtH is offline   Reply With Quote
Old 8th July 2013, 11:01   #104
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
Accidental Replace of " (double quote)

Hi All,

i use the plugin to replace certain values in an unattend.xml (used for Windows NT6 deployment, e.g. License Key, Company name aso.).

But when i do this it will change a line

<CommandLine>%systemdrive%\ASetup\LockScr.exe "%systemdrive%\ASetup\asetup.bmp"</CommandLine>

to

<CommandLine>%systemdrive%\ASetup\LockScr.exe &quot;%systemdrive%\ASetup\asetup.bmp&quot;</CommandLine>

is there any way to preven the change from " to &quot; ?

It seems to happen as a "by product" since i do not edit anything near the occurence of the <CommandLine> tags.

Thanks a lot, any help is appreciated....
x
xbarns is offline   Reply With Quote
Old 19th February 2014, 09:03   #105
awall
Junior Member
 
Join Date: Feb 2014
Posts: 2
Question Element data longer than 1024 bytes get truncated

Quote:
Originally Posted by MSG View Post
Your problem is probably that the string you're trying to write is much bigger than ${NSIS_MAX_STRLEN}. The default NSIS builds have a max length of 1024 bytes. There is also a large string build of NSIS which supports op to 8192 bytes.
Hello, I have found this thread trying to fix an issue with XML plugin. I am dealing with XML containing big elements with about 2KB of base64 encoded data each.
When I read these data I only get the first 1023 bytes so I'm assuming this is due to the 1024 bytes string length limit in NSIS.
However I have updated the NSIS build with support for 8K long strings but data is still truncated to 1K.
My suspect is that the XML plugin should be updated as well to deal with 8K strings. Can anyone confirm?
And in case, do you have an idea on how to modify the XML plugin to support long strings?

Thanks
Andrea
awall is offline   Reply With Quote
Old 5th May 2014, 06:28   #106
dies
Junior Member
 
Join Date: May 2014
Posts: 1
Quote:
Originally Posted by awall View Post
Hello, I have found this thread trying to fix an issue with XML plugin. I am dealing with XML containing big elements with about 2KB of base64 encoded data each.
When I read these data I only get the first 1023 bytes so I'm assuming this is due to the 1024 bytes string length limit in NSIS.
However I have updated the NSIS build with support for 8K long strings but data is still truncated to 1K.
My suspect is that the XML plugin should be updated as well to deal with 8K strings. Can anyone confirm?
And in case, do you have an idea on how to modify the XML plugin to support long strings?

Thanks
Andrea
awall, length of output string just defined in the library

/* Defines */
#define NSIS_MAX_STRLEN 1024

To change max output length, you just need to change this value and rebuild.

By the way,
I'm succesfully builded x64 (also upgraded TinyXML to 2.6.2), if someone need it just pm me and I will send it.
P.S.
Just don't want to publish it because I'm not an author
dies is offline   Reply With Quote
Old 12th February 2015, 07:59   #107
currarpickt
Junior Member
 
Join Date: Feb 2015
Posts: 1
Remove several nodes

Hi, I am using this plugin to read an xml file but I have a problem with RemoveNode.
I need to compare an xml file with a text file and if I found a string that doesn't belong in the text file, I will delete it from xml file. But, after I remove one node, the looping always stop because it cannot find the NextSibling. Any idea how to continue the loop?

code:
${xml::LoadFile} "$TEMP\$XMLFile" $0
${xml::GotoPath} "/unattend/servicing/package" $0
${xml::FirstChild} "assemblyIdentity" $1 $0
${xml::NextSibling} "selection" $7 $0
${While} $0 == 0
${xml::GetAttribute} "name" $3 $4
Push $TEMP\featurelist.txt
Push $3
Call FileSearch
Pop $0 #Number of times found throughout
Pop $1 #Number of lines found on

${IF} $0 == 0
${xml::RemoveNode} $7
${ENDIF}

${xml::NextSibling} "selection" $7 $0
${EndWhile}
${xml::SaveFile} "$TEMP\$XMLFile" $0
${xml::NodeHandle} $0
${xml::Unload}

currarpickt is offline   Reply With Quote
Old 12th May 2015, 20:50   #108
traal
Junior Member
 
Join Date: May 2015
Posts: 1
Don't remove "xml-stylesheet" declaration

Before calling ${xml::SaveFile} on an existing .xml file:

code:
<?xml-stylesheet type="text/xsl" href="MyStylesheet.xslt"?>


After calling ${xml::SaveFile}:

code:
<?xml ?>


Please fix this.

Also, the plugin doesn't preserve whitespace: it removes blank lines, puts all attributes on the same line as the element, and I think it also modifies indenting.
traal is offline   Reply With Quote
Old 12th June 2016, 11:08   #109
Хамик
Junior Member
 
Join Date: Jan 2016
Posts: 4
Tell me, please, how do I change the parameter <Temp Folder ScreenShots>? Requires overwrite value. Thank you!

xml file example:

PHP Code:
<ScreenSettings xmlns:xsi="http://www.w.org/200/XMLSchem-instance" xmlns:xsd="http://www.w.org/200/XMLSchem">
    <
Version>1</Version>
    <
AutoStart>false</AutoStart>
    <
CheckForUpdate>false</CheckForUpdate>
    <
Fum>false</Fum>
    <
Language>Russian</Language>
    <
CurrentRectSettingsIndex>-1</CurrentRectSettingsIndex>
    <
TempFolderScreenShots>C:\Users\HAM\Pictures\Screen</TempFolderScreenShots>
</
ScreenSettings
Хамик is offline   Reply With Quote
Old 12th June 2016, 20:53   #110
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Quote:
Originally Posted by Хамик View Post
Tell me, please, how do I change the parameter <Temp Folder ScreenShots>? Requires overwrite value. Thank you!
It would help if you posted the code you already have tried and maybe we can fill in the missing pieces...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th January 2018, 15:39   #111
Kyle_1988
Junior Member
 
Join Date: Jan 2018
Posts: 12
Can someone explain what ${plugin::command} means? Why the dollar sign and curly braces?
Kyle_1988 is offline   Reply With Quote
Old 17th January 2018, 18:53   #112
Kyle_1988
Junior Member
 
Join Date: Jan 2018
Posts: 12
Okay, I figured out that it's just !define.

Next question. Does GotoPath use Xpath? If not, is there any way to locate a node based on an attribute value using this plugin?
Kyle_1988 is offline   Reply With Quote
Old 17th January 2018, 20:05   #113
Kyle_1988
Junior Member
 
Join Date: Jan 2018
Posts: 12
Okay, I've examined the C++ source code and determined that the path parsing is fairly basic and does not use XPath. Can anyone recommend a plugin that allows me to navigate to a node based on an attribute value?
Kyle_1988 is offline   Reply With Quote
Old 18th January 2018, 05:42   #114
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Both http://nsis.sourceforge.net/NsisXML_plug-in_(by_Wizou) and http://nsis.sourceforge.net/NsisXML_plug-in_(by_Joel) supports XPath.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th January 2018, 13:45   #115
Kyle_1988
Junior Member
 
Join Date: Jan 2018
Posts: 12
Thanks Anders!
Kyle_1988 is offline   Reply With Quote
Old 21st January 2018, 20:50   #116
devouk
Junior Member
 
Join Date: Jan 2018
Posts: 1
Hi, Wondering if someone can shed some light.... I am a noobie with nsis but currently need to install and alter an xml file to included local users store location

I have tried to learn and use the 3 various main xml plugins and they have driven me to disspare lol.

I had an understanding of xml but learning XPATH and also the syntax of the plugins / NSIS

I have tried so many combination and using detailprint to show results hence my thousands of perminatations failing.

So wondering if someone can point me in the right direction..

So here is a shorten xml file
code:

<?xml version="1.0" encoding="UTF-8"?>
<ConfigFile>
<configuration name="default">
<section name="Settings">
<value name="FirstStart">0</value>
<value name="Language">internal</value>
<value name="Encoder">3</value>
<value name="EncoderOutDir"></value>
<value name="EncoderFilenamePattern">&lt;album&gt;\&lt;track&gt; - &lt;artist&gt; - &lt;title&gt;</value>
<value name="EncodeOnTheFly">1</value>

</section>
</configuration>
</ConfigFile>




So as you can see they aren't individual patterns but a repeated pattern
I am wanting to pass the local users "my music" folder to the xml under ENCODEROUTDIR as far as I understand from xpath I should be able to use this as explicit / absolute

code:
/configfile/configuration[@name="default"]/section[@name="settings"]/value[@name="EncodeOnTheFly"]

so my first issue

code:
${xml::GotoPath} "/configfile/configuration[@name="default"]/section[@name="settings"]/value[@name="EncodeOnTheFly"]" $0


Now this brings a parameter error due to the xml plugin due to the additional " marks in the command, what would be the correct way to call this ? <synatax issue>

I presume I could also use this abbreviated way as

code:
${xml::GotoPath} "/value[@name="EncodeOnTheFly"]" $0


Anyway at any point I have drilled down and used [@data] it screws up.

Then if I want to pass a constant $MyMusic and any pointers on the best way of doing this correctly then that will help me.

Which is the better xml plugin to use and kind to learn ?

Any advice would be really appreciated as I losing faith in my own abilities.

Thank you

devo
devouk is offline   Reply With Quote
Old 22nd January 2018, 16:46   #117
Kyle_1988
Junior Member
 
Join Date: Jan 2018
Posts: 12
No need to write a long question. We had just established on this thread that this plugin doesn't support XPath. I ended up using Joel's plugin. Scroll up for details.
Kyle_1988 is offline   Reply With Quote
Old 22nd January 2018, 17:19   #118
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
There are many ways to solve quote issues. 'foo "bar" baz' or "foo $\"bar$\" baz" etc.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump