[FX.php List] Illegal characters in FMPro's XML

Brion Vibber brion at pobox.com
Mon Jan 17 14:34:38 MST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I got hit with a nasty surprise today; somehow illegal control 
characters were appearing in the XML output from my FileMaker Pro 5.5. 
These trigger an unrecoverable error in the XML parser like this:

   XML error: not well-formed (invalid token) at line 1543

FX reports the error message and die()s, making it a fatal error from 
my script's point of view.

As a quick hack, I added the following to strip any such chars from the 
input before running xml_parse() in FX::ExecuteQuery():

     # --- HACK
     # Strip illegal low chars
     $data = preg_replace( '/[\x00-\x08\x0b-\x0c\x0e-\x1f]/', '', $data 
);
     # --- END HACK

This leaves the legal tab and newline characters, stripping out the 
illegal ones. Obviously this is a bug in FileMaker (hopefully one 
that's been fixed in later versions; someday we'll migrate to 7... ;) 
but as it's fatal when encountered a workaround helps for me.

- -- brion vibber (brion @ pobox.com)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Darwin)

iD8DBQFB7C9+wRnhpk1wk44RAiwTAJ9FegbLAs8LhiY2lYg0vgmtjXejoQCdE0FQ
1+1wGyBx5rQgVRCBNUfYAq0=
=on68
-----END PGP SIGNATURE-----



More information about the FX.php_List mailing list