xmlGetH ( )

Function stats

Average user rating
224
245
9999
Support
FileMaker 7.0 +
Date posted
12 December 2009
Version
1
Recursive function
Yes

Author Info
 konrad

10 functions

Average Rating None

author_avatar



 

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

*/
// ===================================

 

 

 

 


Login or register to comment

Create a new account with fmcustomfunctions.com or login to post a comment.