xmlGetTop ( )

Function stats

Average user rating
224
244
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

xmlGetTop  ( name;   xml )


Parameters

name  


xml  


Description

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, only when tag found in the top level of the given hierarchical xml structure
scans through the top level tags by recursion

return value can also be child xml from the named tag

Examples

Sample input

xmlGetTop ( "contact" ;
"<contact>
<ID>2354</ID>
<Lastname>Frank</Lastname>
</contact>
<letter>
<ID>234</ID>
</letter>"


Sample output

<ID>2354</ID>
<Lastname>Frank</Lastname>

 

Function code

Let([

name0 = xmlFirstTagName ( xml );
xmlR = xmlWithoutFirstTag ( xml );
value = If( name0=name;
xmlFirstTagValue ( xml );
If ( PatternCount ( xmlR; "<"&name&">" )>0 ;
xmlGetTop ( name ; xmlR) ; //recursion!
""
)
) ];

TrimSpaceCR ( value )

)

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

    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/244

    Prototype: xmlGetTop( 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.