Stuffed Dog Translation Service Example

Type a sentence and press the button.


Check for Spelling Errors(EN)
No Data Loaded.

The Stuffed Dog Example

Stuffed Dog is a XML-RPC service which checks the spelling of your texts.

This example uses vcXMLRPC to check the spelling of one sentence from within your browser (no cgi involved).

Javascript Code

//Set up routing.
XMLRPC.routeServer = "http://www.vcdn.org/cgi-bin/rpcroute.cgi";

//Set up the Stuffed dog service API.
stuffeddog = XMLRPC.getService("http://www.stuffeddog.com/speller/speller-rpc.cgi");
stuffeddog.add("speller.spellCheck", "check");

//Set up the Error handling.
XMLRPC.onerror = function(e){
   document.getElementById("RPCResult").innerHTML = "An Error has occured:<br><br><b>" + e.message + "</b><br><a href='help.php#errors'>Help about this error</a>";
   return true;
}

//Function that is called by GUI.
function doCheck(){
   inp = document.getElementById("sentence");
   result = stuffeddog.check(inp.value);
   check(result);
}

function check(data){
   if(data || data == ""){
      var resultWindow = document.getElementById("suggestions");
      resultWindow.innerHTML = "Wait... Loading data....";
      res = "";

      for(j=0;j<data.length;j++){
         res += "Suggestions for <b>\"" + data[j].word + "\"</b>";

         arr = data[j].suggestions;
         for(i=0;i<arr.length;i++){
            res += "<li>" + arr[i] + "</li>";
         }
         res += "<br>";
      }

      resultWindow.innerHTML = ((res == "") ? "No Spelling Errors Found" : res);
   }
}
 vcXMLRPC© 1999-2001 Virtual Cowboys  |  We thank our host: Helder Hosting