This is an old revision of the document!


  • When using XPaths to locate page elements, try to avoid absolute paths that might break easily. For example, instead of using
    /html/body/table/tbody/tr/td[2]/table/tbody/tr/td[@class="bucket"]/div[@class="content"]/ul/li

    try a more flexible XPath like

    //table/tbody/tr/td[@class="bucket"]/div[@class="content"]/ul/li
  • When writing translators, debugging via the console is essential. To debug via the console, start Firefox from the command line (cmd.exe in Windows, Terminal.app in MacOS). Any output from the translator can be dumped to the console using
    Zotero.debug("hello world!");
  • The functions Zotero.Utilities.HTTP.doGet and Zotero.Utilities.processDocuments run asynchronously. In order to allow them to complete before moving along, follow either function with Zotero.wait() and include Zotero.done() as the onDone in order to signal the translator that it has completed its asynchronous operations.
dev/translator_tips_tricks.1168265569.txt.gz ยท Last modified: 2010/04/07 06:35 (external edit)