• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Pixcels.nl

  • Home
  • Categories
    • Excel apps
    • Pivottable stuff
    • PowerBI stuff
    • RGS en auditfiles
    • Sheet stuff
    • Userform stuff
    • VBA stuff
    • VBE stuff
    • XML stuff
  • About
You are here: Home / Categories / XML stuff / SAF-T auditfiles for test and development

SAF-T auditfiles for test and development

2020/09/04 by Frans

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.

First part of a SAF_T auditfile created by Microsoft Visual Studio 2019

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:

The minimal SAF-T 2.00 auditfile that is valid

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:

The outline of the minimal variant containing all major parts

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.

Email *



Filed Under: RGS en auditfiles, XML stuff

Primary Sidebar

Recent posts

  • The Grand Totals range of a pivottable in Excel
  • Replace drill-through for Power Pivot and Power BI pivottables in Excel
  • AuditfileValidator for Excel: validate and inspect Xml auditfiles
  • SAF-T auditfiles for test and development
  • Een postcodetabel op basis van BAG Extract 2.0

Recent comments

  • Harry Cuntapay on Replace drill-through for Power Pivot and Power BI pivottables in Excel
  • Lucio on Disable Shift key on open
  • Lucio on Disable Shift key on open
  • Julius Peter on The sequence of events in workbooks
  • Ben on The sequence of events in workbooks

Categories

Tags

ActiveControl ActivePrinter ADCS auditfiles BAG Connection Custom tab Database Debug Direct Debit drill-through Events event trapping Focus IBAN ISO 21378 MDI MSXML Multiple Document Interface normalize PAIN.008 PivotTable postcode Power BI RGS Ribbon SAF-T schema SEPA SOM Table Userforms validate VBA XAF xml XPath

Copyright © 2023 · eleven40 Pro on Genesis Framework · WordPress · Log in