I have made an XML Schema - all the code basically - and was wondering if there is a way that the code can generate something like this:
If so how can I do it?
I have made an XML Schema - all the code basically - and was wondering if there is a way that the code can generate something like this:
If so how can I do it?
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):-
dist/lib
folder.java -jar xsdvi.jar <input1.xsd> [<input2.xsd> [<input3.xsd> ...]] [style]
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.
You can use XMLGrid's Online viewer which provides a great XSD support and many other features:
Screenshot:
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).
On Linux (with mono, available via apt-get
on Debian) and Windows:
If you are on Windows I recommend you have a look at:
Both tools are free and both are able to provide similar visualizations as shown in your example.
If you need a simple, more text-oriented documentation of your XSD, check out xs3p - a XSLT stylesheet that will transform your XSD into more readable HTML format. Quite nice, and totally free.
If that's not enough, check out some of the commercial tools out there - I personally prefer the Liquid XML Studio - not as expensive as others, and quite as capable!
That picture is generated from a XML Schema editing tool, such as Altova's XMLSpy.
There are a number of XML tools around, all of which will include a Graphical XSD Viewer. I mentioned XML Spy simply because it is the brand leader. Also many general IDEs like Eclipse, Visual Studio and Oracle JDeveloper will be able to do this trick.
We offer a tool called DocFlex/XML XSDDoc that allows you to enjoy both things at once:
The diagrams in fact are generated not by us, but by Altova XMLSpy. We implemented an Integration with XMLSpy (with the full support of all diagram hyperlinks):
Here you can see the full this doc: http://www.filigris.com/docflex-xml/xsddoc/examples/html/XMLSchema/index.html
The whole thing provides a functionality not offered by any single vendor right now on the market!
Some our customers were so impressed that they purchased an extra license for XMLSpy only because of our tool. (That's no joke!)
Currently, we've also implemented similar integrations with other XML editors:
See: http://www.filigris.com/docflex-xml/OxygenXML/demo/html/xslt20/index.html
See: http://www.filigris.com/docflex-xml/LiquidXML/demo/html/XMLSchema/index.html
Concerning what all those diagrams depict... Essentially, they are all about content model of XSD elements (as well as other XSD components that lead to elements: complexTypes, element/attribute groups). It seems, there are two approaches here:
I personally believe that the diagrams generated by XMLSpy are more useful.
Yet, there were no attempts so far (at least known to me) to depict graphically anything else contained in XML schemas, although one can imagine many...
Visual Studio 2013 has a pretty cool visualizer built in.
File -> Open -> File pick your .xsd and then drag elements from XML Schema Explorer onto the designer surface.
There is a new free-to-use webtool, where you can view any xml schema:
It's written completely in JavaScript, so it's running in most modern browsers.
Here is my approach- download the freemind and CAM XML Template Editor.
Then open CAM XML, create new Template from XML, View -> View Template As Mind Map
Pros of this solution:
Cons:
Try my xsd-viewer available from https://github.com/santhosh-tekuri/jlibs.
We use Liquid XML Studio, it provides a intuitive editable representation of an XSD schema. It also shows the annotations inline, which we find very useful and the split code/gfx view is invaluable when writting or editing an XSD.
If someone works with IBM Rational Application Developer then XSD browser is built in it.
Grid-ML Schema Viewer is great for searching and visualizing XML Schemas: https://gridml.com/xml-schema-viewer. I find it better than other tools when it comes to large schemas or when browsing through a diagram is not feasible. The tool also allows you to copy the XPath or JSON path of the selection item.