Friday, 5 August 2011

Debugging with the Edit As Xml command in Maestro

Here'a a useful tip to assist in reporting bugs and debugging in Maestro.

At the heart of Maestro is the editors to let you edit the various types of resources that can be stored in a MapGuide Server. Now these editors are fully functional for most general cases, but should some part of a resource editor not work as advertised, here's what you can do.

Use the Edit As Xml command to view the XML form of the resource you are editing.

This command is not only convenient in that it allows you to bypass the editor and work on the actual XML content, if you know what you're trying to edit, but it also shows the xml content of the edited resource in its current state.

The resource editors in Maestro do not operate on raw XML content, instead they operate on a deserialized in-memory object form of that content. It is here that certain properties and attributes may be set incorrectly or missed due to bugs in the editor.

By invoking that command, Maestro is instructing the in-memory resource object to serialize itself back into XML, thus allowing you to see for yourself whether edits you have made in the editor have actually been applied.

This command has been very useful for me personally when implementing new resource editors or enhancing existing ones because the XML you see is exactly what gets sent back to the MapGuide Server when you hit the Save button, thus it has proven invaluable for me in debugging editor functionality and XML content model errors.

No comments: