Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Validates XML against schema.

Component Version macOS Windows Linux Server iOS SDK
XML 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XML.ValidateFile"; FilePath; Schema )   More


Parameter Description Example
FilePath Native file path to the file to check. "/Users/cs/Desktop/test.xml"
Schema The schema definition as xml text.
With version 10.2 can also be file path.


Returns OK or error.


Validates XML against schema.
Please pass in XML file path and a valid XSD schema.
Return list of errors, so you see them all.
If you use Process.SetCurrentDirectory to change current folder for the application process, the library uses this folder to search for referenced xsd files.

Changed with version 10.2 that you can pass schema as file name/path, so we can load it from same folder as the schema and referenced files in same folder are found.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.


Validate a file in a folder:

Set Variable [ $r ; Value: MBS( "Process.SetCurrentDirectory"; "/Users/cs/Documents/todo/XML Validate/") ]
Set Variable [ $result ; Value: MBS("XML.ValidateFile"; "test.xml"; XML Validation::Schema) ]
Set Field [ XML Validation::Result ; $result ]

Validate all in one folder:

# set folder
Set Variable [ $r ; Value: MBS( "Process.SetCurrentDirectory"; "/Users/cs/Desktop/XML Validate") ]
# validate file
Set Field [ XML Validation::Result ; MBS("XML.ValidateFile"; "test.xml"; "generalInvoiceRequest_450.xsd") ]
# folder contains xmldsig-core-schema.xsd, xenc-schema.xsd, generalInvoiceRequest_450.xsd and test.xml

See also

Release notes

Blog Entries

This function checks for a license.

Created 6th March 2018, last changed 22nd April 2020

XML.Validate - ZipFile.CRCFile