A READER ASKS: FileMaker Text To XML And Illegal Characters

From Dwayne Wright PMP, PMI-ACP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

A READER ASKS
I created a calculation field in FileMaker that concatenates multiple fields into one text string that is suitable for ingestion into InDesign for our typesetting department. Things went fine for awhile but they are complaining that the XML is broke because of an ampersand character?

I'm not quite sure what to do next?

-------
DWAYNE RESPONDS
Yep, I had that happen to me as well. There is a great article that covers XML and how to escape these troublesome characters, here is a link http://www.xmlnews.org/docs/xml-basics.html  .

I wrote a custom function to handle this for me using the following calc,

Let([

name = Substitute ( “the field to fix” ; "&" ; "&" );
name = Substitute ( name; "<" ; "&lt;;" );
name = Substitute ( name ; ">" ; "&gt;;" );
name = Substitute ( name ; "'" ; "&apos;;" )

];

name)

Then I looked at briandunning.com just to see if there was already a custom function out there. There is at least one named EscapeXML ( http://www.briandunning.com/cf/1332 ), ironically the same troublesome characters are substituted on brians page. If you look down into the comments area, you can see that Ibrahim includes the proper calculation down there.

Hope that helps!
Dwayne

More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2013 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.