How to visualize an XML schema programatically? [closed]

Solution 1:

The open source command line java application xsdvi creates an interactive diagram in SVG format from an XML Schema Definition. The generated SVG file can be displayed by a modern web browser where the user can expand and collapse the tree by mouse clicking.

Here is an example of a generated diagram

http://xsdvi.sourceforge.net/ipo.svg

The software can be downloaded from

http://sourceforge.net/projects/xsdvi/

It can be run as follows (assuming Java is installed and java.exe is in the path):-

  1. Go to the dist/lib folder.
  2. Run the following command java -jar xsdvi.jar <input1.xsd> [<input2.xsd> [<input3.xsd> ...]] [style]

Solution 2:

XSD Diagram is free (GNU open license), doesn't need to be built, and gives an interactive diagram. You just open the file and Add the types you want on the (initially blank) diagram. Pretty straight forward.

enter image description here

Solution 3:

You can use XMLGrid's Online viewer which provides a great XSD support and many other features:

  • Display XML data in an XML data grid.
  • Supports XML, XSL, XSLT, XSD, HTML file types.
  • Easy to modify or delete existing nodes, attributes, comments.
  • Easy to add new nodes, attributes or comments.
  • Easy to expand or collapse XML node tree.
  • View XML source code.

Screenshot:

Screenshot

Solution 4:

The Oracle JDeveloper 11g built-in viewer is in my view superior to the one available for Eclipse (which, in addition to other unfavourable comparison points I could only get to install for Indigo but not for Juno). If I am not mistaken Oracle makes the JDeveloper available for free (only requires registration at the OTN).

enter image description here

Solution 5:

On Linux (with mono, available via apt-get on Debian) and Windows:

  • XSDDiagram (runs on Mono as well)

If you are on Windows I recommend you have a look at:

  • XMLPad3 from WMHelp or

Both tools are free and both are able to provide similar visualizations as shown in your example.