I have just released a new custom control for the OpenNTF Development Competition. It reads the xml data from http://dilbert.com/xml/widget.daily and displays the image for the current days strip.
The control uses only a few lines of code to retrieve and parse the data.
var domfactory:javax.xml.parsers.DocumentBuilderFactory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
var xmldocument:javax.xml.parsers.DocumentBuilder = domfactory.newDocumentBuilder();
var domdoc:DOMDocument = xmldocument.parse("http://dilbert.com/xml/widget.daily");
var CurDay:DOMNodeList = domdoc.getElementsByTagName("CurrentDay");
var CurDayVal:DOMNode = CurDay.item(0);
var domelements:DOMNodeList = domdoc.getElementsByTagName("URL_Strip");
var domnode:DOMNode = domelements.item(parseInt(CurDayVal.getFirstChild().getNodeValue()));
return '<img src=\"http://www.dilbert.com' + domnode.getFirstChild().getNodeValue()+ '\" />';
If you find any business value from using this control, please let me know. I doubt there is one …
Changed the code and now use a more elegant way to determine todays day number.