SourceForge.net Logo

Standalone Classic Taconite Parser

In previous versions of Taconite, the Taconite client (the JavaScript client for making Ajax requests, in taconite-client.js) and the Taconite parser (the object that parses the server's response XML to update the DOM, in taconite-parser.js) were pretty tightly coupled. With Taconite 3, the two are cleanly separated so that you can use the parser independently of the client.

To use the classic Taconite parser to parse a server's response XML, simply create an instance of the TaconiteParser object and pass the server's response XML to its parse() method. The example below uses jQuery to submit an Ajax request but uses the classic Taconite parser to parse the server's response XML.

/*
    this function submits an Ajax request to the server 
    and specifies handleScreenUpdate as the response handler function.
*/
function updateScreen() {
    $.get("update.php", null, handleScreenUpdate);
}

/*
    jQuery sees that the server's response has a content type
    of text/xml, so the "data" parameter is the responseXML property
    from the XMLHttpRequest object.  Note how a new instance of
    TaconiteParser is created, and "data" is passed to its parse() method.
*/
function handleScreenUpdate(data, textStatus) {
    new TaconiteParser().parse(data);
}