Talk:NsisXML plug-in (by Wizou): Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(→‎hiya: new section)
 
(6 intermediate revisions by 3 users not shown)
Line 7: Line 7:
The DOCTYPE tag is not supported !
The DOCTYPE tag is not supported !


:This issue about DOCTYPE support with MSXML is being discussed several times on the web. Google for it. Here is [http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/f791796c-c36e-4381-965d-4325aff57b48|one solution]
:This issue about DOCTYPE support with MSXML is being discussed several times on the web. Google for it. Here is [http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/f791796c-c36e-4381-965d-4325aff57b48# one solution] (doc.validateOnParse = doc.resolveExternals = false; + doc.setProperty('ProhibitDTD', false); + doc.loadXML('<!DOCTYPE root><root/>');)
 


== getText with a dxDiag file ==
== getText with a dxDiag file ==
Line 92: Line 91:
  </components>
  </components>


== hiya ==


Your guy Obama may legalize MJ while using the stroke of any pen. Slick acquired 8 ages and your dog never touched the situation. The Dems controlled your home and a Senate intended for 4 many years, why failed to Pelosi along with Reid touch the difficulty? Why has not one Democrat leader proposed finishing the War on Drug treatments? A War that is certainly waged disproportionately in opposition to young community men. I'm the Roman Catholic Republican coming from Westport. What's the point? After reading this I directed myself an email reminder simply because I rarely open my personal agenda to check out my published reminders after i get property from education. Starting next week, I will probably be paperless eliminate! 
nsisXML::select behaves unexpectedly but this allows you to enumerate by calling nsisXML::select "/components" in a loop ([[User:Anders|Anders]] ([[User talk:Anders|talk]]) 23:25, 20 October 2017 (UTC))
http://wallet-world.net/ http://nono-hair-removal.info/ http://moonhoax.us/ http://hcg-diet-drops.net/ http://hairremovalproductreviews.com/ http://nono-hair-removal.org/ http://worldairconditioners.com/ http://trackbookmark.com/ http://kathleenmcgookey.com/ http://car-donation-center.org/ http://irenew-bracelet.org/ http://aluma-wallet-reviews.info/ 
 
Wow... one instant... that's even if it's just enough time for you to roll rear over and discover a comfy spot! Having some sort of sun moderately dewrinkled vehicle hoping for you from the parking lot for a cold day from a long work/school move about. I think just about the most awesome moments uses walking by having a large vehicle lot using a cold, gloomy, drizzly, rainy morning, opening ones car/truck front door and getting back in only to locate that it's warm plus cozy!... all because of the magnificent power associated with sun beams! It's kind like all the things which probably went wrong which day do not even matter because the world will not hate people quite much to abandon you which has a cold car or truck ride home. This awesomeness will be multiplied if the shift ends at night when it's already having dark... then its even more unexpected! It's like your truck loves you a lot that it is willing to hold the sun's warmth to talk about with just simply you! Those exactly who support a legalization regarding MJ are by and large hypocrites. Their libertarianism goes only at this point. Why never legalize all drugs? Why definitely not end the actual War with Drugs? Why let the government to overpower smoking? The just reason numerous here favour the legalization associated with MJ happens because it is actually accepted wisdom to the left. The hypocrisy features a more potent aroma compared to does this MJ.
== Elements in Namespace ==
 
I needed to select an element within a namespace but the element tags themselves did not have a namespace prefix. I modified this plugin to be able to set the namespace so that elements within this could be found. It is on [https://github.com/jcron/nsisXML github].
 
 
== Undocumented functions ==
 
Why is setDocumentElement undocumented? ([[User:Anders|Anders]] ([[User talk:Anders|talk]]) 23:27, 20 October 2017 (UTC))
 
 
== Crashes on NULL pointer ==
Please do some simple NULL pointer checks in functions like release. Leaking is better than crashing when people overwrite their $0.
[[User:Anders|Anders]] ([[User talk:Anders|talk]]) 15:33, 9 July 2022 (UTC)

Latest revision as of 15:33, 9 July 2022

Memory leaks

Many people find known memory leaks unacceptable. Granted, the NSIS probally won't listen on a port, and the memory will probally be freed after te process exits on 2000+. However, I don't think 9x cleans up memory too well and I've discovered memory leaks in my code that I wrote on a 2000 machine when it crashed on a NT 4.0 Machine. --Zippy1981 08:56, 5 September 2006 (PDT)

Latest version of nsisXML plugin have a release function to allow freeing memory if that's an issue for you. Wizou 15:17, 7 May 2011 (UTC)

Support for DOCTYPE tag

The DOCTYPE tag is not supported !

This issue about DOCTYPE support with MSXML is being discussed several times on the web. Google for it. Here is one solution (doc.validateOnParse = doc.resolveExternals = false; + doc.setProperty('ProhibitDTD', false); + doc.loadXML('<!DOCTYPE root><root/>');)

getText with a dxDiag file

getText fails when reading a dxDiag file. Here is the test for Windows Vistaâ„¢ Ultimate:

Exec "dxdiag /x $TEMP\dxdiag.xml"
 nsisXML::create
 nsisXML::load "$TEMP\dxdiag.xml"
 IntCmp $0 0 noDocument
 nsisXML::select '/DxDiag/SystemInformation/OperatingSystem'
 IntCmp $2 0 noElement
 nsisXML::getText
 IntCmp $3 0 noText
 MessageBox MB_ICONEXCLAMATION|MB_OK "Found operating System: $3"
 Goto done
noDocument:
 MessageBox MB_ICONEXCLAMATION|MB_OK "noDocument: $TEMP\dxdiag.xml does not exist"
 Goto done
noText:
 MessageBox MB_ICONEXCLAMATION|MB_OK "noText: Could not read the operating system from $TEMP\dxdiag.xml"
 Goto done
noElement:
 MessageBox MB_ICONEXCLAMATION|MB_OK "noElement: Could not read the operating system from $TEMP\dxdiag.xml"
 Goto done
done:
 Delete "$TEMP\dxdiag.xml"

note: replacing 'OperatingSystem' with 'Time' displays the time in a message box. -vude

Example Code - .NET Config Files

I'm using this plugin to adjust .NET config files. It works wonderfully. Here's what it looks like:

!macro AdjustConfigValue ConfigFile Key Value
 
   DetailPrint "Config: adding '${Key}'='${Value}' to ${ConfigFile}"
 
   nsisXML::create
   nsisXML::load ${ConfigFile}
 
   nsisXML::select "/configuration/appSettings/add[@key='${Key}']"
   nsisXML::setAttribute "value" ${Value}
 
   nsisXML::save ${ConfigFile}
 
!macroend
 
!insertmacro AdjustConfigValue "$INSTDIR\MyApp.exe.config" "ServiceURL" "http://127.0.0.1"

This adds a URL to a config file that resembles the following one:

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

Note that in this case the specified key is being updated, not added. That is nice for me because my test environment (and what's in SVN) already includes the key.

It works by making an XPath query to the config file for an element named 'add' with an attribute 'key' equal to whatever variable ${Key} is passed into the macro. It's probably not hard to see how it might be adjusted for database connection strings.

Good luck! --Ladenedge 00:59, 10 February 2010 (UTC)

Nesting

i generally prefer this plugin over others due to its filesize. however, what i'm missing is the option to create readable output, a way to tidy up the file to have nested tags.

Loop on childs ?

How to loop on childs like in :

<components>
<component name="that" version="1.0" />
<component name="this" version="1.0" />
</components>


nsisXML::select behaves unexpectedly but this allows you to enumerate by calling nsisXML::select "/components" in a loop (Anders (talk) 23:25, 20 October 2017 (UTC))

Elements in Namespace

I needed to select an element within a namespace but the element tags themselves did not have a namespace prefix. I modified this plugin to be able to set the namespace so that elements within this could be found. It is on github.


Undocumented functions

Why is setDocumentElement undocumented? (Anders (talk) 23:27, 20 October 2017 (UTC))


Crashes on NULL pointer

Please do some simple NULL pointer checks in functions like release. Leaking is better than crashing when people overwrite their $0. Anders (talk) 15:33, 9 July 2022 (UTC)