************************************************************************ * rss2Feed :: GetItem **************************************** *** Function: Retrieves a node by XPath value *** Assume: *** Pass: *** Return: ************************************************************************ PROTECTED FUNCTION GetItem(loDomNode,lcKey) as String loNode = loDOMNode.selectSingleNode(lcKey) IF ISNULL(loNode) RETURN "" ENDIF RETURN loNode.Textor you can use wwXML.XPathValueToFoxValue which works similiarily but can also perform type conversion for you. For example, it will do the datetime conversion for you.
>* expN1 Member ID >* expC1 Blog URL >FUNCTION BlogUpdate >PARAMETERS tnNumero,tcBlog >LOCAL lnOldSel,loHTTP,loXML,lcDate >lnOldSel=SELECT() >tcBlog=ALLTRIM(tcBlog) > >loHTTP=CREATEOBJECT('Msxml2.ServerXMLHTTP') >loHTTP.Open('GET',tcBlog,.F.) > >* Set a timeout in order to avoid long request to time out the server >loHTTP.setTimeouts(20000,20000,20000,20000) > >* We need to trap for possible errors >TRY > loHTTP.Send() >CATCH > RETURN >ENDTRY > >* Just to make sure we have an object >IF TYPE('loHTTP.ResponseXML')<>'O' > RETURN >ENDIF > >loXML=loHTTP.ResponseXML > >* Check for the presence of the node >loNodes=loXML.selectNodes('rss/channel/lastBuildDate') >IF loNodes.Length=0 > RETURN >ENDIF > >lcDate=loXML.SelectSingleNode('rss/channel/lastBuildDate').Text > >* Update the blog update >SELECT Member >SEEK tnNumero ORDER TAG Numero >REPLACE BlogUpdate WITH UTCToDateTime(lcDate) > >SELECT(lnOldSel) >>