I discovered I was wrong yesterday. Instead of replacing MultiDataObject
, 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:
- 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.
- 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.
- 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: