Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XML.Validate
Validates XML against schema.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XML | 8.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
XML | The XML to process. Can be XML as text or the reference returned by XML.Parse function, so you can make several times changes to the XML without parsing it each time. |
"<test>Hello</test>" | |
Schema | The schema definition. | $schema | |
Flags | Various Flags. Add 1 to ignore errors in xml and continue parsing. This may lead to not everything in the xml being read. Add 8 to remove all namespaces before query to have queries easier. |
0 | Optional |
Result
Returns OK or error.
Description
Validates XML against schema.Please pass in XML (or reference number from XML.Parse) and a valid XSD schema.
Version 8.2 or newer will return list of errors, so you see them all.
This function may look into the current directory for referenced xml/xsd files. See Process.SetCurrentDirectory function.
Examples
Validate XML:
Set Variable [ $result; Value:MBS("XML.Validate"; XML Validation::XML; XML Validation::Schema; 0) ]
Validate ZUGFeRD's invoice XML:
# you got the XML from the invoice
Set Variable [ $xml ; Value: MBS("Text.ReadTextFile"; "/Users/cs/ZUGFeRD/factur-x.xml"; "UTF-8") ]
#
# you have schema files in a folder
Set Variable [ $path ; Value: "/Users/cs/ZUGFeRD" ]
Set Variable [ $r ; Value: MBS("Process.SetCurrentDirectory"; $path) ]
#
# validate
Set Variable [ $Schema ; Value: MBS("Text.ReadTextFile"; "/Users/cs/ZUGFeRD/Factur-X_1.0.07_EXTENDED.xsd"; "UTF-8") ]
Set Variable [ $result ; Value: MBS( "XML.Validate"; $XML; $schema ) ]
Show Custom Dialog [ "Result" ; $result ]
See also
Release notes
- Version 10.2
- Changed XML.ValidateFile to accept schema as XML file path.
- Version 8.2
- Added XML.ValidateFile function.
- Changed XML.Validate to return errors about parsing the XSD schema.
- Improved XML.Validate to return several errors.
- Version 8.1
- Added XML.Validate function.
Example Databases
Blog Entries
- Electronic invoices in FileMaker
- Elektronische Rechnungen in FileMaker
- Validate electronic invoices with Saxon
- Validating schema for electronic invoices with ZUGFeRD
- ZUGFeRD mit DynaPDF und MBS
- MBS FileMaker Plugin, version 8.2pr1
- MBS FileMaker Plugin v8.1 with 5100 Functions In One Plugin
- MBS FileMaker Plugin 8.1
- MBS FileMaker Plugin, version 8.1pr2
FileMaker Magazin
This function checks for a license.
Created 6th February 2018, last changed 10th October 2024
