HTTP Client API for JScript Version 9.7
 —  HTTP Client API for JScript  —

TaminoResult

This document describes the class TaminoResult of the JScript API.


Properties

errorNo

Name errorNo
Example
var tamResult =
tamClient.query("Telephone[Firstname='Bill']"); if (!tamResult.errorNo) { // if
no error ...}
Description

This delivers the error number corresponding to the action that created the TaminoResult object. A zero error value implies that there was no error.

errorText

Name errorText
Example
var tamResult =
tamClient.query("Telephone[Firstname='Bill']"); if (tamResult.errorNo) {
alert(tamResult.errorText); return(tamResult.errorNO) } // if no error {
...}
Description

This delivers the error text corresponding to the action that created the TaminoResult object. This only can be interpreted if the errorNo property is non-zero.

DOM

Name DOM
Example
var dom = tamResult.DOM; var
newPar=dom.createElement("P"); newPar.appendChild( dom.createTextNode("Mary had
a little Lamb"));
Description

This delivers the complete Tamino response as a DOM object (provided it can successfully be parsed). This has two uses:

  • To provide a DOM object to facilitate method calls like createElement, which are only implemented by the DOM Object.

  • For diagnostic purposes. In particular, this object has a property parseError which is non-null when a parse error has occurred. This object has in turn properties, two of which are errorCode and reason which explain the parsing error. This is described in the Microsoft documentation.

REQ

Name REQ
Example
var req = tamResult.REQ; var
status=req.status;
Description

This delivers the XML HTTP request object used to generate the TaminoResult.

The request object is described in the Microsoft Documentation and can be used to obtain further information about the HTTP request. The following properties are particularly useful:

  1. status
    The numerical HTTP error status if any. This would be interrogated if an error 8400 was reported by the Tamino Result. The status value is present in the error message, but it might be more convenient to obtain it this way. Alternatively, it can be used to determine if a PUT caused a document to be overwritten or not.

  2. statusText
    The text corresponding to the numerical status.

The object has the method getResponseHeader, which can be used to pick out specific HTTP headers in the Tamino response. The most useful is the header which describes when the document read was last modified. This is returned when getDocument or head methods are called. It is invoked as follows: var dateText=testResult.REQ.getResponseHeader("Last-Modified");

lastQuery

Name lastQuery
Example
var tamResult = tam.getDocument(somerelativeurl); if
(tamResult.errorNo) alert(tamResult.lastQuery + " gave " +
tamResult.errorText);
Description

This property records the URL used to retrieve the TaminoResult.

xmlbase

Name xmlbase
Example  
Description If not null, it overrides lastQuery as document base.

BIN

Name BIN
Example
var tamResult = tamClient.getBinary("Smiley");
var bytes = tamResult.BIN;
Description Delivers the Tamino response as an array of bytes. Only set for a getBinary method call.

Top of page

Methods

closeCursor

Name closeCursor
Result Type void
Example res.closeCursor()
Description If a cursor is open, it will be closed. No error is returned if a cursor is not open or Tamino returns an error.

nodes

Name nodes
Result Type DOM NodeList
Example
var nodeList = tam.nodes(..); if (nodeList) then ..
else ..
Description If the query delivers at least one result then the result is a node list of elements, otherwise the result is null. It is an abbreviation for getResult().childNodes.

getResult

Name getResult
Result Type DOM Node
Example
var XQLResult = tamResult.getResult(); if (XQLResult)
then { var nodeList = XQLResult.childNodes; var nodeCount = nodeList.length;
... } else ...
Description If the operation that created a Tamino result object delivers a query result, then this method delivers the result wrapper element. Otherwise the method delivers null.

getBooleanResult

Name getBooleanResult
Result Type Boolean
Example  
Description Decodes getResult() as a boolean.

getNumericResult

Name getNumericResult
Result Type Number
Example  
Description Decodes getResult() as a number.

getInoId

Name getInoId
Example var inoId = tamResult.getInoId();
Description This delivers the ino:id from the first ino:object element in the Tamino response document. It is used to obtain the ino:id of the document when a successful store, insert or update is performed. In the case of other operations the value returned is null.

getDocType

Name getDocType
Example var docType = tamResult.getDocType();
Description This delivers the document type from the first ino:object element in the Tamino response document. It is used to obtain the document type of the document when a successful store, insert or update is performed. In the case of other operations the value returned is null.

getCollection

Name getCollection
Example var col = tamResult.getCollection();
Description This delivers the collection name from the first ino:object element in the Tamino response document. It is used to obtain the collection name of the document when a successful store, insert or update is performed. In the case of other operations the value returned is null.

getXMLBase

Name getXMLBase(elementNode)
Result Type String
Example  
Description Calculates the xml:base value for this node in the result document.

extractURI

Name extractURI(elementNode, attribute)
Result Type String
Example  
Description Extracts an absolute URI from the attribute within the element node taking the xml:base information into account. The document base is the value of the lastQuery property, which may be overriden by the property xmlbase. This is useful in the XLink context.

Top of page

Paging Backward and Forward

getNext

Name getNext
Result Type TaminoResult
Example tamResult=tamResult.getNext();
Description This causes a query for the next page of results to be performed. The transaction context is that of the original object where the query was performed. The result is a TaminoResult object

getPrev

Name getPrev
Result Type TaminoResult
Example tamResult=tamResult.getPrev();
Description This causes a query for the previous page of results to be performed. The transaction context is that of the original object where the query was performed. The result is a TaminoResult object.

getFirst

Name getFirst
Result Type TaminoResult
Example tamResult=tamResult.getFirst();
Description This causes a query for the first page of results to be performed. The transaction context is that of the original object where the query was performed. The result is a TaminoResult object.

getLast

Name getLast
Type TaminoResult
Example tamResult=tamResult.getLast();
Description This causes a query for the last page of results to be performed. The transaction context is that of the original object where the query was performed. The result is a Tamino result object. This feature delivers null in Tamino versions 2.x.

refresh

Name refresh
Type TaminoResult
Example tamResult=tamResult.refresh();
Description This causes a page of query results to be regenerated. The transaction context is that of the original object where the query was performed. The result is a TaminoResult object. The user might call this after invoking inodelete to remove an item from a page, to show the page again.

Top of page

Getting Server Information

getTaminoVersion

Name getTaminoVersion
Type String
Example
tamResult=tam.diagnose("ping"); if (tamResult.errorNo)
{ ... // error detected } else { var
taminoVersion=tamResult.getTaminoVersion(); }
Description The TaminoResult object extracts the Tamino version from the Tamino response. This value is available from every Tamino response.

getServer

Name getServer
Type Date
Example
tamResult=tam.diagnose("ping"); if (tamResult.errorNo)
{ ... // error detected } else { var taminoServer=tamResult.getServer();
}
Description The TaminoResult object extracts the server name from the Tamino response. This value is available from every Tamino response.

Top of page

Getting Document-Related Information

getLastModified

Name getLastModified
Type Date
Example
tamResult=tam.getDocument(someURL); if
(tamResult.errorNo) { ... // error detected } else { var docDateTime = new
Date(); docDateTime=tamResult.getLastModified(); }
Description The TaminoResult object extracts the date and time of the last modification from the Tamino response. For getDocument() and head() it corresponds to the date-time when the specified document was most recently modified.

getContentType

Name getContentType
Type String
Example
tamResult=tam.head(someURL); if (tamResult.errorNo) {
... // error detected } else { var contentType=tamResult.getContentType();
}
Description The TaminoResult object extracts the content type from the Tamino response. This value is available from every Tamino response. Normally this is "text/xml" for XML documents. However, for non-XML documents it is the document's respective content type (for instance, "image/gif").

Top of page