Skip to content
⌘ NSIS Forum Archive

Query on ${nsisXML->SetElementAttr} “XPATH_INSTRUCTION” “Attribute” “Value”

5 posts

Raven83#

Query on ${nsisXML->SetElementAttr} “XPATH_INSTRUCTION” “Attribute” “Value”

This is the syntax for nsisXML plugin (Joel's) , any idea how i can include a variable($string) in "value". For ex:

${nsisXML->SetElementAttr} "XPATH_INSTRUCTION" "Attribute" "$string"

does not work for some reason, any other alternative for this? since i'm reading a value from another xml file into this variable and i'm trying to put that as an attribute value in another xml file, any input would be great, thanks..
Anders#
I never responded to your question on Stackoverflow because 1) I was busy and 2) There is a severe lack of information here. Do you get a compile error? Does it write $string as the value? Does it work if you use a plain string without a variable?
Raven83#
Originally Posted by Anders View Post
I never responded to your question on Stackoverflow because 1) I was busy and 2) There is a severe lack of information here. Do you get a compile error? Does it write $string as the value? Does it work if you use a plain string without a variable?
Hey Anders, no worries, i was just checking if someone else in this forum might have some answers..Sorry for not bringing in more details,
Q: Do you get a compile error?
No i dont, instead i get a runtime error, abnormal program termination

Q: Does it work if you use a plain string without a variable?
Yes, it works, just doesn't work if i use $string as the attribute value

Another question i had, if i can add to this is whether i can use the following Xpath to change values of all matching nodes with this value,

/config/app//Node[@key='KeyName']" "value" '$string'

This is supposed to select all nodes with key="KeyName" so will this change attribute value for all nodes matching key="KeyName" ? Provided the variable substition in the xml update works..thanks in advance..🙂
Anders#
If it crashes then it is most likely a bug in the plugin but the variable is expanded before that so I don't see how a variable would crash it but the exact same string would not.
Raven83#
Originally Posted by Anders View Post
If it crashes then it is most likely a bug in the plugin but the variable is expanded before that so I don't see how a variable would crash it but the exact same string would not.
Hey seems like it is..can't find the author...i switched back to the NSISXML plugin (Wizou's) and its working fine with solution you gave in stackoverflow, thanks a lot...🙂