Schema Editors

Being at client sites all day, it seems that my cube becomes a gathering spot for people to stop by and let me know both the things that they like about Microsoft tools and the things that they don't. 

 

I was stopped the other day and was told that after installing BizTalk, whenever this person opened a XSD schema that it was opened with the BizTalk Schema Editor and not the Visual Studio Schema Editor.  In addition, he was not happy that the could not edit the XSD text in the BizTalk Schema Editor.

 

You can open any XSD schema in either editor.  The default after you install BizTalk is the BizTalk Schema Editor (you can change that by clicking the "Set as Default" button for the editor of your choice) but if you right click the schema in the Visual Studio Solution Explorer and select the Open With… menu item you will be presented with a list of editors you can use as shown in this dialog box:

 

 

If you want to use the schema editor that shipped with Visual Studio then select the "XML Schema Editor" choice. 

 

The main differences between the editors is that the schema editor that ships with Visual Studio presents you with two editing options.  The first is the schema view which shows the schema in a table format.  The other option is the XML view which behaves as a text editor and includes IntelliSense functionality.  The BizTalk Editor shows the schema in the tree view with the XSD code in a viewable, but non editable, window.  The other benefit of the BizTalk Schema Editor is that you are ensured that the XSD is valid as you are creating your schemas.  The Visual Studio editor will allow you to create an invalid schema.

 

Because of this, if you are going to use the Visual Studio Schema Editor to modify a schema that will be used in BizTalk you must be sure to validate the schema (selecting Validate Schema under the Schema menu).  The other item to note is that BizTalk uses utf-16 encoding.  The Visual Studio editor does not enforce this.  You need to make sure that not only does the processing instruction show the encoding as encoding="utf-16" but that the file is also saved that way and not as ascii.  This can be done by clicking the down arrow on the save button on the save dialog box and clicking "Save with Encoding".  A dialog will pop up which will let you select the appropriate encoding.