when things go wrong, the steps you should take

During more complex SVG projects, such as this project, one regularly runs into errors and developing problems. The following tricks can help during development:

  1. load the serverside function manually to check if there aren’t any error messages in the generated code, such as PHP error messages. Often the generated code requested is already in error, contains error messages or is not valid or well formed.
  2. XML is not wellformed: validate the file if things go wrong and you don’t know what’s wrong. In many cases an invalid XML structure is the cause of problems
  3. Use Batik or other SVG viewers (e.g. Opera9 or MozillaSVG): Apache Batik is an excellent SVG development tool that is stricter in parsing SVG than ASV. This often helps detect problems. It also helps to compare error messages of different SVG viewers
  4. Use the Batik integrated JavaScript debugger to find errors in the js-code: you need to enable the debugger as follows: Open “Edit” → “Preferences”, go to the “Browser Options” → “Security Settings” tab and turn off “Enforce secure scripting”. Close the preferences window using the “OK” button. Open the debugger with “Tools” → “Script Debugger”. Reload the SVG file to activate the debugger.
  5. Turn on the “Validating XML parser” in Batik: Go to “Edit” → “Preferences” → “Browser Options” and turn on the “Use a validating XML parser” checkbox
  6. Use the “Save As” functionality of ASV and Batik to save the current state of the DOM (after script execution and (partial) data-loading) to see if the loaded syntax is correct after receiving data with getURL(). To do so, add the line as a processing instruction after the DOCTYPE declaration. This enables the “Save the actual state of the DOM” function in ASV if you right click in the plugin and use the “Save AS” command. Open it in an XML validator and check the syntax. In Batik (newest CVS version) there is a “Save As” entry in the “File” menu that allows to save the current state of the DOM to a file.
  7. Ask a SVG discussion group or forum, such as the yahoogroups svg-developers list or the Apache Batik email list
  8. ask the author of this tutorial for help: but please ONLY after all the other options failed!

Share with:

  • email
  • LinkedIn
  • Twitter
  • Facebook
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • 豆瓣

Related posts: