How the utility works is, you use Ant scripts or Java code to specify the DTD or Schema file and then the utility generates all the JavaBeans, one for each element in the DTD or Schema. Typically you would use an Ant script, which is considerably simpler, and since you're going to be using the utility only once per DTD or Schema, since you'll only need to generate the beans once, the Ant script approach makes more sense. And normally you would run the Ant script from the command line. This is where Toni comes in. In the first part of the 5 part blog series, he writes: "For a dedicated NetBeans user, using a command line tool is like admitting defeat, so I had to include some basic support for Schema2Beans." So... Toni, in his blog, provides ALL the code for a wizard where one selects a DTD or Schema, one sets the Schema2Beans parameters, one then clicks Finish, and then everything else is automated by the wizard. No work for you at all. At the end of the wizard, you have a package containing all the generated beans, which you can then include in your module.
So I worked through Toni's tutorial, e-mailed a bit about things that weren't clear, and turned the result into a sample. It is a module that installs a sample in the New Project wizard and not simply a module that installs the "Generate Schema2Beans" menu item because (a) it could form the basis of a more extensive wizard (which would generate stubs for all classes required by the XML MultiView API) and so making the code available could be a good start to that end, (b) there might be bugs in the code and so if you have the code available as a sample, you might simply fix the code yourself, and (c) the people using Schema2Beans are NetBeans module writers and might therefore be interested in the code of this NetBeans module anyway. So, take the following steps and soon you'll be generating JavaBeans from DTDs and Schemas too.
The first package is the code of the module. The second package, called "examples" contains a very long list of NetBeans DTDs that I found in the NetBeans sources. They're just there to try out the functionality, once you've installed it. Otherwise, ignore these DTDs (there's also one Schema, but it doesn't seem to work in that case, for some reason).
I don't know what all those parameters, visualized by checkboxes, mean. They're simply the parameters provided by Schema2Beans. Read the documentation for details on them. And the recommended ones are only recommended because the documentation recommends them. The "-javabeans" flag cannot be set (there is no checkbox provided for this reason), because that would generate classes that do not extend BaseBean, which is what we need them to extend. So, some choices have been made. However, you have the same dilemma now as you would have if you weren't using this GUI—which parameters to set? The GUI doesn't help you, it just provides you with a visual view on top of the Schema2Beans JARs.
In some cases, I've found that the tool doesn't work. I haven't investigated why this is the case yet. Bear in mind that this is a very early release of this module. Consider it "pre-Alpha". One thing I have found is that attribute lists should be like this:
name CDATA #REQUIRED >
But, not empty like this:
<!ATTLIST bindings >
Maybe one of the many parameters should be set to avoid this problem.
That's it, thanks to Toni's great blog tutorial. You're done and, for now, you're on your own. Take the classes and put them in the module where you're going to be creating your multiview editor. First thing to do after that, as explained yesterday, is to change the data object's extension class from whatever it is to XmlMultiViewDataObject. And then read Vadiraj's blog entries on the BookMultiView Sample (links to these blog entries are in my blog entry from yesterday). Vadiraj, Toni, and I are planning to extend this functionality further, so that in the short term the wizard will generate stubs for all the basic classes needed to implement the XML MultiView API. In the longer term, we're thinking about using the Visual Library API to let the user (i.e., a NetBeans module writer) design the layout of the nodes for their multiview editor. But don't hold your breath—it might take some time... By that time though, there could be a different/better/easier API for this. How about "Schliemann for MultiView Editors". Now that would be cool and makes complete sense, since the only difference between one multiview editor and the next is the content...