Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XML.Colorize
Formats a XML string with color.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XML | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
(old name: XML.Colourise)
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
XML | The XML text to process. | "<test>Hello</test>" | |
DarkMode | Available in MBS FileMaker Plugin 12.1 or newer. Whether to swap colors to use white for text color. Pass 1 for dark mode and 0 for light mode. Default is 0 for light mode. |
0 | Optional |
Result
Returns formatted text or error.
Description
Formats a XML string with color.This colorizes an existing XML text to show to user, but does not check syntax.
Keys get blue, text value black, attributes in purple.
Text is returned only with colors. You can apply text font and font size with normal FileMaker functions.
Processing time is linear to length, so should be faster than custom functions.
Applying text styles takes time. You may consider to skip this if your JSON is e.g. bigger than a million characters to improve performance of your scripts.
Examples
Colorize a field:
Set Field [ Data::XML ; MBS("XML.Colorize"; Data::XML) ]
Line numbers, color and format:
MBS( "Text.AddLineNumbers"; MBS( "XML.Colorize"; MBS( "XML.Format"; Buckets::Listing)))
Colorize in Auto-Enter calculation:
MBS("XML.Colorize"; self)
// put this calculation into a field, so the field gets colorized whenever the field is changed and the record gets commited.
Colorize and format in Auto-Enter calculation:
Let ( [
xmlFormatted = MBS("XML.Format"; Self);
xmlFormatFailed = MBS("IsError");
xmlText = If(xmlFormatFailed; Self; xmlFormatted);
result = MBS("XML.Colorize"; xmlText)
]; result )
// put this calculation into a field, so the field gets formated and colorized whenever the field is changed and the record gets commited.
See also
Release notes
- Version 12.3
- You can now use english spelling JSON.Colourise and XML.Colourise if you prefer to call JSON.Colorize or XML.Colorize.
- Version 12.1
- Added darkMode parameter for XML.Colorize and JSON.Colorize function.
- Version 8.2
- Added XML.Colorize function.
- Fixed XML.Colorize function coloring for attributes.
Example Databases
- CURL/Amazon S3/Amazon S3 Buckets
- DynaPDF/List XFA Streams
- JSON/JSON to HTML
- Mac only/Script Workspace Context Menu Commands
- Win Only/Search Scripts
- Win Only/Snippets for Windows
- XML/XML and JSON
- XML/XML Colorize
- XML/XML to HTML
- XML/XML to JSON
Blog Entries
- MBS FileMaker Plugin, version 12.3pr1
- MBS FileMaker Plugin 12.1 - More than 6700 Functions In One Plugin
- MBS FileMaker Plugin, version 12.1pr1
- XML and JSON Colorize for Dark Mode
- FileMaker Developers in Southern California
- FileMaker records to XML or JSON
- MBS FileMaker Plugin 8.3 released
- Colorize JSON or XML in FileMaker with line numbers
- MBS FileMaker Plugin, version 8.2pr5
- Colorize XML in FileMaker
This function is free to use.
Created 8th April 2018, last changed 19th June 2024