By: Koen Verbeeck
Overview
In this chapter we will take a look at the foundations of the Biml language.
It’s all XML
As mentioned before, Biml is basically XML. This means it follows the hierarchical structure of XML. Let’s illustrate with an example. This piece of Biml describes a simple package with one connection and one Execute SQL Task:
The script starts with the Biml root node and then child nodes are added. Simplified, the hierarchical structure of Biml can be represented with this schema:
The Biml node can have connections, fileformats (used with flat files) and packages. Packages have tasks and containers and containers can contain tasks.
A data flow is a special task, which has its own set of child nodes:
This schema just represents the basics of an SSIS package. With Biml you can specify every construct that you can also create manually in Visual Studio: event handlers, log providers, connection managers, package parameters, variables, expressions, script tasks and so on. The only notable exception are project parameters, which can be specified in Biml, but will not actually be generated.
You can find more info about the Biml language elements in the official documentation.
Since it’s XML, Biml has to adhere to some rules. Each element has an opening and a closing tag, or it is an empty tag. An element can have zero or more attributes.
Keep in mind some characters are reserved characters in XML. They need to be replaced with escape codes:
Character | Escape code |
---|---|
double quote " | " |
single quote ' | ' |
< | < |
> | > |
& | & |
You can also specify comments in Biml, just as in XML:
Why XML?
Biml uses XML because SSIS packages are also XML behind the scenes. You can verify this by right-clicking a package and selecting View Code.
However, the XML of Biml is much more simplified than the XML schema used for SSIS packages. It’s certainly more readable; you can manually write it if you desire. This makes Biml an ideal starting point for automating the creation of your SSIS packages. It’s also much easier to compare Biml files (through source control for example) and to reuse code. In the next chapter, we will write a bit of Biml code to generate our first package.
Additional Information
- The tip Introduction to Business Intelligence Markup Language (BIML) for SSIS gives also a general introduction to the Biml language.
Last Update: 2/18/2018