NsisXML plug-in (by Joel)

From NSIS Wiki

Author: Joel (talk, contrib)


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

Contents

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.

Personal tools
donate
ads