xmlFirstTag ( )

Function stats

Average user rating
224
241
9999
Support
FileMaker 7.0 +
Date posted
13 December 2009
Version
1
Recursive function
No

Author Info
 konrad

10 functions

Average Rating None

author_avatar



 

Function overview

Prototype

xmlFirstTag  ( xml )


Parameters

xml  


Description

Tags:  xml  

gets the first tag of the xml

requires also xmlTagN.valuePosEnd ( ) !
[fmfunctions.com does not let me add it to required list..]

Examples

Sample input

<contact><ID>2354</ID><Lastname>Frank</Lastname></contact><letter><ID>234</ID></letter>


Sample output

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

 

Function code

Let([

a=Position(xml ; "<" ; 1 ; 1 );
b=Position(xml ; ">" ; 1 ; 1 );
tag1name=Middle ( xml ; a + 1 ; b - a - 1); //get first tag name
tag1end = xmlTagN.valuePosEnd ( tag1name ; xml ; 1 );
tag1= Middle( xml ; a ; (tag1end - a + 1) + (b-a+2) ) ];

TrimSpaceCR ( tag1)

)

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

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

    Prototype: xmlFirstTag( xml )
    Function Author: konrad (http://www.fmfunctions.com/mid/224)
    Last updated: 13 December 2009
    Version: 1

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