How to: Create an .sdmdocument File

How to: Create an .sdmdocument File

An .sdmdocument file is created from a basic .sdm file.

This procedure shows how to create a basic .sdm file and validate it against the SDM XSD to create a corresponding .sdmdocument file.

Bb167808.wedge(en-us,VS.90).gifTo create an .sdmdocument file

  1. Create an XML file with the .sdm extension.

    The .sdmdocument file is the basis of every building block created in the SDK and is the basic unit of versioning and deployment. It contains SDM definitions (immutable types) and can import other .sdmdocument files. Every model must conform to the schema specified in the SystemDefinitionModel.XSD file. For more information, see SystemDefinitionModel Schema.

    The following items constitute a minimal .sdm file.

    • Every .sdm file must have a root element called SystemDefinitionModel.
    • The Name attribute contains the name of the document. By convention, the document name is the same as the name of the .sdm file without the .sdm extension.
    • The Version attribute contains the version of the .sdm file.
    • The DocumentLanguage attribute contains the default language for the descriptions found in the model.
    • The <Information> child element provides verbose details about the owner of the .sdm file.

    Using a text editor, create a Microsoft.Samples.BasicSDM.sdm file containing the following sample XML.

    <SystemDefinitionModel 
    

Name="Microsoft.Samples.BasicSDM" Version="1.0.0.0" DocumentLanguage="en" xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1"> <Information> <FriendlyName>Basic Sample model</FriendlyName> <CompanyName>Microsoft Corporation</CompanyName> <Copyright> Copyright ) Microsoft Corporation.
All rights reserved.
This is provided AS IS with no warranties, and confers no rights. </Copyright> <Description>SDM sample model</Description> </Information>

</SystemDefinitionModel>

  1. Compile the .sdm file by opening an SDM SDK Command Prompt window and typing the following command at the command prompt:

    SdmC.exe Microsoft.Samples.BasicSDM.sdm

    If the .sdm document is valid, the command above produces the compiled form of the document. In this case, you get a compiled file called Microsoft.Samples.BasicSDM.sdmdocument. Note that the contents of the compiled file are slightly different from those of the .sdm file.

    A .sdm file is compiled to get an .sdmdocument file. No executable, IL, or ASM files are produced, but a compiled .sdmdocument file is produced. The .sdm and .sdmdocument files both conform to the same XML schema, namely SystemDefinitionModel.xsd. The SystemDefinitionModel.xsd schema can be found on a machine with Visual Studio 2005 SDK installed in the directory: "%ProgramFiles%\Visual Studio 2005 SDK\<Year>-<Month>\VisualStudioIntegration\common\schemas\SystemDefinitionModel.xsd". The SDM compiler checks the .sdm file for model correctness. Imports are updated to exact name of references. Instances are simulated to check for flows and constraints. For more information, see SDM Command Prompt Window and SDM Command Line Compiler (SdmC.exe).

    The SDM compiler compiles an .sdm file and its referenced .sdm files in the following steps:

    • Load an .sdm file: After loading the .sdm file, the compiler validates the definitions against the schema and resolves any setting declarations and value assignments. The compiler also resolves paths between members and settings and validates relationships. This step verifies that the .sdm file adheres to the SDM schema and that its definition space is valid.
    • Verify that the definitions are well formed and complete. This step creates the definition space of the .sdm file.
    • Simulate instances and expand members of definitions provided (creating an instance space for this SDM system model). After the SDM compiler populates the definition space, the compiler simulates and validates the instance space, which involves expansion, flow, and constraint evaluation. The SDM compiler calls these three engines and returns any errors detected during this simulation.
    • Evaluate flow values in the instance space.
    • Check constraints in instance space.
    • Return errors, if any. The SDM compiler reports errors and warnings with the error information from flow and constraints.

Send comments about this topic to Microsoft

Build date: 10/2/2007