NsisXML plug-in (by Joel): Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (NsisXML plug-in (Joel) moved to NsisXML plug-in (by Joel))
m (Reverted edits by 112.198.244.72 to last version by Anders)
 
(11 intermediate revisions by 6 users not shown)
Line 4: Line 4:


== Links ==
== Links ==
[http://plugins.joelito.net/ Joel's website] (where the plug-in can be found for download)
<br>
 
[http://nsis.sourceforge.net/Joel_plugin_src Main]
<br>
[http://forums.winamp.com/showthread.php?s=&threadid=217899 Forum topic]
[http://forums.winamp.com/showthread.php?s=&threadid=217899 Forum topic]


== Description ==
== Description ==
'''Version:''' 1.6.
nsisXML plugin to create and parse XML files using MSXML 2.6 (hope Win98 and better have it)
nsisXML plugin to create and parse XML files using MSXML 2.6 (hope Win98 and better have it)


Line 101: Line 105:
Example: ${nsisXML->removeChild} "XPATH_INSTRUCTION" "index_of_the_child_to_remove"
Example: ${nsisXML->removeChild} "XPATH_INSTRUCTION" "index_of_the_child_to_remove"


===${nsisXML->removeChild}===
===${nsisXML->removeAttr}===


Remove an attribute, upon of the selected name.
Remove an attribute, upon of the selected name.


Example: ${nsisXML->removeChild} "XPATH_INSTRUCTION" "name_of_the_attribute_to_remove"
Example: ${nsisXML->removeAttr} "XPATH_INSTRUCTION" "name_of_the_attribute_to_remove"


===${nsisXML->TidyFile}===
===${nsisXML->TidyFile}===

Latest revision as of 17:45, 10 January 2012

Author: Joel (talk, contrib)


NOTE: The name of this plug-in conflicts with Wizou's nsisXML.

Links


Main
Forum topic

Description

Version: 1.6.

nsisXML plugin to create and parse XML files using MSXML 2.6 (hope Win98 and better have it)

Instructions:
- Copy nsisXML.dll to Plugins and nsisXML.nsh to include directories
- Read this readme and example files.

Functions

${nsisXML->Build}

Displays the build version of the plugin.

Example: ${nsisXML->Build} ${VAR_RET}

${nsisXML->xPath}

Uses xPath syntax to parse and get strings from elements or attributes values.

Example: ${nsisXML->xPath} "PATH_OF_XML_FILE" "XPATH_INSTRUCTION" ${VAR_RET}

${nsisXML->Create}

Creates, in memory, the template of the xml file.

Example: ${nsisXML->Create}

${nsisXML->CreateElement}

Let's you create a xml element, from the parent document or from another node. Note: use "XPATH_INSTRUCTION" to locate a node where to put the new element; empty param means the element will be the first child; also "DO_TAB" will make a "tidy" element, use "1" as param to make it, other wise empty means the element will not have tidy (see example #2).

Example: ${nsisXML->CreateElement} "XPATH_INSTRUCTION" "STRING_ELEMENT" "DO_TAB"

${nsisXML->CreateComment}

Creates a comment after an element.

Example: ${nsisXML->CreateComment} "XPATH_INSTRUCTION" "STRING_COMMENT"

${nsisXML->SetElementAttr}

Adds an attribute and its value to an element.

Example: ${nsisXML->SetElementAttr} "XPATH_INSTRUCTION" "Attribute" "Value"

${nsisXML->SetElementText}

Sets the text for an element.

Example: ${nsisXML->SetElementText} "XPATH_INSTRUCTION" "STRING_TEXT"

${nsisXML->Display}

Shows in a MessageBox How's your xml tree going.

Example: ${nsisXML->Display}

${nsisXML->Release}

Frees the memory from the xml template and save the xml into a file.

Example: ${nsisXML->Release} "PATH_OF_XML_FILE"

${nsisXML->OpenXML}

Opens a xml file.

Example: ${nsisXML->OpenXML} "PATH_OF_XML_FILE"

${nsisXML->LoadXML}

Loads a xml string tree.

Example: ${nsisXML->LoadXML} "PATH_OF_THE_FUTURE_XML_FILE" "XML_STRING_TREE"

${nsisXML->CloseXML}

Closes 'OpenXML' or 'LoadXML' functions and saves the updates made to the file.

Example: ${nsisXML->CloseXML}

${nsisXML->xml}

Dump in a output var, the xml tree.

Example: ${nsisXML->xml} ${VAR_RET}

${nsisXML->removeChild}

Remove an element, upon of the selected index of the node that have it.

Example: ${nsisXML->removeChild} "XPATH_INSTRUCTION" "index_of_the_child_to_remove"

${nsisXML->removeAttr}

Remove an attribute, upon of the selected name.

Example: ${nsisXML->removeAttr} "XPATH_INSTRUCTION" "name_of_the_attribute_to_remove"

${nsisXML->TidyFile}

Makes the XML string from a <file> cuter :), see example #9.

Example: ${nsisXML->TidyFile}

${nsisXML->TestBegin}

Creates a template of XML in the memory, no need params and they are just for testing tasks (see example #8).

Example: ${nsisXML->TestBegin}

${nsisXML->TestXML}

Loads a xml string to test your xpath syntaxes.

Example: ${nsisXML->TestXML}

${nsisXML->TestFile}

Loads a xml file to test your xpath syntaxes.

Example: ${nsisXML->TestFile}

${nsisXML->TestShow}

Shows in a MessageBox the current XML tree.

Example: ${nsisXML->TestShow}

${nsisXML->TestEnd}

Cleans the xml template from the memory.

Example: ${nsisXML->TestEnd}

TODO

  • Just add support to tidy the inputed XML string.

History

16/07/2005 Added to my server.
19/10/2005 All the updates will be publish in the forum topic.