November 21, 2008

Add Cocoon XML filetypes to NetBeans 6.5

In a previous blog entry we learned how to add documents with different file extensions as XML type to NetBeans. In NetBeans 6.5 this has become much easier and with more support for XML types. For example we could add other documents in earlier versions of NetBeans, but the Navigator view did not show the XML structure of these new added documents. In NetBeans 6.5 we cannot only add other extensions as XML types, but also the Navigator view will be fully functional!

I use Cocoon for many projects and Cocoon has several XML configuration files. These files have the extensions xmap, xconf and xweb. Let's add XML support for the xmap file extension in NetBeans 6.5. First we go to Tools | Options | Miscellaneous | Files. This is new in NetBeans 6.5, we don't have to go to Advanced Options it is right here in the Options window.

Then we click on the New button and NetBeans shows a dialog window. Here we type the File Extension: xmap and press the OK button.

Now we must select from Associated File Type (MIME) the option XML Files (text/xml). This will bind the xmap extension to the XML filetype.

We can now open a sitemap.xmap file in NetBeans and we get full XML support, even in the Navigator window: