Brian Dunning's FileMaker Custom Functions

XMLFormat ( xmlText )

Formats and beautifies XML to make it human-readable

  Be the first to rate this function Log in to vote

Brian Panhuyzen   Brian Panhuyzen - Show more from this author
Neutrino Data Systems
https://neutrinodata.com

  Sample input:
XMLFormat ( "5B01Kilgour TroutTrout, KilgourKilgourTrout04USUS-NYIlium" )
  Sample output:

5
B01
Kilgour Trout
Trout, Kilgour
Kilgour
Trout

04
US
US-NY
Ilium

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

(Sample Input and Sample Output are wrong; this site is parsing the XML when it should be displaying it as typed – not sure how to get around that...)

Sample Output:


5
B01
Kilgour Trout
Trout, Kilgour
Kilgour
Trout

04
US
US-NY
Ilium



)

Takes a block of formatted or unformatted XML and renders it human-readable by indenting opening and closing tags.

It will keep inline tags in the same line as the XML tag; these are defined in the ~inlineTagsList variable; add others there, if necessary.

This was generated in collaboration with claude.ai, through 41 prompts*. While this is hardly my own work, and anyone could engage AI to build it, I am posting it here so others won't have to go through the iterations it required to reach completion, saving time, energy, and water that would be needed to repeat the process.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 21 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: