XML Schema Designer – Content Model View

The new XML Schema Designer (see this previous blog post for a d/l location to the CTP) offers four views over XML Schema Sets: XML Schema Explorer, Graph View, Content Model View, and Start View. This entry will focus on the Content Model View. The Content Model View provides a detailed view of individual nodes in a schema set.

Basics of the view:

Q: What’s the purpose of the Content Model View?

A: The Content Model View (CMV) allows you to understand the specifics of a schema set. It lets you drill down into the content model of schema nodes, and will facilitate a deeper understanding of the schema set and the XML instance document the schema describes.

Q: How do you get to it?

A: You open an XSD in VS, drag nodes onto the design surface and switch the designer to the Content Model View using the toolbar embedded into the design surface. You can also switch to the CMV for a particular schema node from the Graph View or Schema Explorer, using the right click menu.

Q: What do you show on the CMV?

A: While you can only add global nodes to the CMV, you can drill down to the local nodes by using the expand/collapse button on the nodes. The content that is displayed in the CMV is the ‘compiled’ content for a schema node. Elements, attributes, complex and simple types, groups, attribute groups are shown as nodes, while occurrence constraints (minOccurs, maxOccurs), derivation relations (extends, restricts), compositors (sequence, choice) are shown along with the nodes to which they apply. References are also shown in the CMV, but not as top level nodes – you have to drill down to get to them.

Q: What if I want to view more than one node, like in the Graph View?

A: The vertical “filmstrip”, titled Workspace, – on the left shows you all of the nodes in your workspace. The highlighted nodes are shown on the designer canvas. You can highlight multiple nodes to compare them side by side in the CMV.

Like in the Graph View, you can zoom and pan. You can also view the properties of the currently selected node in the Properties window.

Here’s a screenshot:

Here the CMV shows a complexType schema node, expanded to view the content model. Notice how the schema nodes can be expanded and collapsed, depending on what you’re examining at the moment.