XSD’s in Visual Studio: Past, Present and Future.
Tue, Dec 30 2008 12:51
When I was going through the snippet editor code to put it on CodePlex, I wanted to grab a screen shot of the snippet schema. immediately I was confronted with there being no visual designer for schemas in VS 2008, but the worse part was I could have sworn there use to be. To clear up that confusion here’s an illustrated history lesson on schema views in Visual Studio.
In earlier versions of Visual Studio the schema designer was a bit like the early dataset designer.
This is Visual Studio 2005 :
It was detailed as far as types and constraints goes but omitted documentation. With complex schemas it was a mess, but you could hide parts.
Then in Visual Studio 2008 they decided to get rid of the schema designer completely !! I’m really not sure the logic on that. There was however a CTP for the new Schema Explorer, and come Visual Studio 2008 Service Pack 1, the schema explorer was included. (I hope I’ve got that bit of history right)
The Schema explorer gives a nice overview, and provides for navigation but totally lacks real details (not synchronized with the properties window). Sadly for Visual Studio 2008 that’s as best as it gets, the rest is wading through the actual xsd file as xml.
The first CTP of Visual Studio 10, reveals a new designer that can be used in conjunction with the Schema Explorer.
This pretty visual representation is all done in WPF so you can zoom in and out nicely. As well as the ability to easily expand and shrink elements, it’s really nice way to get an overview. You can even turn on documentation so as you can see any comments from the schema:
Although this is very pretty, and a great visual aid, it still doesn’t provide any means to create a schema or edit one… it’s simply a view. Some things I’d like to see improved are :
- Provide designer editing and creation of schemas
- have an export to .png feature
- Ability to fully expand comments for all items. At present only the first two lines are shown and you have to double click on each element to get the comments to fully expand
- did I mention editing ?
- tear-offs would be nice, such that I could then use the width of the screen (eg: Drag the “Header” element from the above picture to the right, and then it expands over there rather than in situ.)
- show restrictions. For example, the SnippetType is restricted to three possible legal values, “Expansion”, “SurroundsWith” and “Refactoring”. To find that out I have to delve into the xsd.
- Synchronise with Properties window allowing for more detail to be shown and edited in the Properties window
- Provide Copy as Path. The bottom of the screen shows the path of the selected node, but it would be great if you could select to copy that to the clipboard as an XPath. Even cooler if you could choose between XPath, VB XML Axis/Literal sytnax, or XElement syntax (for those poor ol’ C# folks ;) )
The Visual Studio 10 stuff looks promising, but still has a long way to go. (did I mention the lack of editing ?) In the interim it would be nice if there was something, anything ! I’m really not sure why the 2005 xsd designer was dropped. Sure some of it was ugly, especially the way it shows things like the string restrictions, but it was and is less ugly than the XML for that part of the xsd !!
Visually we have progressed... but what about the editing ??