Function overview
Prototype
xmlGetH (
name; xml )
Parameters
name
xml
Description
Tags:
xml
store multible named values in one field or variable!
usefull to pass over multible values as a scriptparameter
gets value of a tag with given name, where the name includes the position of the value in the xml structure like "contact.ID" for the tag "ID" inside the tag "contact"
return value can also be child xml from the named tag
Examples
Sample input
xmlGetH ( "contact.ID" ;
"<contact>
<ID>2354</ID>
<Lastname>Frank</Lastname>
</contact>
<letter>
<ID>234</ID>
</letter>"
Sample output
2354
Function code
//gets value from position name in a hierarchical xml structure
//name has the format name1.name2.name3 ...
Let([
dot1 = Position ( name ; "."; 1; 1); //no dots in name result 0
name1 = If( dot1 > 0 ; Left ( name ; dot1 - 1) ; name ) ; //name before first dot
nameR = If( dot1 > 0 ; Right ( name ; Length ( name ) - dot1 ) ) ; //restname after first dot
xml1 = xmlGetTop ( name1 ; xml ) ; //value for first name, can be xml as well
value=If ( dot1 > 0 ; xmlGetH ( nameR ; xml1 ) ; xml1 ) ] ; //recursion!
TrimSpaceCR ( value) //remove leading or trailing " " and "¶"
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/245
Prototype: xmlGetH( name; xml )
Function Author: konrad (http://www.fmfunctions.com/mid/224)
Last updated: 12 December 2009
Version: 1
*/
// ===================================
//gets value from position name in a hierarchical xml structure__LITBR__//name has the format name1.name2.name3 ...__LITBR____LITBR__Let([__LITBR____LITBR__dot1 = Position ( name ; "."; 1; 1); //no dots in name result 0__LITBR__name1 = If( dot1 > 0 ; Left ( name ; dot1 - 1) ; name ) ; //name before first dot__LITBR__nameR = If( dot1 > 0 ; Right ( name ; Length ( name ) - dot1 ) ) ; //restname after first dot__LITBR__xml1 = xmlGetTop ( name1 ; xml ) ; //value for first name, can be xml as well__LITBR__value=If ( dot1 > 0 ; xmlGetH ( nameR ; xml1 ) ; xml1 ) ] ; //recursion!__LITBR__TrimSpaceCR ( value) //remove leading or trailing " " and "¶"__LITBR__ __LITBR__ )__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/245__LITBR____LITBR__ Prototype: xmlGetH( name; xml )__LITBR__ Function Author: konrad (http://www.fmfunctions.com/mid/224)__LITBR__ Last updated: 12 December 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.