Most test and demo auditfiles that are available on the internet are incomplete and invalid. In this post I present a maximal SAF-T auditfile which is valid and contains all possible data elements. I also explain how to create this file and it’s minimal variants.
For the development of an app like XAF Explorer for Power BI you need an auditfile containing all elements the schema defines. An Xml auditfile like SAF-T version 2.00 has almost 800 data elements, so it’s not easy to create a maximal loaded file manually. Fortunately, there are several tools available that will help you to create an Xml file from a schema. Recently I used Visual Studio 2019 for this purpose, and I was surprised.
VS tries to insert the name of the element as a value unless it is invalid. For example:
- AuditFileVersion is restricted to 9 characters max
- AuditFileCountry must be a valid ISO countrycode (A1 is anonymous proxy)
- AuditFileDateCreated must be a date
- AddressType is a predefined enumeration.
Also note that VS is aware of the fact that Address is a repeating element. In most cases it will insert three occurences of a repeating element.
So VS does a good job. However, it isn’t perfect, since most of the time the created file will be invalid and incomplete:
- VS doesn’t take all facets and restrictions into account, e.g. the TotalDigits and FractionDigits constraints often fail. This can easily be solved by using search and replace with regular expressions.
- VS only creates data from the first element in a Choice. To include the other choices you have to modify the file manually. I found my own tool very helpfull for this, see the post Create Xml from schema
- VS creates values for key- and keyref elements at random. Under certain circumstances you can get duplicate key warnings, and almost always a lot of “Keyref fails to refer to some key” warnings. This too can be solved by using search and replace with regular expressions.
So there is work to do if you want to create a valid Xml auditfile which contains all elements. For development and testing purposes you can’t do without it. To make it easy for you: in the package you can download below you find a maximal loaded SAF-T version 2.00 auditfile for test and development.
Minimal test file
In the package you also find a minimal SAF-T version 2.00 file that is valid against the schema. It looks like this:
As you see this file is quite useless, since all major sections are missing. However, if your app takes a SAF-T file as input it is a good practice to test it with this file too.
As a bonus the package contains a third file, which is a minimal plus variant: it contains minimal versions of all major parts of the SAF-T auditfile. This is the outline:
Link to the package
Enter your e-mail below and you will receive an email with a download link to a zip file containing the three SAF-T files.
We respect your privacy, and will use your e-mail only for communication related to this download.