Engine for Web Applications

org.cote.js.xml

static org.cote.js.xml

version 1.9.18

A library for making XMLHTTP Requests.

This class participates in the engine library.

Index

Example Index

Object Index

Property Index

Method Index

Examples

Asynchronous GET

Make an asynchronous request for an XML document.

Syntax

[int] = getXml(path,custom_handler,1,{optional_id});

Example Code

function HandleXml(s,v){
   var oXml = v.xdom;
}
org.cote.js.xml.getXml("/Data/Test1.xml",HandleXml,1);

Asynchronous POST

Asynchronously post data to the server.

Syntax

[int] = postXml(path,data,custom_handler,1,{optional_id});

Example Code

function HandleXml(s,v){
   var oResponseXml = v.xdom;
}
var oPostThis = org.cote.js.xml.newXmlDocument("Request");
var oResponseXml = org.cote.js.xml.postXml("/Data/TestData.aspx",oPostThis,HandlePostXml,1);

Cached Asynchronous GET

Asynchronously request an XML document, and cached the result for later referal.

Syntax

[int] = getXml(path,custom_handler,1,request_id,1);

Example Code

function HandleXml(s,v){
   var oXml = v.xdom;
}
org.cote.js.xml.getXml("/Data/Test1.xml",HandleXml,1,"cache-me",1);

Synchronous GET

Make a synchronous request for an XML document.

Syntax

[xml_dom_object] = getXml(path);

Example Code

var oXml = org.cote.js.xml.getXml("/Data/Test1.xml");

Synchronous POST

Synchronously post data to the server.

Syntax

[xml_dom_object] = postXml(path,data);

Example Code

var oPostThis = org.cote.js.xml.newXmlDocument("Request");
var oData = oPostThis.createElement("data");
oData.setAttribute("id","data-id");
oData.setAttribute("value","data-value");
oPostThis.documentElement.appendChild(oData);
var oResponseXml = org.cote.js.xml.postXml("/Data/TestData.aspx",oPostThis);

Objects

XmlHttp

Object representing a pooled XMLHTTP resource Object is private and should not be directly referenced.

Properties

XmlObject

Object passed to the event handler following an XML request using getXml or postXml.

Properties

Properties

ax_http_control

Specifies the name of the registered ActiveX control to use for XML requests.

Syntax

String = org.cote.js.xml.ax_http_control

org.cote.js.xml.ax_http_control = String

ax_http_control

Specifies the name of the registered ActiveX control to use for XML requests.

Syntax

String = org.cote.js.xml.ax_http_control

org.cote.js.xml.ax_http_control = String

gadget_base_path

Specifies the base path to use when operating in Gadget mode. The base path should be in the format of a file URI, such as file:///c:/....

Syntax

String = org.cote.js.xml.gadget_base_path

org.cote.js.xml.gadget_base_path = String

gadget_control

Specifies the name of the registered ActiveX control to use for XML requests when in Gadget mode.

Syntax

String = org.cote.js.xml.gadget_control

org.cote.js.xml.gadget_control = String

gadget_mode

Specifies whether the xml package is operating in a mode that better supports Windows Sidebar Gadgets.

Syntax

boolean = org.cote.js.xml.gadget_mode

org.cote.js.xml.gadget_mode = boolean

Methods

_request_xmlhttp

Assembles and opens an XMLHTTP Request. Method is private and should not be directly referenced.

Syntax

v = _request_xmlhttp( p, h, a, i, x, d, c )

Parameters

Returns

v as variant: Returns a boolean value for asynchronous requests, and an XML Document for synchronous requests.

clear

Clears the request maps and caches.

Syntax

void clear( )

clearCache

Clears the response cache.

Syntax

void clearCache( )

getCacheEnabled

Syntax

b = getCacheEnabled( )

Returns

b as boolean: boolean indicating whether caching is enabled.

getCDATAValue

Returns a concatenation of all CDATA values that are immediate children of the specified node.

Syntax

v = getCDATAValue( n )

Parameters

Returns

v as String: Returns a concatenation of all child CDATA values.

getInnerText

Returns a concatenation of text nodes belonging to all children of the specified node.

Syntax

sTxt = getInnerText( n )

Parameters

Returns

sTxt as String: Returns the inner text of the specified node.

getPoolEnabled

Syntax

b = getPoolEnabled( )

Returns

b as boolean: boolean indicating whether pooling is enabled.

getXml

Retrieve an XML document from the specified path.

Syntax

v = getXml( p, h, a, i, c )

Parameters

Returns

v as variant: Returns boolean for asynchronous operations, and an XMLDocument object for synchronous operations.

getXmlHttpArray

Syntax

aXml = getXmlHttpArray( )

Returns

aXml as array: Array of XmlHttp objects.

getXmlHttpObjectFromPool

Retrieves the next available XmlHttp object from the pool of available resources. Method is private and should not be directly referenced.

Syntax

oXml = getXmlHttpObjectFromPool( y )

Parameters

Returns

oXml as XmlHttp: An XmlHttp object.

newXmlDocument

Syntax

oXml = newXmlDocument( s )

Parameters

Returns

oXml as XMLDocument: XMLDocument object.

newXmlHttpObject

Creates a new XMLHTTPRequest object. Method is private and should not be directly referenced.

Syntax

v = newXmlHttpObject( b, i, z )

Parameters

Returns

v as variant: Return value is determined by the specified parameters.

postXml

Posts an XML document to the specified path and returns any XML response.

Syntax

v = postXml( p, d, h, a, i )

Parameters

Returns

v as variant: Returns boolean for asynchronous operations, and an XMLDocument object for synchronous operations.

queryNode

Returns a DOM Node selected from the specified document and based on the specified parent node name, node name, and attribute name and values.

Syntax

aNodes = queryNode( d, p, n, a, v )

Parameters

Returns

aNodes as DOMNode: Returns a DOM Node based on the specified parent node name, node name, and attribute name and value.

queryNodes

Returns an array of DOM Nodes selected from the specified document and based on the specified parent node name, node name, and attribute name and values.

Syntax

aNodes = queryNodes( d, p, n, a, v )

Parameters

Returns

aNodes as array: Returns an array of DOM Nodes based on the specified parent node name, node name, and attribute name and value.

removeChildren

Removes all child nodes of the specified node.

Syntax

void removeChildren( o )

Parameters

resetXmlHttpObjectPool

Resets the current pool with new instances of XMLHttpRequest objects.

Syntax

void resetXmlHttpObjectPool( )

returnXmlHttpObjectToPool

Returns an in-use XmlHttp object to the pool of available resources. Method is private and should not be directly referenced.

Syntax

void returnXmlHttpObjectToPool( i, y )

Parameters

selectNodes

Returns an array of DOM Nodes selected from the specified document and based on the specified path.

Syntax

aNodes = selectNodes( d, p, c )

Parameters

Returns

aNodes as array: Returns an array of DOM Nodes based on the specified xpath query.

selectSingleNode

Returns a DOM Node selected from the specified document and based on the specified path.

Syntax

v = selectSingleNode( d, p, c )

Parameters

Returns

v as String: Returns a DOM Node based on the specified xpath query.

serialize

Returns a string representation of the specified node and its children.

Syntax

s = serialize( n )

Parameters

Returns

s as String: String representation of the specified node.

setCacheEnabled

Syntax

void setCacheEnabled( b )

Parameters

setInnerXHTML

Copies the child nodes of the specified source node into the specified target node.

Syntax

v = setInnerXHTML( t, s, p, d, z, c, h, ch )

Parameters

Returns

v as variant: Depending on the type of copy operation, returns a reference to the newly created node.

setPoolEnabled

Syntax

void setPoolEnabled( b )

Parameters

testXmlHttpObject

Tests whether an XMLHTTPRequest object can be created.

Syntax

b = testXmlHttpObject( )

Returns

b as boolean: Bit indicating whether a new XMLHTTPRequest object was created.

transformNode

Transforms the specified Document with the specified XSL document.

Syntax

v = transformNode( x, s, n, i, j, p )

Parameters

Returns

v as variant: Depending on the type of copy operation, returns a reference to the newly created node.