Skip to main content

TrText_XML (function reference)

By December 1, 2021December 21st, 2021Online Help, Troi Text Plug-in
Troi Text Plug-in for FileMaker Pro


Returns the requested parts from text formatted as XML.

SyntaxFunction badge

TrText_XML ( switches ; nodeSpec ; XMLData )


switches determine which data is returned
nodeSpec the node you want data from
XMLData the text which contains XML formatted data


Switches can be one of this:

-GetNode return the node data
-GetAttributes return the node attributes

Specifying Nodes:
Child nodes are specified from the root of the node downwards, and are separated by a slash: ‘/’. For example:


If the XML contains multiple occurrences of a node you can retrieve a specific node by adding a number like this:


This will get the 3rd ‘ghi’ node from the 2nd ‘def’ node of abc.

You can add spaces to the node specification to improve readability.

Returned Result

Data type returned



The XML data requested, either the node or the attributes of the node.

Originated in

Troi Text Plug-in 1.2


FileMaker Pro 16 to 19


The XML parsing function of Troi Text Plug-in has some known limitations:

No XML validation
Parsing will only be correct with a well-formed XML document (or a part thereof). If this is not the case the plug-in will try to parse it anyway, but the result may be unpredictable. The plug-in does not validate the XML.

Limited attribute retrieval
The plug-in can only return all attributes of a node at once. From this you have to get the individual attributes out yourself. An easy function to get a specified attribute out is on our own wish list. For the moment you can use the text functions in FileMaker to extract these from the “Attribute data” field.

Processing instructions and comments are not returned
The plug-in can’t return processing instructions like “<?xml version=”1.0″ ?>” and comments. We think there is little need for this functionality. You can use the text functions in FileMaker Pro to extract these from the “XML data” field.


TrText_XML ( "-GetNode" ; "transaction/product/name" ; XML data )

Example 2

Say the field XML data contains this text:
<?xml version=”1.0″?>
<vendor id=”12″ >Troi Automatisering</vendor>
<product>Time machine 1.0</product>
<product>Hit Maker</product>


TrText_XML ( "-GetNode" ; "xsd/vendor" ; XML data )

returns ‘Troi Automatisering’.

TrText_XML ( "-GetAttributes" ; "xsd/vendor" ; XML data )

returns ‘id=”12″ ‘.

TrText_XML ( "-GetNode" ; "xsd/vendor/product[2]" ; XML data )

returns ‘Hit Maker’.

Related topics

Troi Text Plug-in online help (overview)

Online Help Page for Troi Text Plug-in for 16 to 19 –> TrText_XML (textp15) 2021-1221 15:21:59