Returns the requested parts from text formatted as XML.
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|
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.
Data type returned
The XML data requested, either the node or the attributes of the node.
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 )
Say the field XML data contains this text:
<vendor id=”12″ >Troi Automatisering</vendor>
<product>Time machine 1.0</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" ; XML data )
returns ‘Hit Maker’.