xmlFirstTagValue ( )

Function stats

Average user rating
224
242
9999
Support
FileMaker 7.0 +
Date posted
12 December 2009
Last updated
12 December 2009
Version
Recursive function
No

Author Info
 konrad

10 functions

Average Rating None

author_avatar



 

Function overview

Prototype

xmlFirstTagValue  ( xml )


Parameters

xml  


Description

Tags:  xml  

gets the content of the first tag in xml
-- part or xmlGetH / xmlSetH ---
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

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

 

Function code

Let([

xml=Substitute ( xml ; ">¶ " ; ">¶" ); //readability: setback xlm childes 2 step to left

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 ; b + 1 ; tag1end - b) ];

TrimSpaceCR ( tag1) //readability: delete leading and trailing " " or "¶"


)

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

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

    Prototype: xmlFirstTagValue( xml )
    Function Author: konrad (http://www.fmfunctions.com/mid/224)
    Last updated: 12 December 2009
    Version: 1.1

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

 

 

 

 


Login or register to comment

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