Name: revXMLPutIntoNode

Type: command

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

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

Associations: xml library

Introduced: 2.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, 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>.

nodePath:
The path to the node whose contents you want to set.

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.


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 
> <LiveCode custom library|custom library> when you create your 
> <standalone application|standalone>. In the Inclusions pane of the 
> <Standalone Application Settings> window, make sure the "XML" 
> checkbox is checked.

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

Tags: text processing

