XQuery/XML Schema to SVG

Motivation

edit

You would like a graphical way to view your XML Schemas. These diagrams should allow you to view the structure of a XML Schema file in a graphical way. These graphical views of XML Schemas make XML Schema development and review easier for non-programmers to view "business rules" in a graphical way. For example required elements may have solid boarders and optional elements have a dashed line around an XML Schema.

Challenges

edit

There are no functions in SVG to automatically estimate the size of text. We will need a small function to estimate the width of a text string based on the count of letters and the type of letters. Although this is only an estimation it usually good enough for non-publishing viewers.

A sample of these utilities is given here: SVG Utilities to estimate text width

Approach

edit

We will use an XQuery typeswitch function to dispatch XML Schema elements to various functions.

Sample Models

edit

The following is a SVG file that can be used to display the models for XML Schema. Sample Models in SVG