Liquid XML Data Binder 2019
Generating an XML Data Model from a Schema Set in Visual Studio
Liquid XML Objects (C#, Visual Basic .Net) > Code Generation > Visual Studio > Generating an XML Data Model from a Schema Set in Visual Studio

If your XML schemas (XSDs) form a set that requires you to load multiple root .xsd files then you can create a schema set file and generate code from that. Navigate to "Solution Explorer", at the appropriate place right click and select "Add->New Item...", navigate to the "Liquid Technologies" section and select "XML Data Access Model".

You will be prompted to select the schemas you wish to include in the schema set, these can either be local files or remote files on a web server.

NOTE: The XSD files selected are not added to the Visual Studio project as they may be outside the scope of the project (i.e. on a remote web server). The code generation will NOT automatically run when the .xsd files are modified or changed (See Manually Forcing Code Generation).

The schema set file (.xsds) has its own settings and produces the same output files and works in the same way as a single .xsd file:-

  1. Generates a nested .cs file which contains the generated code.

  2. Liquid XML Objects settings in the 'Properties' window when you select the XSD in the 'Solution Explorer'

  3. A folder containing the compressed XSD schemas as embedded resources. See XSD Validation

  4. The addition of the NuGet package LiquidTechnologies.XmlObjects.Runtime, and a reference to System.Numerics

Changes to the .xsds schema set file or the Liquid XML Objects settings will cause the code to be re-generated. However changing the schemas themselves will not cause code re-generation, see XSD Validation.

 

Generating Code from a single XSD Generating code from a Schema Set

All the child schemas are included from a single root schema 'A'.

'A' should be added to the Visual Studio project, and code generated from it.

If the schema files 'B' and 'C' are local then It is recommended that they are added to the project. You should not generate code from 'B' or 'C' within the project.

If all  your schema files are remote our outside of the project you could also use a schema set.

If multiple schemas need to be added in order to create a set, then you should create a schema set, and generate code from this.

The schema set must contain 'A' and 'D', the schemas 'B' and 'C' can be added, but its not required.

Schema Sets make it possible to work with multiple different schemas in the same project or where the schemas are structured in this way.

 

See Also

Generated Code