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
*/
// ===================================
Let([__LITBR____LITBR__a=Position(xml ; "<" ; 1 ; 1 );__LITBR__b=Position(xml ; ">" ; 1 ; 1 );__LITBR__tag1name=Middle ( xml ; a + 1 ; b - a - 1); //get first tag name__LITBR__tag1end = xmlTagN.valuePosEnd ( tag1name ; xml ; 1 );__LITBR__tag1= Middle( xml ; a ; (tag1end - a + 1) + (b-a+2) ) ];__LITBR____LITBR__TrimSpaceCR ( tag1) __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/241__LITBR____LITBR__ Prototype: xmlFirstTag( xml )__LITBR__ Function Author: konrad (http://www.fmfunctions.com/mid/224)__LITBR__ Last updated: 13 December 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================