XMLtag ( tag ; content ; type )
To be used in a script, returns correctly indentend xml
Average rating: 4.8 (22 votes) Log in to vote
Martin Spanjaard - Show more from this author
Trias Digitaal http://www.triasdigitaal.nl |
XMLtag( "FinYear" ; "number=2014" ; "single" )
XMLtag("DueDate" ; "2014-04-03" ; "closed" )
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
/*************************************************************************************************************************
29-01-2014 - 01-05-2014
© Martin Spanjaard, Trias Digitaal Amserdam
XMLtag( tag ; content ; type ) returns automatically indented, correctly formatted xml-strings.
Some examples of possible output:
The output ends with a return (¶).
The parameter 'type' can have one of 4 values:
- single: the tag begins with < and ends with />
- end: the tag begins with and ends with >
- start: the tag begins with < and ends with >
- closed: - if content is given:
- if content is empty:
The content for the types 'single' and 'start' should be in the form of a string with one or more name=value pairs.
In the result the values will be quoted: name="value" and immediately follow the tag, as in the examples above.
The type 'end' does not expect content and doesn't handle it if there were content.
---
The correct indentation is done through the variable $xmlindents which is made in this custom function.
It exists during the script calling XMLtag.
The variable contains the number of tabs the code should be indented.
The method is:
- a start-tag raises the indentation with 1,
- an end-tag lowers it with 1.
The other tags do not change the variable.
*************************************************************************************************************************/
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.