X

Geertjan's Blog

  • June 24, 2007

Integrating the XML Editor for Your File Type (Part 2)

Geertjan Wielenga
Product Manager
I discovered I was wrong yesterday. Instead of replacing MultiDataObject with XMLDataObject, you must simply make sure that the MIME type ends in "+xml". For example, something like text/x-foo+xml. Once you've done that, the document will open in the XML Editor. In other words, you'll have syntax coloring for free, simply by ensuring that the MIME type is correct. Adding the cookies described in step 4 of yesterday's blog entry will give you the XML functionality for checking XML, validating XML, and transforming it via XSLT. And all that, despite the fact that the file type doesn't end in ".xml".

Finally, let's add a navigator, so that we can get an outline of our XML file and so that we can jump from a node in the Navigator to the related line in the XML Editor. Here's how you add the XML Navigator:

  1. Make very sure that your MIME type is in the form text/x-foo+xml, otherwise the XML Navigator will not work. Instead, when you click on a node, a new document will open, and the new document will not have syntax coloring, in other words, the content of your document will open in the plain text editor. Look in (at least) three places to make sure that your MIME type is correct—the MIME type resolver, the layer file, and the data loader.

  2. In the Important Files node, expand XML Layer and then expand "this layer in context". Go to the Navigator folder, create a new folder within the Navigator folder. The name of the folder must be the same as your MIME type. Then copy the content of the XML folder into your own folder. Congrats, you've just made the XML Navigator available to your own MIME type.

  3. Install the module. If you're installing in the development IDE, you may need to restart the IDE for your registration of the XML Navigator to take effect.

And now, when the document is in focus, the XML Navigator presents an outline of the document. In addition, you can navigate from the XML Navigator to anywhere you want within the document, as shown here:

Join the discussion

Comments ( 2 )
  • Deepak Sunday, June 24, 2007
    Hi Geertjan,
    The single most thing I am looking forward in this tutorial is how to get class name completion
    in XML files.
    for e.g. spring context files and hibernate config files
    This should show all project related classes and and classes loaded from JARs which are in the classpath.
    Regards,
    Deepak
  • Geertjan Sunday, June 24, 2007
    Look at https://nbtapestrysupport.dev.java.net/. I think something like this may be covered there.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services