"Price Spectre"
 All Data Structures Functions Pages
XMLNode Class Reference
+ Inheritance diagram for XMLNode:

Public Member Functions

 getChildNodes ()
 
 getElements ($name)
 
 getElement ($name)
 
 getName ()
 
 getValue ()
 

Detailed Description

A class that a node in an XML document.

Member Function Documentation

getChildNodes ( )

Retrieves all child nodes of an XML node.

Returns
An XMLNodeList containing all child nodes of an XML Node.
var response = new XMLDocument(ws.post());
// Throw exception on error.
var errorMessage = response.getElement('errorMessage');
if(errorMessage)
{
var nodeList = errorMessage.getChildNodes();
for(i = 0; i < count(nodeList); ++i)
{
if(nodeList.item(i).getName() == 'error')
{
throw nodeList.item(i).getElement('message').getValue();
}
}
}
getElement (   $name)

Retrieves an XMLNode of the first lower-level node which has the specified name.

Returns
An XMLNode of the first lower-level node which have the specified name.
Parameters
nameSpecifies the name of a node to retrieve.
var response = new XMLDocument(ws.post());
var price = response.getElement('currentPrice');
if(price !== null)
{
ps.setPrice(price.getValue() - 0.01);
}
else
{
throw "No prices found.";
}
getElements (   $name)

Retrieves an XMLNodeList of all lower-level nodes which have the specified name.

Returns
An XMLNodeList of all lower-level nodes which have the specified name.
Parameters
nameSpecifies the name of the lower-level nodes to retrieve.
var response = new XMLDocument(ws.post());
var prices = response.getElements('currentPrice');
var price = prices.item(0);
if(price !== null)
{
ps.setPrice(price.getValue() - 0.01);
}
else
{
throw "No prices found.";
}
getName ( )

Retrieves the name of the XMLNode.

Returns
The name of the XMLNode.
var response = new XMLDocument(ws.post());
// Throw exception on error.
var errorMessage = response.getElement('errorMessage');
if(errorMessage)
{
var nodeList = errorMessage.getChildNodes();
for(i = 0; i < count(nodeList); ++i)
{
if(nodeList.item(i).getName() == 'error')
{
throw nodeList.item(i).getElement('message').getValue();
}
}
}
getValue ( )

Retrieves the value of the XMLNode.

Returns
The value of the XMLNode.
var response = new XMLDocument(ws.post());
var prices = response.getElements('currentPrice');
var price = prices.item(0);
if(price !== null)
{
ps.setPrice(price.getValue() - 0.01);
}
else
{
throw "No prices found.";
}