Home > Uncategorized > Generate XSD Schema from XML using Visual Studio

Generate XSD Schema from XML using Visual Studio

This article uses Biztalk Schema Editor update some attributes. You can also update them directly in the XSD.

  • Open an XML document in Visual Studio
  • Click Create Schema from the XML menu

  • We need to validate that the created schema matches xml output received from SQL.
  • Save the Schema XSD file into a folder using FileàSave As
  • Close the XSD file
  • Reopen the XSD file using the Biztalk Schema Editor
    • Click File menu
    • Click Open àFile
    • Select the XSD file
    • Click Open with

    • Select Biztalk Editor
    • Use the editor to update properties of elements and attributes
  • Using the Create Schema tool to generate XSD from XML may not generate valid information about elements and attributes. We need to take a look at each element and attribute and make sure that the following properties are correct:
    • maxOccurs: unbound means that there isn’t max number (i.e. unlimited)
    • type: make sure that the type matches the column type in the database. For exmple, in the persons schema, the Generate Schema tool assigned the type for addressId attribute to be unsignedShort while the correct type should Integer
    • use: Optional, Required, or Prohibited
    • nilable: true if the element can be null, false othewise
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: