Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   7.6    Statistic  

XML.SetPathValue

Sets an xml node.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
XML 7.4 Yes Yes Yes Yes Yes

MBS( "XML.SetPathValue"; XML; Path; Flags; Value )

Parameters

Parameter Description Example value
XML The XML to process. "<test>Hello</test>"
Path The path to the node or attribute to query. "name"
Flags Various Flags.
Add 1 to ignore errors in xml and continue parsing. This may lead to not everything in the xml being read.
Add 4 to format returned XML.
Add 32 to return result as XML.
0
Value The new value for node or attribute. "Hello"

Result

Returns OK or error.

Description

Sets an xml node.
If needed, new nodes / attributes are added.
This function uses a path notation like the JSON functions in FileMaker to describe paths.
You can use name of a node followed by option index in square brackets. On the end you can use # followed by a name of an attribute to select only the attribute.
Delimiter between items can be dot like FileMaker or newline.

Examples

Add a first name:

MBS( "XML.SetPathValue"; "<person/>"; "person.firstName"; 0; "Joe" )

Example result:
"<?xml version="1.0" encoding="UTF-8"?>
<person><firstName>Joe</firstName></person>"

Add id attribute:

MBS( "XML.SetPathValue"; "<person/>"; "person#id"; 0; "123" )

Example result:
"<?xml version="1.0" encoding="UTF-8"?>
<person id="123"/>"

Adds a new name node with href number.

MBS( "XML.SetPathValue"; "<person></person>"; "person.name href=\"10.00\"" ; 4 ; "" )

Example result:
"<?xml version="1.0" encoding="UTF-8"?>
<person>
<name href="10.00"/>
</person>"

See also


XML.ReleaseAll   -   XML.SetVariables

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins