revXMLPutIntoNode

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
revXMLPutIntoNode <treeID>, <nodePath>, <newContents> [, <replaceTextOnly>]
Associationsxml library
Summary

Sets the contents of a node in an XML tree.

Introduced2.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
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.

Example
revXMLPutIntoNode 12,"/Article/Author","Jane Li"
revXMLPutIntoNode myCurrentNode,dataPaths["current"],field "Data", true
Values
NameTypeDescription
The result

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

RelatedCommand: revXMLDeleteNode, revXMLAppend
Function: result, uniDecode, revXMLCreateTree, revXMLCreateTreeFromFile
Glossary: XML tree, Standalone Application Settings, tag, standalone application, Unicode, node, command, LiveCode custom library
Library: XML library
Securitydisk
Description

Use the revXMLPutIntoNode command to put data into a node, between the node's start and end 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 custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.

Tagstext processing