Sex offenders web site - 314 CHAPTER 10 INFINITE DATA PATTERN client.listen
314 CHAPTER 10 INFINITE DATA PATTERN client.listen = function( status, statusText, responseText, responseXML) { if( status == 200 && responseXML != null) { var objData = new Object(); objData.didFind = false; objData.verify = IterateResults; XMLIterateElements( objData, objData, responseXML); if( objData.didFind == true && IsActiveTransactionIdentifier( objData.transactionIdentifier) == true) { var spanElement = document.getElementById( GetResultField( objData.transactionIdentifier)); spanElement.innerHTML += “(” + objData.number + “)”; } } } The implementation of client.listen is a bit more complicated because the function has to process the received XML and ensure that the results are not stale. A stale result is a result that does not belong to the currently executing transaction identifier. The first step in the implementation of the client.listen method is to ensure that results have been successfully retrieved, where the HTTP response code is 200, and that the responseXML parameter is not null. As the contract relies on XML if the responseXML parameter is null, most likely the response was not encoded using XML and thus is not applicable in the context of the pattern. If the responseXML field can be processed, the XML data needs to be iterated by using the function XMLIterateElements. The results of the iteration are written to data members of the variable objData. Specifically, the data members transactionIdentifier, didFind, and number are manipulated. The data member transactionIdentifier represents the received transac tion identifier, and number represents the prime number found. The purpose of the data member didFind is to indicate whether the data members transactionIdentifier and number are valid. If the data member didFind is assigned a value of true, a result was found. But to process and display the result, the function IsActiveTransactionIdentifier first verifies that the result is not stale and belongs to an active transaction identifier. The implementation of the function IsActiveTransactionIdentifier will be covered shortly. If the retrieved result can be processed, the data member s objData.number value is added to the destination span element. To know which span element to update (results1 or results2), the function GetResultField is called to extract the span element identifier from the received transaction identifier. The found span element instance is assigned to the variable spanElement, and the value of the spanElement. innerHTML property is appended with the found prime number (objData.number). The function IsActiveTransactionIdentifier is used to determine whether the retrieved result is active and is implemented as follows: function IsActiveTransactionIdentifier( transactionIdentifier) { var reference = transactionIdentifier.charAt( 0); var valIdentifier = parseInt( transactionIdentifier.substring( 2)); if( reference == “1″ && valIdentifier == transactionIdentifier1Counter) { return true; }
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.