Just after clicking on the "Publish Post" button to publish my latest blog post (Adding Common Methods to JAXB-Generated Java Classes (JAXB2 Basics Plugins)), I saw Geertjan Wielenga's post XML Schema Editor in NetBeans IDE 7.0.1. The irony is that I had thought about looking for a NetBeans XSD editor plugin when writing my post on generating Java classes with common methods from XSD files using JAXB and JAXB2 Basic Plugins. However, because my XSD for the example was trivially simple, I simply used NetBeans's general XML-completion capabilities to help me generate the XSD for my example. In this blog post, I look at using the XML Schema Editor plugin mentioned in Geertjan's post with the XSD from my previous post.
Although I've been using NetBeans 7.0 for months now, I ran the update tool on it to start with and am now using NetBeans 7.0.1. I then followed Geertjan's instructions and registered the update center with the URI he provides (http://deadlock.netbeans.org/hudson/job/xml/lastSuccessfulBuild/artifact/build/updates/updates.xml). This is shown in the next screen snapshot.
Once Geertjan's specified update center is registered (I registered it under the name "NetBeans Deadlock"), the "XML Tools" plugin is available in the "Available Plugins" tab as shown in the next screen snapshot.
When I click on the "Install" button in the lower left corner, the NetBeans IDE Installer comes up. What's interesting about the "License Agreement" is that it lists a whole set of useful XML-related functions apparently supported by the plugin, including "XML Schema Support." This is shown in the next screen snapshot.
With the XML Tools plugin installed, it's now time to see how it looks with the XSD file used in my previous post. With the plugin installed, clicking on the XSD file's name in the "Files" window opens up three possible views ("Source", "Schema" and "Design"). The "Design" view is shown in the next screen snapshot.
There is a palette available for graphically designing an XML Schema Definition. This is much nicer than hand-typing it like I did. You can drag an attribute or other element from the palette over onto the design and then type in the appropriate name.
The "Tree View" of the Schema tab of the XSD file is shown in the next screen snapshot.
I like the "Tree View" for quickly ascertaining the hierarchical nature of the XSD. In the same "Schema" tab, the "Columns" view is also available as indicated in the next screen snapshot.
The "Validate XML" feature is also useful in the "Schema" tab. The results of clicking on the icon with two arrows pointing down is shown next.
I don't show the "Source" tab here because it's the standard source code editor window one has for XSDs without the plugin.
I probably would have not found this plugin even if I had looked for it, because I needed the recommendation to register the particular update center called out in Geertjan's post.
It is nice to have an XML Schema Editor in NetBeans. I don't manipulate XSD files very often, but this will make it ever easier and quicker to create and maintain them in the future when I need XSD files. This plugin for handling XML Schema Definitions is a welcome addition to NetBeans's XML support. Thanks, Geertjan, for the tip!