Name: revXMLPutIntoNode

Type: command

Syntax: revXMLPutIntoNode <treeID>, <node>, <newContents> [, <replaceTextOnly>]

Summary: Sets the contents of a <node> in an <XML tree>.

Introduced: 2.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Security: disk

Example:
revXMLPutIntoNode 12,"/Article/Author","Jane Li"

Example:
revXMLPutIntoNode myCurrentNode,dataPaths["current"],field "Data", true

Parameters:
treeID: The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree.
node: 
newContents: The text that the node will contain.
replaceTextOnly: The replaceTextOnly specifies whether to keep child nodes or not. If replaceTextOnly is true then all text in the specified node is replaced with newContents, but all child nodes are preserved. Otherwise all child nodes are removed. The replaceTextOnly parameter is optional, and if not given, defaults to false.
nodePath: The path to the node whose contents you want to set.

The result: If the <revXMLPutIntoNode> <command> encounters an error, the <result> is set to an error message beginning with "xmlerr".

Description:
Use the <revXMLPutIntoNode> <command> to put data into a <node>, between the <node|node's> start and end <tag|tags>.

>*Tip:*  To put <Unicode> text into a <node>, first use the <uniDecode> function to encode the text as UTF-8:

  revXMLPutIntoNode the docId of field "xmltree",selectedNode, uniDecode(the unicodeText of field "Contents","UTF8")

>*Important:*  The <revXMLPutIntoNode> <command> is part of the <XML library>. To ensure that the <command> works in a <standalone application>, you must include this <Revolution custom library|custom library> when you create your <standalone application|standalone>. In the Inclusions section on the General screen of the <Standalone Application Settings> window, make sure "XML Library" is selected in the list of script libraries.

References: revXMLDeleteNode (command), revXMLAppend (command), result (function), uniDecode (function), XML tree (glossary), Standalone Application Settings (glossary), tag (glossary), standalone application (glossary), Unicode (glossary), node (glossary), command (glossary), XML library (library), Revolution custom library (library)

Tags: text processing
