DataSet Designer, Schema Designer and Xml Editor

DataSet Designer, Xml Schema Designer and Xml Editor

(Note, DataSet Designer is also called DataSet Editor, Xml Schema Designer is also called Xml Schema Editor)

In VS2002 or 2003, we shipped a XmlSchema designer, which serves as both schema designer and typed dataset designer.

In VS2005, you will see that there is a brand new DataSet designer in additional to the original Xml Schema designer.

Furthermore, there is a new xml text editor (developed by Chris Lovett from another team, I am sure someone is blogging it, will find out where) called Xml Editor will be shipped too.

What are the relationships among these designers?

All of them have the same extension ".xsd"

If you start fresh, create a new DataSet item, the DataSet designer will be launched.

If you choose to create a new Xml Schema item, the XmlSchema designer will be launched.

If you double click (or open) on an existing xsd file in the solution explorer (SE), the IDE is smart to peek the content of the file and open the DataSet designer or SchemaDesigner appropriately. The DataSet file is recognized by the msdata:IsDataSet="true" attribute in the root element of the schema, for example:

<xs:element name="DataSet1" msdata:IsDataSet="true"...>

Well, you know that the DataSet is a schema file, so you can still open it by the Schema Designer, you can do this by open with menu (see the picture).

Can we open a non-DataSet xsd file with DataSet designer? Sure you can but you will be warned that to use with your own risk because the DataSet designer use DataSet.WriteSchema to persist the data. That means it does not persist white space, comment, etc.

Another cool thing is the XmlText editor and the DataSet designer shares same designer architecture and they share the same text buffer. That said, you can open an xsd file with both designer at the same time, changing in DataSet designer will reflect to XmlEdit immediately and vise versa.

To be continued…

Ok, pick it up from yesterday.

What about the sharing buffer with Xml Schema Editor? Well, that depends on which editor is opened first.

If you open the xsd file with DataSet designer first(which uses text-buffer), then open with Xml Schema Editor, you are in good luck as XML Schema Designer knows how to use text-buffer. However, if you open the file by XML Schema Designer first (which uses HtmDocData buffer), then bad luck, you cannot open it in DataSet designer as it does not know how to use HtmDocData buffer. The IDE will prompt you to close the Xml Schema Designer in order to open the DataSet designer.

When you right click on the xsd file, you can also see there is a menu command called View Code (of course there is a View Designer command, and you should know that it will launch either DataSet designer or Xml Schema Designer as I talked above). What is the View Code doing here?

Here is a summary: if the DataSet designer is opened, view code will bring you to the partial class file (e.g. DataSet1.vb). If DataSet designer is not opened or the Schema designer is opened, view code will bring you to the xsd source code with the Xml Editor.

There is an exception though for the web project. As a web project does not support the partial class, the view code command then always brings you to the xsd source code even the DataSet designer is opened first.

Wrap it up here! I hope this blog make you feel clear about how our DataSet designer works along the Xml Schema Designer and Xml (Text) Editor.

I hope we can have a new extension for typed dataset file next version.

(Don't know how to add a picture yet. See my post here for the pictures for now).

Zhiyong (John Chen)