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
*/
// ===================================
Let([__LITBR____LITBR__xml=Substitute ( xml ; ">¶ " ; ">¶" ); //readability: setback xlm childes 2 step to left__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____LITBR__tag1end = xmlTagN.valuePosEnd ( tag1name ; xml ; 1 );__LITBR__tag1= Middle( xml ; b + 1 ; tag1end - b) ];__LITBR____LITBR__TrimSpaceCR ( tag1) //readability: delete leading and trailing " " or "¶"__LITBR____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/242__LITBR____LITBR__ Prototype: xmlFirstTagValue( xml )__LITBR__ Function Author: konrad (http://www.fmfunctions.com/mid/224)__LITBR__ Last updated: 12 December 2009__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.