wiki:HowToDebug

Version 4 (modified by rjwalker, 14 years ago) ( diff )

You must now use Saxon, not Xalan, to debug XSLT

How to debug GeoNetwork

Debugging Java

The easiest way to debug Java code is to add some logging statements to the code. (Sigh.)

Debugging XSLT scripts

Much of GN's functionality is implemented through XSLT scripts that are applied to the XML output of some Java code. It is possible to see that XML output and run an XSLT script on it independently. The best way to do this is to enable Jeeves debugging. In web/geonetwork/WEB-INF/config.xml, in the <general> section, set <debug>true</debug> and restart GN. Then you can add an exclamation mark (!) to the end of the name of a service to view the intermediate XML. For example, if you bring up the GN home page in your browser, the URL will end in ...main.home. Edit the URL to ...main.home! and press Enter. The intermediate XML for this page will (eventually) be displayed. You can save this to a file and then use the command-line version of Saxon on it. (For main.home, the script to use is main-page.xsl, as specified in the config.xml file.)

Debugging JavaScript and HTML in the browser

Changes/additions to layout and interactivity have to be tested in browsers. The means of testing and debugging in a browser varies from browser to browser.

Firefox

  • Firebug gives you tools to debug HTML, CSS, JavaScript - far too many to list here
  • Web Developer is great for debugging the visual aspects of GN output, e.g., the layout of forms and tables

Internet Explorer

  • Firebug Lite gives you just the console from Firebug, which might be enough to fix a problem
  • Internet Explorer Developer Toolbar provides some Firebug-like tools, but no JavaScript debugger
  • Microsoft Script Editor, which comes with Office, provides a full JavaScript debugger like the one in Firebug. This tool takes up a lot of screen real estate; it's much easier to use if you have a second display.
Note: See TracWiki for help on using the wiki.