
i;
for(i = 0;i < this.prices.length;i++)
result += this.prices[i].toXML();
return element(“product”,””,result);
}
// price object
function Price(amount,currency)
{
this.amount = amount;
this.currency = currency;
this.toXML = price_toXML;
}
function price_toXML()
{
return element(“price”,
“currency=\”” + this.currency + “\””,
escapeXML(this.amount));
}
Because this application does not use DOM, it works with browsers that
have no XML support (obviously, they need to support JavaScript), such as
Netscape 4. Figure 9.3 shows the result in Netscape.
A Non-DOM Data Structure
This application is radically different from the other applications intro-
duced in this chapter ...