| 1 | = How to debug GeoNetwork = |
| 2 | |
| 3 | == Debugging Java == |
| 4 | |
| 5 | The easiest way to debug Java code is to add some logging statements |
| 6 | to the code. (Sigh.) |
| 7 | |
| 8 | == Debugging XSLT scripts == |
| 9 | |
| 10 | Much of GN's functionality is implemented through XSLT scripts |
| 11 | that are applied to the XML output of some Java code. |
| 12 | It is possible to see that XML output and run an XSLT script |
| 13 | on it independently. |
| 14 | The best way to do this is to enable Jeeves debugging. |
| 15 | In `web/geonetwork/WEB-INF/config.xml`, in the `<general>` |
| 16 | section, set `<debug>true</debug>` and restart GN. Then |
| 17 | you can add an exclamation mark (`!`) to the end of the |
| 18 | name of a service to view the intermediate XML. |
| 19 | For example, if you bring up the GN home page in your |
| 20 | browser, the URL will end in `...main.home`. Edit the |
| 21 | URL to `...main.home!` and press Enter. The intermediate |
| 22 | XML for this page will (eventually) be displayed. You |
| 23 | can save this to a file and then use the command-line |
| 24 | version of Xalan on it. (For `main.home`, the script |
| 25 | to use is `main-page.xsl`, as specified in the |
| 26 | `config.xml` file.) |
| 27 | |
| 28 | |
| 29 | == Debugging in the browser == |
| 30 | |
| 31 | Changes/additions to layout and interactivity |
| 32 | have to be tested in browsers. |
| 33 | The means of testing and debugging in a |
| 34 | browser varies from browser to browser. |
| 35 | |
| 36 | === Firefox === |
| 37 | |
| 38 | * [http://getfirebug.com/ Firebug] gives you tools to debug HTML, CSS, !JavaScript - far too many to list here |
| 39 | * [http://chrispederick.com/work/web-developer/ Web Developer] is great for debugging the visual aspects of GN output, e.g., the layout |
| 40 | of forms and tables |
| 41 | |
| 42 | === Internet Explorer === |
| 43 | |
| 44 | * [http://getfirebug.com/lite.html Firebug Lite] gives you just the console from Firebug, which might be enough to fix a problem |
| 45 | * [http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en Internet Explorer Developer Toolbar] |
| 46 | provides some Firebug-like tools, but no !JavaScript debugger |
| 47 | * Microsoft Script Editor, which comes with Office, provides a full !JavaScript debugger like the one in Firebug. |
| 48 | |