FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour responseXML
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

responseXML

Posted: Fri May 12, 2017 06:52 PM

Hi, all !

I make a request to the site and want to get the DOM document

TRY
oHttp:= CreateObject( "MSXML2.XMLHTTP" )
CATCH
oHttp:= CreateObject( "microsoft.XMLHTTP" )
END

oHttp:Open( "GET", MyURL, 1)
oHttp:setRequestHeader( 'Content-type', 'text/xml')
oHttp:Send(NIL)

fl:=int(gettickcount()/1000)
do while .T.
    if oHttp:readyState=4.and.oHttp:Status=200
      cTxt:=oHttp:responseText
      oDc:=oHttp:responseXML
      exit
  endif
  millisec(50)

enddo

Everything works fine. oHttp:responseText returns an html text page, but the responseXML is empty. What am I doing wrong ?

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: responseXML

Posted: Fri May 12, 2017 09:06 PM
Try with

Code (fw): Select all Collapse
oHttp:ResponseBody


EMG
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: responseXML

Posted: Sat May 13, 2017 06:52 AM

Thank you, Enrico, for your help. However responceBody returns HTML, but not the document

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: responseXML

Posted: Sat May 13, 2017 08:43 AM

What do you mean with "the document"? XML is a text, just like html body.

EMG

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: responseXML

Posted: Sat May 13, 2017 10:13 AM

WEB document-page website. Respobsetext/Responsebody return a html page. ResponseXML returns a DOM-compatible document page, which you can parse with DOM tools.
For example oHttp:responseXML:getElementById("ABC")

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: responseXML

Posted: Sat May 13, 2017 11:14 AM
Ok. Try

Code (fw): Select all Collapse
oHttp:Open( "GET", MyURL, .T.)


EMG
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: responseXML

Posted: Sat May 13, 2017 01:47 PM

In fact oHttp:Open( "GET", MyURL, 1), no different from oHttp:Open( "GET", MyURL, .T.) :D
It's still not working

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: responseXML

Posted: Sat May 13, 2017 02:25 PM

Ok. I don't know why ResponseXML it's empty, sorry. :-(

EMG

Posts: 17
Joined: Tue Oct 06, 2015 07:06 AM

Re: responseXML

Posted: Sun May 14, 2017 04:38 PM

try with: oHttp:responseText

Continue the discussion