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

From NSIS Wiki
Jump to navigationJump to search
mNo edit summary
Line 1: Line 1:
'''NOTE:''' The name of this plug-in conflicts with [[User:Wizou|Wizou]]'s [[XML manipulation (based on MSXML)|nsisXML]].
== Links ==
[http://plugins.joelito.net/ Joel's website] (where the plug-in can be found for download)
[http://forums.winamp.com/showthread.php?s=&threadid=217899 Forum topic]


== Description ==
== Description ==
Line 7: Line 13:
- Read this readme and example files.
- Read this readme and example files.


== Functions available ==
== Functions ==


==[Build]==
===${nsisXML->Build}===


Displays the build version of the plugin.
Displays the build version of the plugin.
Example: ${nsisXML->Build} ${VAR_RET}
Example: ${nsisXML->Build} ${VAR_RET}


==[xPath]==
===${nsisXML->xPath}===


Uses xPath syntax to parse and get strings from elements or attributes values.
Uses xPath syntax to parse and get strings from elements or attributes values.
Example: ${nsisXML->xPath} "PATH_OF_XML_FILE" "XPATH_INSTRUCTION" ${VAR_RET}
Example: ${nsisXML->xPath} "PATH_OF_XML_FILE" "XPATH_INSTRUCTION" ${VAR_RET}


==[Create]==
===${nsisXML->Create}===


Creates, in memory, the template of the xml file.
Creates, in memory, the template of the xml file.
Example: ${nsisXML->Create}
Example: ${nsisXML->Create}


==[CreateElement]==
===${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).
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"
Example: ${nsisXML->CreateElement} "XPATH_INSTRUCTION" "STRING_ELEMENT" "DO_TAB"


==[CreateComment]==
===${nsisXML->CreateComment}===


Creates a comment after an element.
Creates a comment after an element.
Example: ${nsisXML->CreateComment} "XPATH_INSTRUCTION" "STRING_COMMENT"
Example: ${nsisXML->CreateComment} "XPATH_INSTRUCTION" "STRING_COMMENT"


==[SetElementAttr]==
===${nsisXML->SetElementAttr}===


Adds an attribute and its value to an element.
Adds an attribute and its value to an element.
Example: ${nsisXML->SetElementAttr} "XPATH_INSTRUCTION" "Attribute" "Value"
Example: ${nsisXML->SetElementAttr} "XPATH_INSTRUCTION" "Attribute" "Value"


==[SetElementText]==
===${nsisXML->SetElementText}===


Sets the text for an element.
Sets the text for an element.
Example: ${nsisXML->SetElementText} "XPATH_INSTRUCTION" "STRING_TEXT"
Example: ${nsisXML->SetElementText} "XPATH_INSTRUCTION" "STRING_TEXT"


==[Display]==
===${nsisXML->Display}===


Shows in a MessageBox How's your xml tree going.
Shows in a MessageBox How's your xml tree going.
Example: ${nsisXML->Display}
Example: ${nsisXML->Display}


==[Release]==
===${nsisXML->Release}===


Frees the memory from the xml template and save the xml into a file.
Frees the memory from the xml template and save the xml into a file.
Example: ${nsisXML->Release} "PATH_OF_XML_FILE"
Example: ${nsisXML->Release} "PATH_OF_XML_FILE"


==[OpenXML]==
===${nsisXML->OpenXML}===


Opens a xml file.
Opens a xml file.
Example: ${nsisXML->OpenXML} "PATH_OF_XML_FILE"
Example: ${nsisXML->OpenXML} "PATH_OF_XML_FILE"


==[LoadXML]==
===${nsisXML->LoadXML}===
 
Loads a xml string tree.


Loads a xml string tree
Example: ${nsisXML->LoadXML} "PATH_OF_THE_FUTURE_XML_FILE" "XML_STRING_TREE"
Example: ${nsisXML->LoadXML} "PATH_OF_THE_FUTURE_XML_FILE" "XML_STRING_TREE"


==[CloseXML]==
===${nsisXML->CloseXML}===


Closes 'OpenXML' or 'LoadXML' functions and saves the updates made to the file.
Closes 'OpenXML' or 'LoadXML' functions and saves the updates made to the file.
Example: ${nsisXML->CloseXML}
Example: ${nsisXML->CloseXML}


==[xml]==
===${nsisXML->xml}===


Dump in a output var, the xml tree.
Dump in a output var, the xml tree.
Example: ${nsisXML->xml} ${VAR_RET}
Example: ${nsisXML->xml} ${VAR_RET}


==[removeChild]==
===${nsisXML->removeChild}===


Remove an element, upon of the selected index of the node that have it.
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"
Example: ${nsisXML->removeChild} "XPATH_INSTRUCTION" "index_of_the_child_to_remove"


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


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->removeChild} "XPATH_INSTRUCTION" "name_of_the_attribute_to_remove"


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


Makes the XML string from a <file> cuter :), see example #9.
Makes the XML string from a <file> cuter :), see example #9.
Example: ${nsisXML->TestFile}


==[TestBegin]==
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).
Creates a template of XML in the memory, no need params and they are just for testing tasks (see example #8).
Example: ${nsisXML->TestBegin}
Example: ${nsisXML->TestBegin}


==[TestXML]==
===${nsisXML->TestXML}===


Loads a xml string to test your xpath syntaxes.
Loads a xml string to test your xpath syntaxes.
Example: ${nsisXML->TestXML}
Example: ${nsisXML->TestXML}


==[TestFile]==
===${nsisXML->TestFile}===


Loads a xml file to test your xpath syntaxes.
Loads a xml file to test your xpath syntaxes.
Example: ${nsisXML->TestFile}
Example: ${nsisXML->TestFile}


==[TestShow]==
===${nsisXML->TestShow}===


Shows in a MessageBox the current XML tree.
Shows in a MessageBox the current XML tree.
Example: ${nsisXML->TestShow}
Example: ${nsisXML->TestShow}


==[TestEnd]==
===${nsisXML->TestEnd}===


Cleans the xml template from the memory.
Cleans the xml template from the memory.
Example: ${nsisXML->TestEnd}
Example: ${nsisXML->TestEnd}
== Forum topic ==
[http://forums.winamp.com/showthread.php?s=&threadid=217899 Visit].
== Download ==
[http://plugins.joelito.net/ Site].


== TODO ==
== TODO ==
Just add support to tidy the inputed XML string.
*Just add support to tidy the inputed XML string.


== History ==
== History ==

Revision as of 12:21, 12 December 2005

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

Links

Joel's website (where the plug-in can be found for download)

Forum topic

Description

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->removeChild}

Remove an attribute, upon of the selected name.

Example: ${nsisXML->removeChild} "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.